提交 e8b1a0fe 编写于 作者: D Don Syme

Merge commit '084a6824' into feature/ext


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30503.244
# Visual Studio Version 17
VisualStudioVersion = 17.1.32228.430
MinimumVisualStudioVersion = 10.0.40219.1
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.Service", "..\src\fsharp\FSharp.Compiler.Service\FSharp.Compiler.Service.fsproj", "{A59DB8AE-8044-41A5-848A-800A7FF31C93}"
EndProject
......@@ -15,7 +15,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSharp_Analysis", "..\tests
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TestTP", "..\tests\service\data\TestTP\TestTP.fsproj", "{2EF674B9-8B56-4796-9933-42B2629E52C3}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Test.Utilities", "..\tests\FSharp.Test.Utilities\FSharp.Test.Utilities.fsproj", "{38A23D53-E2BF-4B76-907F-49F41D60C88E}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Test.Utilities", "..\tests\FSharp.Test.Utilities\FSharp.Test.Utilities.fsproj", "{38A23D53-E2BF-4B76-907F-49F41D60C88E}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.ComponentTests", "..\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj", "{2A182B7D-EDA3-4BF2-84B8-C7553BB7A5A7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
......@@ -47,6 +49,10 @@ Global
{38A23D53-E2BF-4B76-907F-49F41D60C88E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{38A23D53-E2BF-4B76-907F-49F41D60C88E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{38A23D53-E2BF-4B76-907F-49F41D60C88E}.Release|Any CPU.Build.0 = Release|Any CPU
{2A182B7D-EDA3-4BF2-84B8-C7553BB7A5A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2A182B7D-EDA3-4BF2-84B8-C7553BB7A5A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A182B7D-EDA3-4BF2-84B8-C7553BB7A5A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2A182B7D-EDA3-4BF2-84B8-C7553BB7A5A7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace FSharp.Compiler.ComponentTests.Conformance.Conformance.DeclarationElements.CustomAttributes.AttributeUsage
open Xunit
open FSharp.Test
open FSharp.Test.Compiler
module AttributeUsage =
let verifyCompile compilation =
compilation
|> asExe
|> withOptions ["--nowarn:988"]
|> compile
let verifyCompileAndRun compilation =
compilation
|> asExe
|> withOptions ["--nowarn:988"]
|> compileAndRun
// SOURCE=AssemblyVersion01.fs # AssemblyVersion01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AssemblyVersion01.fs"|])>]
let ``AssemblyVersion01_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=AssemblyVersion02.fs # AssemblyVersion02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AssemblyVersion02.fs"|])>]
let ``AssemblyVersion02_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=AssemblyVersion03.fs # AssemblyVersion03.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AssemblyVersion03.fs"|])>]
let ``AssemblyVersion03_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=AssemblyVersion04.fs # AssemblyVersion04.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AssemblyVersion04.fs"|])>]
let ``AssemblyVersion04_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=AttributeTargetsIsCtor01.fs # AttributeTargetsIsCtor01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AttributeTargetsIsCtor01.fs"|])>]
let ``AttributeTargetsIsCtor01_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=AttributeTargetsIsMethod01.fs # AttributeTargetsIsMethod01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AttributeTargetsIsMethod01.fs"|])>]
let ``AttributeTargetsIsMethod01_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=ConditionalAttribute.fs # ConditionalAttribute.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"ConditionalAttribute.fs"|])>]
let ``ConditionalAttribute_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=E_AttributeTargets01.fs # E_AttributeTargets01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargets01.fs"|])>]
let ``E_AttributeTargets01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
]
// SOURCE=E_AttributeTargets02.fs # E_AttributeTargets02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargets02.fs"|])>]
let ``E_AttributeTargets02_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
]
// SOURCE=E_ConditionalAttribute.fs SCFLAGS="--test:ErrorRanges" # E_ConditionalAttribute.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_ConditionalAttribute.fs"|])>]
let ``E_ConditionalAttribute_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
]
// SOURCE=E_RequiresExplicitTypeArguments01.fs SCFLAGS="--test:ErrorRanges" # E_RequiresExplicitTypeArguments01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_RequiresExplicitTypeArguments01.fs"|])>]
let ``E_RequiresExplicitTypeArguments01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
]
// SOURCE=E_RequiresExplicitTypeArguments02.fs SCFLAGS="--test:ErrorRanges" # E_RequiresExplicitTypeArguments02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_RequiresExplicitTypeArguments02.fs"|])>]
let ``E_RequiresExplicitTypeArguments02_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
]
// # SOURCE=E_WithBitwiseAnd01.fsx SCFLAGS="--test:ErrorRanges -a" # E_WithBitwiseAnd01.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_WithBitwiseAnd01.fsx"|])>]
let ``E_WithBitwiseAnd01_fsx`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
]
// SOURCE=E_WithBitwiseOr01.fsx SCFLAGS="--test:ErrorRanges -a" # E_WithBitwiseOr01.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_WithBitwiseOr01.fsx"|])>]
let ``E_WithBitwiseOr01_fsx`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
]
// SOURCE=MarshalAsAttribute.fs # MarshalAsAttribute.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"MarshalAsAttribute.fs"|])>]
let ``MarshalAsAttribute_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=RequiresExplicitTypeArguments01.fs # RequiresExplicitTypeArguments01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"RequiresExplicitTypeArguments01.fs"|])>]
let ``RequiresExplicitTypeArguments01_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=RequiresExplicitTypeArguments02.fs # RequiresExplicitTypeArguments02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"RequiresExplicitTypeArguments02.fs"|])>]
let ``RequiresExplicitTypeArguments02_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=W_AssemblyVersion01.fs SCFLAGS="--test:ErrorRanges" # W_AssemblyVersion01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"W_AssemblyVersion01.fs"|])>]
let ``W_AssemblyVersion01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
]
// SOURCE=W_AssemblyVersion02.fs SCFLAGS="--test:ErrorRanges" # W_AssemblyVersion02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"W_AssemblyVersion02.fs"|])>]
let ``W_AssemblyVersion02_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
]
// SOURCE=WithBitwiseOr02a.fsx SCFLAGS=-a # WithBitwiseOr02a.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"WithBitwiseOr02a.fsx"|])>]
let ``WithBitwiseOr02a_fsx`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=WithBitwiseOr02b.fsx SCFLAGS=-a # WithBitwiseOr02b.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"WithBitwiseOr02b.fsx"|])>]
let ``WithBitwiseOr02b_fsx`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=X_AssemblyVersion01.fs SCFLAGS="--test:ErrorRanges" # X_AssemblyVersion01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"X_AssemblyVersion01.fs"|])>]
let ``X_AssemblyVersion01_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=X_AssemblyVersion02.fs SCFLAGS="--test:ErrorRanges" # X_AssemblyVersion02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"X_AssemblyVersion02.fs"|])>]
let ``X_AssemblyVersion02_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace FSharp.Compiler.ComponentTests.Conformance.DeclarationElements.CustomAttributes
open Xunit
open FSharp.Test
open FSharp.Test.Compiler
module ArgumentsOfAllTypes =
let csLibraryWithAttributes =
CSharpFromPath (__SOURCE_DIRECTORY__ ++ "CSLibraryWithAttributes.cs")
|> withName "CSLibraryWithAttributes"
let verifyCompile compilation =
compilation
|> asLibrary
|> withReferences [csLibraryWithAttributes]
|> compile
let verifyCompileAndRun compilation =
compilation
|> asExe
|> withOptions ["--nowarn:988"]
|> withReferences [csLibraryWithAttributes]
|> compileAndRun
// SOURCE=System_Int16_Consumer.fsx SCFLAGS="-r CSLibraryWithAttributes.dll -r System_Int16.dll" # System_Int16_Consumer.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"System_Int16_Consumer.fsx"|])>]
let ``System_Int16_Consumer_fsx`` compilation =
let fslib =
FsFromPath (__SOURCE_DIRECTORY__ ++ "System_Int16.fsx")
|> asLibrary
|> withReferences [csLibraryWithAttributes]
compilation
|> withReferences [fslib]
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=System_Int32_Consumer.fsx SCFLAGS="-r CSLibraryWithAttributes.dll -r System_Int32.dll" # System_Int32_Consumer.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"System_Int32_Consumer.fsx"|])>]
let ``System_Int32_Consumer_fsx`` compilation =
let fslib =
FsFromPath (__SOURCE_DIRECTORY__ ++ "System_Int32.fsx")
|> asLibrary
|> withReferences [csLibraryWithAttributes]
compilation
|> withReferences [fslib]
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=System_Int64_Consumer.fsx SCFLAGS="-r CSLibraryWithAttributes.dll -r System_Int64.dll" # System_Int64_Consumer.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"System_Int64_Consumer.fsx"|])>]
let ``System_Int64_Consumer_fsx`` compilation =
let fslib =
FsFromPath (__SOURCE_DIRECTORY__ ++ "System_Int64.fsx")
|> asLibrary
|> withReferences [csLibraryWithAttributes]
compilation
|> withReferences [fslib]
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=System_UInt16_Consumer.fsx SCFLAGS="-r CSLibraryWithAttributes.dll -r System_UInt16.dll" # System_UInt16_Consumer.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"System_UInt16_Consumer.fsx"|])>]
let ``System_UInt16_Consumer_fsx`` compilation =
let fslib =
FsFromPath (__SOURCE_DIRECTORY__ ++ "System_UInt16.fsx")
|> asLibrary
|> withReferences [csLibraryWithAttributes]
compilation
|> withReferences [fslib]
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=System_UInt32_Consumer.fsx SCFLAGS="-r CSLibraryWithAttributes.dll -r System_UInt32.dll" # System_UInt32_Consumer.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"System_UInt32_Consumer.fsx"|])>]
let ``System_UInt32_Consumer_fsx`` compilation =
let fslib =
FsFromPath (__SOURCE_DIRECTORY__ ++ "System_UInt32.fsx")
|> asLibrary
|> withReferences [csLibraryWithAttributes]
compilation
|> withReferences [fslib]
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=System_UInt64_Consumer.fsx SCFLAGS="-r CSLibraryWithAttributes.dll -r System_UInt64.dll" # System_UInt64_Consumer.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"System_UInt64_Consumer.fsx"|])>]
let ``System_UInt64_Consumer_fsx`` compilation =
let fslib =
FsFromPath (__SOURCE_DIRECTORY__ ++ "System_UInt64.fsx")
|> asLibrary
|> withReferences [csLibraryWithAttributes]
compilation
|> withReferences [fslib]
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=System_Char_Consumer.fsx SCFLAGS="-r CSLibraryWithAttributes.dll -r System_Char.dll" # System_Char_Consumer.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"System_Char_Consumer.fsx"|])>]
let ``System_Char_Consumer_fsx`` compilation =
let fslib =
FsFromPath (__SOURCE_DIRECTORY__ ++ "System_Char.fsx")
|> asLibrary
|> withReferences [csLibraryWithAttributes]
compilation
|> withReferences [fslib]
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=System_Byte_Consumer.fsx SCFLAGS="-r CSLibraryWithAttributes.dll -r System_Byte.dll" # System_Byte_Consumer.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"System_Byte_Consumer.fsx"|])>]
let ``System_Byte_Consumer_fsx`` compilation =
let fslib =
FsFromPath (__SOURCE_DIRECTORY__ ++ "System_Byte.fsx")
|> asLibrary
|> withReferences [csLibraryWithAttributes]
compilation
|> withReferences [fslib]
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=System_SByte_Consumer.fsx SCFLAGS="-r CSLibraryWithAttributes.dll -r System_SByte.dll" # System_SByte_Consumer.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"System_SByte_Consumer.fsx"|])>]
let ``System_SByte_Consumer_fsx`` compilation =
let fslib =
FsFromPath (__SOURCE_DIRECTORY__ ++ "System_SByte.fsx")
|> asLibrary
|> withReferences [csLibraryWithAttributes]
compilation
|> withReferences [fslib]
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=System_Single_Consumer.fsx SCFLAGS="-r CSLibraryWithAttributes.dll -r System_Single.dll" # System_Single_Consumer.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"System_Single_Consumer.fsx"|])>]
let ``System_Single_Consumer_fsx`` compilation =
let fslib =
FsFromPath (__SOURCE_DIRECTORY__ ++ "System_Single.fsx")
|> asLibrary
|> withReferences [csLibraryWithAttributes]
compilation
|> withReferences [fslib]
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=System_Double_Consumer.fsx SCFLAGS="-r CSLibraryWithAttributes.dll -r System_Double.dll" # System_Double_Consumer.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"System_Double_Consumer.fsx"|])>]
let ``System_Double_Consumer_fsx`` compilation =
let fslib =
FsFromPath (__SOURCE_DIRECTORY__ ++ "System_Double.fsx")
|> asLibrary
|> withReferences [csLibraryWithAttributes]
compilation
|> withReferences [fslib]
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=System_String_Consumer.fsx SCFLAGS="-r CSLibraryWithAttributes.dll -r System_String.dll" # System_String_Consumer.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"System_String_Consumer.fsx"|])>]
let ``System_String_Consumer_fsx`` compilation =
let fslib =
FsFromPath (__SOURCE_DIRECTORY__ ++ "System_String.fsx")
|> asLibrary
|> withReferences [csLibraryWithAttributes]
compilation
|> withReferences [fslib]
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=System_DateTimeKind_Consumer.fsx SCFLAGS="-r CSLibraryWithAttributes.dll -r System_DateTimeKind.dll" # System_DateTimeKind_Consumer.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"System_DateTimeKind_Consumer.fsx"|])>]
let ``System_DateTimeKind_Consumer_fsx`` compilation =
let fslib =
FsFromPath (__SOURCE_DIRECTORY__ ++ "System_DateTimeKind.fsx")
|> asLibrary
|> withReferences [csLibraryWithAttributes]
compilation
|> withReferences [fslib]
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=System_Type_Consumer.fsx SCFLAGS="-r CSLibraryWithAttributes.dll -r System_Type.dll" # System_Type_Consumer.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"System_Type_Consumer.fsx"|])>]
let ``System_Type_Consumer_fsx`` compilation =
let fslib =
FsFromPath (__SOURCE_DIRECTORY__ ++ "System_Type.fsx")
|> asLibrary
|> withReferences [csLibraryWithAttributes]
compilation
|> withReferences [fslib]
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=System_Object_Consumer.fsx SCFLAGS="-r CSLibraryWithAttributes.dll -r System_Object.dll" # System_Object_Consumer.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"System_Object_Consumer.fsx"|])>]
let ``System_Object_Consumer_fsx`` compilation =
let fslib =
FsFromPath (__SOURCE_DIRECTORY__ ++ "System_Object.fsx")
|> asLibrary
|> withReferences [csLibraryWithAttributes]
compilation
|> withReferences [fslib]
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=System_TypeArray_Consumer.fsx SCFLAGS="-r CSLibraryWithAttributes.dll -r System_TypeArray.dll" # System_TypeArray_Consumer.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"System_TypeArray_Consumer.fsx"|])>]
let ``System_TypeArray_Consumer_fsx`` compilation =
let fslib =
FsFromPath (__SOURCE_DIRECTORY__ ++ "System_TypeArray.fsx")
|> asLibrary
|> withReferences [csLibraryWithAttributes]
compilation
|> withReferences [fslib]
|> verifyCompileAndRun
|> shouldSucceed
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace FSharp.Compiler.ComponentTests.Conformance.Conformance.DeclarationElements.CustomAttributes
open Xunit
open FSharp.Test
open FSharp.Test.Compiler
module AttributeInheritance =
let verifyCompile compilation =
compilation
|> asLibrary
|> withOptions ["--nowarn:988"]
|> compile
let verifyCompileAndRun compilation =
compilation
|> asLibrary
|> withOptions ["--nowarn:988"]
|> compileAndRun
// SOURCE=InheritedAttribute_001.fs SCFLAGS="--target:library --warnaserror:3242" # InheritedAttribute_001.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"InheritedAttribute_001.fs"|])>]
let ``InheritedAttribute_001_fs`` compilation =
compilation
|> withOptions ["--nowarn:3242"]
|> verifyCompile
|> shouldSucceed
// SOURCE=InheritedAttribute_002.fs SCFLAGS="--target:library" # InheritedAttribute_002.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"InheritedAttribute_002.fs"|])>]
let ``InheritedAttribute_002_fs`` compilation =
compilation
|> withOptions ["--nowarn:3242"]
|> verifyCompile
|> shouldSucceed
......@@ -7,4 +7,4 @@ do
let asm = System.Reflection.Assembly.GetExecutingAssembly().GetName()
exit <| if (asm.Version.ToString() = "1.1.9365.33000") then 0 else 1
\ No newline at end of file
if (asm.Version.ToString() = "1.1.9365.33000") then () else failwith "Failed: 1"
\ No newline at end of file
......@@ -6,4 +6,4 @@ do
let asm = System.Reflection.Assembly.GetExecutingAssembly().GetName()
printfn "%s" <| asm.Version.ToString()
exit <| if (asm.Version.ToString() = "1.2.3.0") then 0 else 1
\ No newline at end of file
if (asm.Version.ToString() = "1.2.3.0") then () else failwith "Failed: 1"
\ No newline at end of file
......@@ -17,4 +17,4 @@ let success =
asm.Version.Minor = 2 &&
asm.Version.Build = (int defaultBuild) && // default value is days since Jan 1 2000. Should match exactly.
(abs (asm.Version.Revision - (int defaultRevision))) < 10 // default value is seconds in the current day / 2. Check if within 10 sec of that.
exit <| if success then 0 else 1
\ No newline at end of file
if success then () else failwith "Failed: 1"
......@@ -15,4 +15,4 @@ let success =
asm.Version.Minor = 2 &&
asm.Version.Build = 3 &&
(abs (asm.Version.Revision - (int defaultRevision))) < 10 // default value is seconds in the current day / 2. Check if within 10 sec of that.
exit <| if success then 0 else 1
\ No newline at end of file
if success then () else failwith "Failed: 1"
\ No newline at end of file
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace FSharp.Compiler.ComponentTests.Conformance.Conformance.DeclarationElements.CustomAttributes
open Xunit
open FSharp.Test
open FSharp.Test.Compiler
module AttributeUsage =
let verifyCompile compilation =
compilation
|> asExe
|> withOptions ["--nowarn:988"]
|> compile
let verifyCompileAndRun compilation =
compilation
|> asExe
|> withOptions ["--nowarn:988"]
|> compileAndRun
// SOURCE=AssemblyVersion01.fs # AssemblyVersion01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AssemblyVersion01.fs"|])>]
let ``AssemblyVersion01_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=AssemblyVersion02.fs # AssemblyVersion02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AssemblyVersion02.fs"|])>]
let ``AssemblyVersion02_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=AssemblyVersion03.fs # AssemblyVersion03.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AssemblyVersion03.fs"|])>]
let ``AssemblyVersion03_fs`` compilation =
compilation
|> withOptions ["--nowarn:52"]
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=AssemblyVersion04.fs # AssemblyVersion04.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AssemblyVersion04.fs"|])>]
let ``AssemblyVersion04_fs`` compilation =
compilation
|> withOptions ["--nowarn:52"]
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=AttributeTargetsIsCtor01.fs # AttributeTargetsIsCtor01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AttributeTargetsIsCtor01.fs"|])>]
let ``AttributeTargetsIsCtor01_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=AttributeTargetsIsMethod01.fs # AttributeTargetsIsMethod01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AttributeTargetsIsMethod01.fs"|])>]
let ``AttributeTargetsIsMethod01_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=ConditionalAttribute.fs # ConditionalAttribute.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"ConditionalAttribute.fs"|])>]
let ``ConditionalAttribute_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=E_AttributeTargets01.fs # E_AttributeTargets01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargets01.fs"|])>]
let ``E_AttributeTargets01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 842, Line 21, Col 21, Line 21, Col 22, "This attribute is not valid for use on this language element")
(Error 842, Line 24, Col 28, Line 24, Col 29, "This attribute is not valid for use on this language element")
(Error 842, Line 27, Col 15, Line 27, Col 16, "This attribute is not valid for use on this language element")
]
// SOURCE=E_AttributeTargets02.fs # E_AttributeTargets02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargets02.fs"|])>]
let ``E_AttributeTargets02_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 842, Line 14, Col 17, Line 14, Col 34, "This attribute is not valid for use on this language element")
(Error 842, Line 24, Col 14, Line 24, Col 29, "This attribute is not valid for use on this language element")
(Error 842, Line 29, Col 25, Line 29, Col 40, "This attribute is not valid for use on this language element")
]
// SOURCE=E_ConditionalAttribute.fs SCFLAGS="--test:ErrorRanges" # E_ConditionalAttribute.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_ConditionalAttribute.fs"|])>]
let ``E_ConditionalAttribute_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 1213, Line 10, Col 6, Line 10, Col 9, "Attribute 'System.Diagnostics.ConditionalAttribute' is only valid on methods or attribute classes")
]
// SOURCE=E_RequiresExplicitTypeArguments01.fs SCFLAGS="--test:ErrorRanges" # E_RequiresExplicitTypeArguments01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_RequiresExplicitTypeArguments01.fs"|])>]
let ``E_RequiresExplicitTypeArguments01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 685, Line 14, Col 1, Line 14, Col 6, "The generic function 'Foo' must be given explicit type argument(s)")
(Error 685, Line 26, Col 1, Line 26, Col 6, "The generic function 'Foo' must be given explicit type argument(s)")
(Error 685, Line 28, Col 1, Line 28, Col 6, "The generic function 'Foo' must be given explicit type argument(s)")
]
// SOURCE=E_RequiresExplicitTypeArguments02.fs SCFLAGS="--test:ErrorRanges" # E_RequiresExplicitTypeArguments02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_RequiresExplicitTypeArguments02.fs"|])>]
let ``E_RequiresExplicitTypeArguments02_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 685, Line 20, Col 5, Line 20, Col 10, "The generic function 'Foo' must be given explicit type argument(s)")
]
// # SOURCE=E_WithBitwiseAnd01.fsx SCFLAGS="--test:ErrorRanges -a" # E_WithBitwiseAnd01.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_WithBitwiseAnd01.fsx"|])>]
let ``E_WithBitwiseAnd01_fsx`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 267, Line 7, Col 25, Line 7, Col 91, "This is not a valid constant expression or custom attribute value")
(Warning 839, Line 12, Col 3, Line 12, Col 6, "Unexpected condition in imported assembly: failed to decode AttributeUsage attribute")
]
// SOURCE=E_WithBitwiseOr01.fsx SCFLAGS="--test:ErrorRanges -a" # E_WithBitwiseOr01.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_WithBitwiseOr01.fsx"|])>]
let ``E_WithBitwiseOr01_fsx`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 842, Line 12, Col 3, Line 12, Col 6, "This attribute is not valid for use on this language element")
]
// SOURCE=MarshalAsAttribute.fs # MarshalAsAttribute.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"MarshalAsAttribute.fs"|])>]
let ``MarshalAsAttribute_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=RequiresExplicitTypeArguments01.fs # RequiresExplicitTypeArguments01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"RequiresExplicitTypeArguments01.fs"|])>]
let ``RequiresExplicitTypeArguments01_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=RequiresExplicitTypeArguments02.fs # RequiresExplicitTypeArguments02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"RequiresExplicitTypeArguments02.fs"|])>]
let ``RequiresExplicitTypeArguments02_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=W_AssemblyVersion01.fs SCFLAGS="--test:ErrorRanges" # W_AssemblyVersion01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"W_AssemblyVersion01.fs"|])>]
let ``W_AssemblyVersion01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Warning 2003, Line 4, Col 46, Line 4, Col 59, "The attribute System.Reflection.AssemblyVersionAttribute specified version '1.2.3.4.5.6', but this value is invalid and has been ignored")
]
// SOURCE=W_AssemblyVersion02.fs SCFLAGS="--test:ErrorRanges" # W_AssemblyVersion02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"W_AssemblyVersion02.fs"|])>]
let ``W_AssemblyVersion02_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Warning 2003, Line 4, Col 46, Line 4, Col 55, "The attribute System.Reflection.AssemblyVersionAttribute specified version '1.2.*.4', but this value is invalid and has been ignored")
]
// SOURCE=WithBitwiseOr02a.fsx SCFLAGS=-a # WithBitwiseOr02a.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"WithBitwiseOr02a.fsx"|])>]
let ``WithBitwiseOr02a_fsx`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=WithBitwiseOr02b.fsx SCFLAGS=-a # WithBitwiseOr02b.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"WithBitwiseOr02b.fsx"|])>]
let ``WithBitwiseOr02b_fsx`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=X_AssemblyVersion01.fs SCFLAGS="--test:ErrorRanges" # X_AssemblyVersion01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"X_AssemblyVersion01.fs"|])>]
let ``X_AssemblyVersion01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Warning 2003, Line 5, Col 50, Line 5, Col 61, "The attribute System.Reflection.AssemblyFileVersionAttribute specified version '9.8.7.6.5', but this value is invalid and has been ignored")
]
// SOURCE=X_AssemblyVersion02.fs SCFLAGS="--test:ErrorRanges" # X_AssemblyVersion02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"X_AssemblyVersion02.fs"|])>]
let ``X_AssemblyVersion02_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Warning 2003, Line 5, Col 59, Line 5, Col 68, "The attribute System.Reflection.AssemblyFileVersionAttribute specified version '9.8.*.6', but this value is invalid and has been ignored")
]
......@@ -35,7 +35,7 @@ module Program =
let size = Marshal.SizeOf(err)
let expectedsize = if System.IntPtr.Size = 4 then 536 else 544
if (size = expectedsize) then
exit 0
else
printfn "Error: expected size (%A) <> actual size (%A)" expectedsize size
exit 1
0
else
printfn "Error: expected size (%A) <> actual size (%A)" expectedsize size
failwith "Failed: 1"
......@@ -8,9 +8,9 @@ type A() =
member x.Foo<'a>(y:'a, ?z:int) = "second"
let a = new A()
if a.Foo<int>(42) <> "first" then exit 1
if a.Foo(42, 0) <> "second" then exit 1
if a.Foo<int>(42, 0) <> "second" then exit 1
if a.Foo<int>(42) <> "first" then failwith "Failed: 1"
if a.Foo(42, 0) <> "second" then failwith "Failed: 2"
if a.Foo<int>(42, 0) <> "second" then failwith "Failed: 3"
type B() =
[<RequiresExplicitTypeArgumentsAttribute>]
......@@ -19,7 +19,5 @@ type B() =
member x.Foo<'a>(y:'a, ?z:int) = "second"
let b = new B()
if b.Foo<int>(42) <> "first" then exit 1
if b.Foo<int>(42, 0) <> "second" then exit 1
exit 0
if b.Foo<int>(42) <> "first" then failwith "Failed: 4"
if b.Foo<int>(42, 0) <> "second" then failwith "Failed: 5"
......@@ -19,4 +19,4 @@ type E() =
let f (x : #D) =
x.Foo<int>(42) + x.Foo(42, 1)
exit <| if f (E()) <> "thirdother" then 1 else 0
if f (E()) <> "thirdother" then failwith "Failed: 1" else ()
\ No newline at end of file
......@@ -31,7 +31,7 @@ let runTest() =
let itsAttributes = testObj.GetType().GetCustomAttributes(false)
let attrib = itsAttributes |> Array.find (fun attrib -> match attrib with :? CustomAttribute -> true | _ -> false)
if (attrib :?> CustomAttribute).Value <> (EnumType.A ||| EnumType.C) then exit 1
if (attrib :?> CustomAttribute).Value <> (EnumType.A ||| EnumType.C) then failwith "Failed: 1"
do
let value =
......@@ -42,11 +42,9 @@ let runTest() =
)
match value with
| Some v when v = 10L -> ()
| _ -> exit 1
| _ -> failwith "Failed: 2"
true
// Actually run our test
if runTest() <> true then exit 1
exit 0
if runTest() <> true then failwith "Failed: 3"
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace FSharp.Compiler.ComponentTests.Conformance.Conformance.DeclarationElements.CustomAttributes
open Xunit
open FSharp.Test
open FSharp.Test.Compiler
module Basic =
let verifyCompile compilation =
compilation
|> asExe
|> withOptions ["--nowarn:988"]
|> compile
let verifyCompileAndRun compilation =
compilation
|> asExe
|> withOptions ["--nowarn:988"]
|> compileAndRun
// SOURCE=ArrayParam.fs # ArrayParam.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"ArrayParam.fs"|])>]
let ``ArrayParam_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=AttribWithEnumFlags01.fs # AttribWithEnumFlags01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AttribWithEnumFlags01.fs"|])>]
let ``AttribWithEnumFlags01_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=E_AttributeApplication01.fs # E_AttributeApplication01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeApplication01.fs"|])>]
let ``E_AttributeApplication01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 841, Line 7, Col 12, Line 7, Col 49, "This attribute is not valid for use on this language element. Assembly attributes should be attached to a 'do ()' declaration, if necessary within an F# module.")
]
// SOURCE=E_AttributeApplication02.fs SCFLAGS="--test:ErrorRanges" # E_AttributeApplication02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeApplication02.fs"|])>]
let ``E_AttributeApplication02_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 429, Line 6, Col 15, Line 6, Col 22, "The attribute type 'MeasureAttribute' has 'AllowMultiple=false'. Multiple instances of this attribute cannot be attached to a single language element.")
]
// SOURCE=E_AttributeApplication03.fs SCFLAGS="--test:ErrorRanges" # E_AttributeApplication03.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeApplication03.fs"|])>]
let ``E_AttributeApplication03_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 842, Line 15, Col 7, Line 15, Col 17, "This attribute is not valid for use on this language element")
]
// SOURCE=E_AttributeApplication04.fs SCFLAGS="--test:ErrorRanges" # E_AttributeApplication04.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeApplication04.fs"|])>]
let ``E_AttributeApplication04_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 842, Line 14, Col 3, Line 14, Col 13, "This attribute is not valid for use on this language element")
]
// SOURCE=E_AttributeApplication05.fs SCFLAGS="--test:ErrorRanges" # E_AttributeApplication05.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeApplication05.fs"|])>]
let ``E_AttributeApplication05_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 842, Line 8, Col 7, Line 8, Col 8, "This attribute is not valid for use on this language element")
(Warning 20, Line 8, Col 1, Line 8, Col 31, "The result of this expression has type 'int' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.")
]
// SOURCE=E_AttributeApplication06.fs SCFLAGS="--test:ErrorRanges" # E_AttributeApplication06.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeApplication06.fs"|])>]
let ``E_AttributeApplication06_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 824, Line 8, Col 5, Line 8, Col 20, "Attributes are not permitted on 'let' bindings in expressions")
(Warning 20, Line 8, Col 1, Line 8, Col 41, "The result of this expression has type 'int' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.")
]
// SOURCE=E_AttributeApplication07.fs # E_AttributeApplication07.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeApplication07.fs"|])>]
let ``E_AttributeApplication07_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 1, Line 10, Col 3, Line 10, Col 59, "This expression was expected to have type\n 'int[]' \nbut here has type\n 'unit' ")
(Error 267, Line 10, Col 3, Line 10, Col 59, "This is not a valid constant expression or custom attribute value")
(Error 850, Line 10, Col 3, Line 10, Col 59, "This attribute cannot be used in this version of F#")
(Error 850, Line 13, Col 3, Line 13, Col 52, "This attribute cannot be used in this version of F#")
(Error 850, Line 16, Col 13, Line 16, Col 37, "This attribute cannot be used in this version of F#")
]
// SOURCE=E_AttributeTargetSpecifications.fs # E_AttributeTargetSpecifications.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetSpecifications.fs"|])>]
let ``E_AttributeTargetSpecifications_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 840, Line 9, Col 3, Line 9, Col 34, "Unrecognized attribute target. Valid attribute targets are 'assembly', 'module', 'type', 'method', 'property', 'return', 'param', 'field', 'event', 'constructor'.")
]
// SOURCE=E_StructLayout.fs SCFLAGS="-a --test:ErrorRanges --flaterrors --nowarn:9" # E_StructLayout.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_StructLayout.fs"|])>]
let ``E_StructLayout_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Warning 9, Line 14, Col 6, Line 14, Col 21, "Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn \"9\"'.")
(Error 1206, Line 12, Col 1, Line 13, Col 1, "The type 'SExplicitBroken' has been marked as having an Explicit layout, but the field 'v2' has not been marked with the 'FieldOffset' attribute")
(Error 1211, Line 22, Col 1, Line 23, Col 1, "The FieldOffset attribute can only be placed on members of types marked with the StructLayout(LayoutKind.Explicit)")
]
// SOURCE=E_StructLayoutSequentialNeg_AbstractClass.fs SCFLAGS="--test:ErrorRanges" # E_StructLayoutSequentialNeg_AbstractClass.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_StructLayoutSequentialNeg_AbstractClass.fs"|])>]
let ``E_StructLayoutSequentialNeg_AbstractClass_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 937, Line 9, Col 10, Line 9, Col 12, "Only structs and classes without primary constructors may be given the 'StructLayout' attribute")
]
// SOURCE=E_StructLayoutSequentialNeg_DU1.fs SCFLAGS="--test:ErrorRanges" # E_StructLayoutSequentialNeg_DU1.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_StructLayoutSequentialNeg_DU1.fs"|])>]
let ``E_StructLayoutSequentialNeg_DU1_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 937, Line 9, Col 10, Line 9, Col 12, "Only structs and classes without primary constructors may be given the 'StructLayout' attribute")
]
// SOURCE=E_StructLayoutSequentialNeg_DU2.fs SCFLAGS="--test:ErrorRanges" # E_StructLayoutSequentialNeg_DU2.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_StructLayoutSequentialNeg_DU2.fs"|])>]
let ``E_StructLayoutSequentialNeg_DU2_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 937, Line 9, Col 10, Line 9, Col 12, "Only structs and classes without primary constructors may be given the 'StructLayout' attribute")
]
// SOURCE=E_StructLayoutSequentialNeg_Delegate.fs SCFLAGS="--test:ErrorRanges" # E_StructLayoutSequentialNeg_Delegate.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_StructLayoutSequentialNeg_Delegate.fs"|])>]
let ``E_StructLayoutSequentialNeg_Delegate_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 937, Line 9, Col 10, Line 9, Col 12, "Only structs and classes without primary constructors may be given the 'StructLayout' attribute")
]
// SOURCE=E_StructLayoutSequentialNeg_Interface.fs SCFLAGS="--test:ErrorRanges" # E_StructLayoutSequentialNeg_Interface.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_StructLayoutSequentialNeg_Interface.fs"|])>]
let ``E_StructLayoutSequentialNeg_Interface_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 937, Line 8, Col 10, Line 8, Col 12, "Only structs and classes without primary constructors may be given the 'StructLayout' attribute")
]
// SOURCE=E_UseNullAsTrueValue01.fs SCFLAGS="--test:ErrorRanges" # E_UseNullAsTrueValue01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_UseNullAsTrueValue01.fs"|])>]
let ``E_UseNullAsTrueValue01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 1196, Line 15, Col 6, Line 15, Col 13, "The 'UseNullAsTrueValue' attribute flag may only be used with union types that have one nullary case and at least one non-nullary case")
(Error 1196, Line 22, Col 6, Line 22, Col 14, "The 'UseNullAsTrueValue' attribute flag may only be used with union types that have one nullary case and at least one non-nullary case")
(Error 1196, Line 28, Col 6, Line 28, Col 14, "The 'UseNullAsTrueValue' attribute flag may only be used with union types that have one nullary case and at least one non-nullary case")
(Error 1196, Line 33, Col 6, Line 33, Col 15, "The 'UseNullAsTrueValue' attribute flag may only be used with union types that have one nullary case and at least one non-nullary case")
(Error 1196, Line 37, Col 6, Line 37, Col 14, "The 'UseNullAsTrueValue' attribute flag may only be used with union types that have one nullary case and at least one non-nullary case")
(Error 1196, Line 44, Col 6, Line 44, Col 18, "The 'UseNullAsTrueValue' attribute flag may only be used with union types that have one nullary case and at least one non-nullary case")
(Error 1196, Line 51, Col 6, Line 51, Col 15, "The 'UseNullAsTrueValue' attribute flag may only be used with union types that have one nullary case and at least one non-nullary case")
]
// SOURCE=FreeTypeVariable01.fs # FreeTypeVariable01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"FreeTypeVariable01.fs"|])>]
let ``FreeTypeVariable01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Warning 64, Line 14, Col 81, Line 14, Col 83, "This construct causes code to be less generic than indicated by the type annotations. The type variable 'a has been constrained to be type 'obj'.")
]
// SOURCE=Function01.fs # Function01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Function01.fs"|])>]
let ``Function01_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=FunctionArg01.fs # FunctionArg01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"FunctionArg01.fs"|])>]
let ``FunctionArg01_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=InExternDecl.fs SCFLAGS="-a --warnaserror+" # InExternDecl.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"InExternDecl.fs"|])>]
let ``InExternDecl_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=ParamArrayAttrUsage.fs # ParamArrayAttrUsage.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"ParamArrayAttrUsage.fs"|])>]
let ``ParamArrayAttrUsage_fs`` compilation =
compilation
|> asFsx
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=ReturnType01.fs # ReturnType01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"ReturnType01.fs"|])>]
let ``ReturnType01_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=ReturnType02.fs # ReturnType02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"ReturnType02.fs"|])>]
let ``ReturnType02_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=ReturnType03.fs # ReturnType03.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"ReturnType03.fs"|])>]
let ``ReturnType03_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=SanityCheck01.fs # SanityCheck01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"SanityCheck01.fs"|])>]
let ``SanityCheck01_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=StructLayout.fs SCFLAGS="-a --nowarn:9 --warnaserror" # StructLayout.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"StructLayout.fs"|])>]
let ``StructLayout_fs`` compilation =
compilation
|> asLibrary
|> withOptions ["--nowarn:988"]
|> compile
|> shouldFail
|> withDiagnostics [
(Warning 9, Line 19, Col 6, Line 19, Col 15, "Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn \"9\"'.")
]
// SOURCE=StructLayoutSequentialPos_Exception.fs # StructLayoutSequentialPos_Exception.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"StructLayoutSequentialPos_Exception.fs"|])>]
let ``StructLayoutSequentialPos_Exception_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=TypeofTypedefofInAttribute.fs # TypeofTypedefofInAttribute.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"TypeofTypedefofInAttribute.fs"|])>]
let ``TypeofTypedefofInAttribute_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=TypesAsAttrArgs01.fs # TypesAsAttrArgs01
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"TypesAsAttrArgs01.fs"|])>]
let ``TypesAsAttrArgs01_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=W_ReturnType03b.fs SCFLAGS="--test:ErrorRanges" # W_ReturnType03b.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"W_ReturnType03b.fs"|])>]
let ``W_ReturnType03b_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 429, Line 16, Col 28, Line 16, Col 31, "The attribute type 'CA1' has 'AllowMultiple=false'. Multiple instances of this attribute cannot be attached to a single language element.")
]
// SOURCE=W_StructLayoutExplicit01.fs SCFLAGS="--test:ErrorRanges" PEVER="/Exp_Fail" # W_StructLayoutExplicit01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"W_StructLayoutExplicit01.fs"|])>]
let ``W_StructLayoutExplicit01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Warning 9, Line 12, Col 6, Line 12, Col 7, "Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn \"9\"'.")
]
// SOURCE=W_StructLayoutSequentialPos_AbstractClass.fs SCFLAGS="--test:ErrorRanges --warnaserror+" # W_StructLayoutSequentialPos_AbstractClass.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"W_StructLayoutSequentialPos_AbstractClass.fs"|])>]
let ``W_StructLayoutSequentialPos_AbstractClass_fs`` compilation =
compilation
|> verifyCompile
|> shouldSucceed
// SOURCE=W_StructLayoutSequentialPos_ClassnoCtr.fs SCFLAGS="--test:ErrorRanges --warnaserror+" # W_StructLayoutSequentialPos_ClassnoCtr.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"W_StructLayoutSequentialPos_ClassnoCtr.fs"|])>]
let ``W_StructLayoutSequentialPos_ClassnoCtr_fs`` compilation =
compilation
|> verifyCompile
|> shouldSucceed
// SOURCE=W_StructLayoutSequentialPos_Record.fs SCFLAGS="--test:ErrorRanges --warnaserror+" # W_StructLayoutSequentialPos_Record.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"W_StructLayoutSequentialPos_Record.fs"|])>]
let ``W_StructLayoutSequentialPos_Record_fs`` compilation =
compilation
|> verifyCompile
|> shouldSucceed
......@@ -7,7 +7,3 @@ module NegativeTests =
[<System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)>]
type N4 = R1 = 1 | R2 = 2
exit 0
......@@ -7,7 +7,3 @@ module NegativeTests =
[<System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)>]
type N5 = delegate of int -> int
exit 0
......@@ -7,5 +7,3 @@ module NegativeTests =
[<System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)>]
type N1 =
abstract M : unit -> 'a
exit 0
......@@ -29,5 +29,4 @@ let res = match (programType.GetMethod("foo").GetCustomAttributes(true).[0]) wit
| _ -> 1
// Final verification
res |> exit
if res <> 0 then failwith $"Failed: {res}"
......@@ -29,4 +29,4 @@ let res = match (programType.GetMethod("foo").GetParameters().[0].GetCustomAttri
| _ -> 1
// Final verification
res |> exit
if res <> 0 then failwith $"Failed: {res}"
......@@ -7,5 +7,3 @@ open System
String.Format("{0},{1},{2}","foo","bar","baz")
String.Format("{0},{1},{2},{3}","foo","bar","baz","womble")
System.String.Format("{0},{1},{2},{3}",[|box "foo";box "bar";box "baz";box "womble"|])
exit 0
......@@ -24,4 +24,4 @@ let programType = executingAssembly.GetType("ReturnType01")
let message = (programType.GetMethod("foo").ReturnParameter.GetCustomAttributes(true).[0] :?> TestAttribute).TestMessage
// Final verification
exit (if message = "Attribute on return type!" then 0 else 1)
if message = "Attribute on return type!" then () else failwith "Failed: 1"
......@@ -32,6 +32,3 @@ let programType = executingAssembly.GetType("ReturnType02")
// Get number of CAs
let count = programType.GetMethod("f").ReturnParameter.GetCustomAttributes(true)
// Final verification
//exit (if count = 2 then 0 else 1)
......@@ -26,6 +26,3 @@ let programType = executingAssembly.GetType("ReturnType03")
// Get number of CAs
let count = programType.GetMethod("f").ReturnParameter.GetCustomAttributes(true)
// Final verification
//exit (if count = 2 then 0 else 1)
......@@ -18,7 +18,5 @@ type SomeAttribute(string:string) =
[<SomeAttribute(null)>] // Null
type Bar() =
override this.ToString() = "Bar"
// Bug was related to compile-time errors
exit 0
......@@ -25,15 +25,14 @@ let runTest() =
let attrib = itsAttributes |> Array.find (fun attrib -> match attrib with :? CustomAttribute -> true | _ -> false)
let ca = attrib :?> CustomAttribute
if ca.TypeofResult <> typeof<list<int>> then exit 1
if ca.TypedefofResult <> typedefof<list<int>> then exit 1
if ca.TypeofResult <> typeof<list<int>> then failwith "Failed: 1"
if ca.TypedefofResult <> typedefof<list<int>> then failwith "Failed: 2"
// And verify typeof<_> <> typedefof<_>
if typeof<list<int>> = typedefof<list<int>> then exit 1
if typeof<list<int>> = typedefof<list<int>> then failwith "Failed: 3"
true
// Actually run our test
if runTest() <> true then exit 1
if runTest() <> true then failwith "Failed: 4"
exit 0
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册