提交 0aba41b4 编写于 作者: D Don Syme

Merge commit '363b72c4' into feature/ext

......@@ -8,9 +8,9 @@
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="7.0.0-beta.22213.2">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="7.0.0-beta.22214.3">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>4ec0b54a25d4e2129e8b34f60b4489e325421cb7</Sha>
<Sha>5ef2983363df5e0d85181b2948e2a5b0c16aa41a</Sha>
<SourceBuild RepoName="arcade" ManagedOnly="true" />
</Dependency>
</ToolsetDependencies>
......
......@@ -17,7 +17,7 @@
"perl": "5.32.1.1"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22213.2",
"Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22214.3",
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2"
}
}
......@@ -60,13 +60,16 @@ let TryResolveFileUsingPaths(paths, m, name) =
let () =
try FileSystem.IsPathRootedShim name |> ignore
with :? ArgumentException as e -> error(Error(FSComp.SR.buildProblemWithFilename(name, e.Message), m))
if FileSystem.IsPathRootedShim name && FileSystem.FileExistsShim name
then Some name
if FileSystem.IsPathRootedShim name then
if FileSystem.FileExistsShim name then
Some name
else
None
else
let res = paths |> List.tryPick (fun path ->
let n = Path.Combine (path, name)
if FileSystem.FileExistsShim n then Some n
else None)
let res = paths |> Seq.tryPick (fun path ->
let n = Path.Combine(path, name)
if FileSystem.FileExistsShim n then Some n
else None)
res
/// Will raise FileNameNotResolved if the filename was not found
......@@ -709,7 +712,8 @@ type TcConfigBuilder =
member tcConfigB.ResolveSourceFile(m, nm, pathLoadedFrom) =
use unwindBuildPhase = PushThreadBuildPhaseUntilUnwind BuildPhase.Parameter
ResolveFileUsingPaths(tcConfigB.includes @ [pathLoadedFrom], m, nm)
let paths = seq { yield! tcConfigB.includes; yield pathLoadedFrom }
ResolveFileUsingPaths(paths, m, nm)
/// Decide names of output file, pdb and assembly
member tcConfigB.DecideNames sourceFiles =
......@@ -786,7 +790,8 @@ type TcConfigBuilder =
warning(Error(FSComp.SR.buildInvalidFilename originalPath, m))
else
let path =
match TryResolveFileUsingPaths(tcConfigB.includes @ [pathLoadedFrom], m, originalPath) with
let paths = seq { yield! tcConfigB.includes; yield pathLoadedFrom }
match TryResolveFileUsingPaths(paths, m, originalPath) with
| Some path -> path
| None ->
// File doesn't exist in the paths. Assume it will be in the load-ed from directory.
......@@ -934,6 +939,86 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
#endif
None, data.legacyReferenceResolver.Impl.HighestInstalledNetFrameworkVersion()
let makePathAbsolute path =
ComputeMakePathAbsolute data.implicitIncludeDir path
let targetFrameworkDirectories =
try
[
// Check if we are given an explicit framework root - if so, use that
match clrRootValue with
| Some x ->
let clrRoot = makePathAbsolute x
yield clrRoot
let clrFacades = Path.Combine(clrRoot, "Facades")
if FileSystem.DirectoryExistsShim(clrFacades) then yield clrFacades
| None ->
// "there is no really good notion of runtime directory on .NETCore"
#if NETSTANDARD
let runtimeRoot = Path.GetDirectoryName(typeof<Object>.Assembly.Location)
#else
let runtimeRoot = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory()
#endif
let runtimeRootWithoutSlash = runtimeRoot.TrimEnd('/', '\\')
let runtimeRootFacades = Path.Combine(runtimeRootWithoutSlash, "Facades")
let runtimeRootWPF = Path.Combine(runtimeRootWithoutSlash, "WPF")
match data.resolutionEnvironment with
| LegacyResolutionEnvironment.CompilationAndEvaluation ->
// Default compilation-and-execution-time references on .NET Framework and Mono, e.g. for F# Interactive
//
// In the current way of doing things, F# Interactive refers to implementation assemblies.
yield runtimeRoot
if FileSystem.DirectoryExistsShim runtimeRootFacades then
yield runtimeRootFacades // System.Runtime.dll is in /usr/lib/mono/4.5/Facades
if FileSystem.DirectoryExistsShim runtimeRootWPF then
yield runtimeRootWPF // PresentationCore.dll is in C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF
match data.FxResolver.GetFrameworkRefsPackDirectory() with
| Some path when FileSystem.DirectoryExistsShim(path) ->
yield path
| _ -> ()
| LegacyResolutionEnvironment.EditingOrCompilation _ ->
#if ENABLE_MONO_SUPPORT
if runningOnMono then
// Default compilation-time references on Mono
//
// On Mono, the default references come from the implementation assemblies.
// This is because we have had trouble reliably using MSBuild APIs to compute DotNetFrameworkReferenceAssembliesRootDirectory on Mono.
yield runtimeRoot
if FileSystem.DirectoryExistsShim runtimeRootFacades then
yield runtimeRootFacades // System.Runtime.dll is in /usr/lib/mono/4.5/Facades
if FileSystem.DirectoryExistsShim runtimeRootWPF then
yield runtimeRootWPF // PresentationCore.dll is in C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF
// On Mono we also add a default reference to the 4.5-api and 4.5-api/Facades directories.
let runtimeRootApi = runtimeRootWithoutSlash + "-api"
let runtimeRootApiFacades = Path.Combine(runtimeRootApi, "Facades")
if FileSystem.DirectoryExistsShim runtimeRootApi then
yield runtimeRootApi
if FileSystem.DirectoryExistsShim runtimeRootApiFacades then
yield runtimeRootApiFacades
else
#endif
// Default compilation-time references on .NET Framework
//
// This is the normal case for "fsc.exe a.fs". We refer to the reference assemblies folder.
let frameworkRoot = data.legacyReferenceResolver.Impl.DotNetFrameworkReferenceAssembliesRootDirectory
let frameworkRootVersion = Path.Combine(frameworkRoot, targetFrameworkVersionValue)
yield frameworkRootVersion
let facades = Path.Combine(frameworkRootVersion, "Facades")
if FileSystem.DirectoryExistsShim facades then
yield facades
match data.FxResolver.GetFrameworkRefsPackDirectory() with
| Some path when FileSystem.DirectoryExistsShim(path) ->
yield path
| _ -> ()
]
with e ->
errorRecovery e range0; []
member _.fsiMultiAssemblyEmit = data.fsiMultiAssemblyEmit
member x.FxResolver = data.FxResolver
member x.primaryAssembly = data.primaryAssembly
......@@ -1079,81 +1164,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
// This call can fail if no CLR is found (this is the path to mscorlib)
member tcConfig.GetTargetFrameworkDirectories() =
use unwindBuildPhase = PushThreadBuildPhaseUntilUnwind BuildPhase.Parameter
try
[
// Check if we are given an explicit framework root - if so, use that
match tcConfig.clrRoot with
| Some x ->
let clrRoot = tcConfig.MakePathAbsolute x
yield clrRoot
let clrFacades = Path.Combine(clrRoot, "Facades")
if FileSystem.DirectoryExistsShim(clrFacades) then yield clrFacades
| None ->
// "there is no really good notion of runtime directory on .NETCore"
#if NETSTANDARD
let runtimeRoot = Path.GetDirectoryName(typeof<Object>.Assembly.Location)
#else
let runtimeRoot = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory()
#endif
let runtimeRootWithoutSlash = runtimeRoot.TrimEnd('/', '\\')
let runtimeRootFacades = Path.Combine(runtimeRootWithoutSlash, "Facades")
let runtimeRootWPF = Path.Combine(runtimeRootWithoutSlash, "WPF")
match tcConfig.resolutionEnvironment with
| LegacyResolutionEnvironment.CompilationAndEvaluation ->
// Default compilation-and-execution-time references on .NET Framework and Mono, e.g. for F# Interactive
//
// In the current way of doing things, F# Interactive refers to implementation assemblies.
yield runtimeRoot
if FileSystem.DirectoryExistsShim runtimeRootFacades then
yield runtimeRootFacades // System.Runtime.dll is in /usr/lib/mono/4.5/Facades
if FileSystem.DirectoryExistsShim runtimeRootWPF then
yield runtimeRootWPF // PresentationCore.dll is in C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF
match tcConfig.FxResolver.GetFrameworkRefsPackDirectory() with
| Some path when FileSystem.DirectoryExistsShim(path) ->
yield path
| _ -> ()
| LegacyResolutionEnvironment.EditingOrCompilation _ ->
#if ENABLE_MONO_SUPPORT
if runningOnMono then
// Default compilation-time references on Mono
//
// On Mono, the default references come from the implementation assemblies.
// This is because we have had trouble reliably using MSBuild APIs to compute DotNetFrameworkReferenceAssembliesRootDirectory on Mono.
yield runtimeRoot
if FileSystem.DirectoryExistsShim runtimeRootFacades then
yield runtimeRootFacades // System.Runtime.dll is in /usr/lib/mono/4.5/Facades
if FileSystem.DirectoryExistsShim runtimeRootWPF then
yield runtimeRootWPF // PresentationCore.dll is in C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF
// On Mono we also add a default reference to the 4.5-api and 4.5-api/Facades directories.
let runtimeRootApi = runtimeRootWithoutSlash + "-api"
let runtimeRootApiFacades = Path.Combine(runtimeRootApi, "Facades")
if FileSystem.DirectoryExistsShim runtimeRootApi then
yield runtimeRootApi
if FileSystem.DirectoryExistsShim runtimeRootApiFacades then
yield runtimeRootApiFacades
else
#endif
// Default compilation-time references on .NET Framework
//
// This is the normal case for "fsc.exe a.fs". We refer to the reference assemblies folder.
let frameworkRoot = tcConfig.legacyReferenceResolver.Impl.DotNetFrameworkReferenceAssembliesRootDirectory
let frameworkRootVersion = Path.Combine(frameworkRoot, tcConfig.targetFrameworkVersion)
yield frameworkRootVersion
let facades = Path.Combine(frameworkRootVersion, "Facades")
if FileSystem.DirectoryExistsShim facades then
yield facades
match tcConfig.FxResolver.GetFrameworkRefsPackDirectory() with
| Some path when FileSystem.DirectoryExistsShim(path) ->
yield path
| _ -> ()
]
with e ->
errorRecovery e range0; []
targetFrameworkDirectories
member tcConfig.ComputeLightSyntaxInitialStatus filename =
use unwindBuildPhase = PushThreadBuildPhaseUntilUnwind BuildPhase.Parameter
......@@ -1193,8 +1204,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
yield tcConfig.fsharpBinariesDir ]
member tcConfig.MakePathAbsolute path =
let result = ComputeMakePathAbsolute tcConfig.implicitIncludeDir path
result
makePathAbsolute path
member _.ResolveSourceFile(m, filename, pathLoadedFrom) =
data.ResolveSourceFile(m, filename, pathLoadedFrom)
......
......@@ -561,9 +561,9 @@ type TcConfigProvider =
/// TcConfigBuilder rather than delivering snapshots.
static member BasedOnMutableBuilder: TcConfigBuilder -> TcConfigProvider
val TryResolveFileUsingPaths: paths: string list * m: range * name: string -> string option
val TryResolveFileUsingPaths: paths: string seq * m: range * name: string -> string option
val ResolveFileUsingPaths: paths: string list * m: range * name: string -> string
val ResolveFileUsingPaths: paths: string seq * m: range * name: string -> string
val GetWarningNumber: m: range * warningNumber: string -> int option
......
......@@ -318,20 +318,22 @@ type TcConfig with
|| isNetModule then
let searchPaths =
// if this is a #r reference (not from dummy range), make sure the directory of the declaring
// file is included in the search path. This should ideally already be one of the search paths, but
// during some global checks it won't be. We append to the end of the search list so that this is the last
// place that is checked.
let isPoundRReference (r: range) =
not (equals r range0) &&
not (equals r rangeStartup) &&
not (equals r rangeCmdArgs) &&
FileSystem.IsPathRootedShim r.FileName
if isPoundRReference m then
tcConfig.GetSearchPathsForLibraryFiles() @ [Path.GetDirectoryName(m.FileName)]
else
tcConfig.GetSearchPathsForLibraryFiles()
seq {
yield! tcConfig.GetSearchPathsForLibraryFiles()
// if this is a #r reference (not from dummy range), make sure the directory of the declaring
// file is included in the search path. This should ideally already be one of the search paths, but
// during some global checks it won't be. We append to the end of the search list so that this is the last
// place that is checked.
let isPoundRReference (r: range) =
not (equals r range0) &&
not (equals r rangeStartup) &&
not (equals r rangeCmdArgs) &&
FileSystem.IsPathRootedShim r.FileName
if isPoundRReference m then
yield Path.GetDirectoryName(m.FileName)
}
let resolved = TryResolveFileUsingPaths(searchPaths, m, nm)
match resolved with
......
......@@ -16,12 +16,12 @@ let p = match e with
// Expected NOT to match
let p' = match e' with
| Failure(_) -> false
| _ -> true
| Failure(_) -> false
| _ -> true
// Expected to match
let p'' = match e'' with
| Failure(_) -> true
| _ -> false
(if p && p' && p'' then 0 else 1) |> exit
if not (p && p' && p'') then failwith "Failed: 1"
......@@ -25,6 +25,5 @@ let testFunc() =
let result = testFunc()
printfn "%s" result
if result <> "Language [C#]. Exception text [Who would want to program in anything other than F#?]" then exit 1
if result <> "Language [C#]. Exception text [Who would want to program in anything other than F#?]" then failwith "Failed: 1"
exit 0
......@@ -9,4 +9,4 @@ let e2 = E(11)
let t1 = e1.Equals(box e2) // expect: false, no exception!
let t2 = e1.Equals(box e1) // expect: true, no exception!
(if not t1 && t2 then 0 else 1) |> exit
if t1 && t2 then failwith "Failed: 1"
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace FSharp.Compiler.ComponentTests.Conformance.BasicTypeAndModuleDefinitions
open System.IO
open Xunit
open FSharp.Test
open FSharp.Test.Compiler
module ExceptionDefinition =
// SOURCE=Abbreviation01.fsx # Abbreviation01.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Abbreviation01.fsx"|])>]
let``Abbreviation01_fsx`` compilation =
compilation
|> asExe
|> withOptions ["--warnaserror+"; "--nowarn:988"]
|> compileExeAndRun
|> shouldSucceed
// SOURCE=AbbreviationForSystemException.fsx # AbbreviationForSystemException.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AbbreviationForSystemException.fsx"|])>]
let``AbbreviationForSystemException_fsx`` compilation =
compilation
|> asExe
|> withOptions ["--warnaserror+"; "--nowarn:988"]
|> compileExeAndRun
|> shouldSucceed
// SOURCE=Abbreviation_SampleCodeFromSpec01.fsx # Abbreviation_SampleCodeFromSpec01.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Abbreviation_SampleCodeFromSpec01.fsx"|])>]
let``Abbreviation_SampleCodeFromSpec01_fsx`` compilation =
compilation
|> asFsx
|> asExe
|> withOptions ["--nowarn:52"; "--nowarn:988"]
|> compileExeAndRun
|> shouldSucceed
// SOURCE=ActiveRecognizer.fsx # ActiveRecognizer.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"ActiveRecognizer.fsx"|])>]
let``ActiveRecognizer_fsx`` compilation =
compilation
|> asExe
|> withOptions ["--warnaserror+"; "--nowarn:988"]
|> compileExeAndRun
|> shouldSucceed
// SOURCE=AddMethsProps01.fs # AddMethsProps01
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AddMethsProps01.fs"|])>]
let``AddMethsProps01_fs`` compilation =
compilation
|> asExe
|> withOptions ["--warnaserror+"; "--nowarn:988"]
|> compileExeAndRun
|> shouldSucceed
// SOURCE=CatchWOTypecheck01.fs # CatchWOTypeCheck01
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"CatchWOTypecheck01.fs"|])>]
let``CatchWOTypecheck01_fs`` compilation =
compilation
|> asExe
|> withOptions ["--warnaserror+"; "--nowarn:988"]
|> compileExeAndRun
|> shouldSucceed
// SOURCE=EqualAndBoxing01.fs # EqualAndBoxing01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"EqualAndBoxing01.fs"|])>]
let``EqualAndBoxing01_fs`` compilation =
compilation
|> asExe
|> withOptions ["--warnaserror+"; "--nowarn:988"]
|> compileExeAndRun
|> shouldSucceed
// SOURCE=ExceptionAsDerivedFromSystemException01.fsx # ExceptionAsDerivedFromSystemException01.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"ExceptionAsDerivedFromSystemException01.fsx"|])>]
let``ExceptionAsDerivedFromSystemException01_fsx`` compilation =
compilation
|> asExe
|> withOptions ["--warnaserror+"; "--nowarn:988"]
|> compileExeAndRun
|> shouldSucceed
// SOURCE=ExnAsDiscriminatedUnion01.fsx # ExnAsDiscriminatedUnion01.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"ExnAsDiscriminatedUnion01.fsx"|])>]
let``ExnAsDiscriminatedUnion01_fsx`` compilation =
compilation
|> asExe
|> withOptions ["--warnaserror+"; "--nowarn:988"]
|> compileExeAndRun
|> shouldSucceed
// SOURCE=E_Abbreviation_NonMatchingObjConstructor.fsx SCFLAGS="--test:ErrorRanges" # E_Abbreviation_NonMatchingObjConstructor.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_Abbreviation_NonMatchingObjConstructor.fsx"|])>]
let``E_Abbreviation_NonMatchingObjConstructor_fsx`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 920, Line 8, Col 1, Line 8, Col 28, "Abbreviations for Common IL exception types must have a matching object constructor") ]
// SOURCE=E_AssertionFailureExn.fs SCFLAGS="--test:ErrorRanges" # E_AssertionFailureExn.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AssertionFailureExn.fs"|])>]
let``E_AssertionFailureExn_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 39, Line 11, Col 36, Line 11, Col 61, "The type 'AssertionFailureException' is not defined in 'Microsoft.FSharp.Core'.")
]
// SOURCE=E_BeginWithUppercase01.fsx SCFLAGS="--test:ErrorRanges" # E_BeginWithUppercase01.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_BeginWithUppercase01.fsx"|])>]
let``E_BeginWithUppercase01_fsx`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 53, Line 9, Col 1, Line 9, Col 19, "Discriminated union cases and exception labels must be uppercase identifiers")
(Error 53, Line 10, Col 1, Line 10, Col 19, "Discriminated union cases and exception labels must be uppercase identifiers")
]
// SOURCE=E_BeginWithUppercase02.fsx SCFLAGS="--test:ErrorRanges" # E_BeginWithUppercase02.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_BeginWithUppercase02.fsx"|])>]
let``E_BeginWithUppercase02_fsx`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 10, Line 8, Col 11, Line 8, Col 12, "Unexpected integer literal in exception definition. Expected identifier or other token.")
]
// SOURCE=E_BeginWithUppercase03.fsx SCFLAGS="--test:ErrorRanges" # E_BeginWithUppercase03.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_BeginWithUppercase03.fsx"|])>]
let``E_BeginWithUppercase03_fsx`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 10, Line 9, Col 11, Line 9, Col 14, "Unexpected string literal in exception definition. Expected identifier or other token.")
]
// SOURCE=E_BeginWithUppercase04.fsx SCFLAGS="--test:ErrorRanges" # E_BeginWithUppercase04.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_BeginWithUppercase04.fsx"|])>]
let``E_BeginWithUppercase04_fsx`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 10, Line 7, Col 11, Line 7, Col 12, "Unexpected reserved keyword in exception definition. Expected identifier or other token.")
]
// SOURCE=E_DynamicInvocationNotSupported.fsx SCFLAGS=--test:ErrorRanges # E_DynamicInvocationNotSupported.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_DynamicInvocationNotSupported.fsx"|])>]
let``E_DynamicInvocationNotSupported_fsx`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 39, Line 6, Col 9, Line 6, Col 38, "The value or constructor 'DynamicInvocationNotSupported' is not defined.")
]
// SOURCE=E_ExnAsDiscriminatedUnion01.fsx SCFLAGS="--test:ErrorRanges" # E_ExnAsDiscriminatedUnion01.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_ExnAsDiscriminatedUnion01.fsx"|])>]
let``E_ExnAsDiscriminatedUnion01_fsx`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 10, Line 11, Col 14, Line 11, Col 15, "Unexpected symbol ':' in implementation file")
]
// SOURCE=E_ExnConstructorBadFieldName.fs SCFLAGS="--test:ErrorRanges" # E_ExnConstructorBadFieldName.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_ExnConstructorBadFieldName.fs"|])>]
let``E_ExnConstructorBadFieldName_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 3174, Line 8, Col 17, Line 8, Col 19, "The exception 'AAA' does not have a field named 'V3'.")
(Error 3174, Line 13, Col 7, Line 13, Col 9, "The exception 'AAA' does not have a field named 'V3'.")
]
// SOURCE=E_ExnFieldConflictingName.fs SCFLAGS="--test:ErrorRanges" # E_ExnFieldConflictingName.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_ExnFieldConflictingName.fs"|])>]
let``E_ExnFieldConflictingName_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 3176, Line 6, Col 18, Line 6, Col 23, "Named field 'Data1' conflicts with autogenerated name for anonymous field.")
(Error 3176, Line 8, Col 28, Line 8, Col 29, "Named field 'A' is used more than once.")
]
// SOURCE=E_FieldNameUsedMulti.fs SCFLAGS="--test:ErrorRanges" # E_FieldNameUsedMulti.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_FieldNameUsedMulti.fs"|])>]
let``E_FieldNameUsedMulti_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 3175, Line 8, Col 22, Line 8, Col 24, "Union case/exception field 'V1' cannot be used more than once.")
(Error 3175, Line 13, Col 16, Line 13, Col 18, "Union case/exception field 'V2' cannot be used more than once.")
]
// SOURCE=E_FieldMemberClash.fs SCFLAGS="--test:ErrorRanges" # E_FieldMemberClash.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_FieldMemberClash.fs"|])>]
let``E_FieldMemberClash_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 23, Line 9, Col 17, Line 9, Col 22, "The member 'Data0' can not be defined because the name 'Data0' clashes with the field 'Data0' in this type or module")
(Error 23, Line 10, Col 17, Line 10, Col 22, "The member 'Data1' can not be defined because the name 'Data1' clashes with the field 'Data1' in this type or module")
(Error 23, Line 11, Col 17, Line 11, Col 19, "The member 'V3' can not be defined because the name 'V3' clashes with the field 'V3' in this type or module")
]
// SOURCE=E_GeneratedTypeName01.fsx SCFLAGS="--test:ErrorRanges" # E_GeneratedTypeName01.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_GeneratedTypeName01.fsx"|])>]
let``E_GeneratedTypeName01_fsx`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Warning 1104, Line 8, Col 11, Line 8, Col 27, "Identifiers containing '@' are reserved for use in F# code generation")
(Warning 1104, Line 10, Col 16, Line 10, Col 41, "Identifiers containing '@' are reserved for use in F# code generation")
(Error 39, Line 10, Col 16, Line 10, Col 41, "The type 'Crazy@name.pException' is not defined. Maybe you want one of the following:\r\n Crazy@name.p")
]
// SOURCE=E_GeneratedTypeNameClash02.fsx SCFLAGS="--test:ErrorRanges" # E_GeneratedTypeNameClash02.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_GeneratedTypeNameClash02.fsx"|])>]
let``E_GeneratedTypeNameClash02_fsx`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 37, Line 8, Col 11, Line 8, Col 12, "Duplicate definition of type, exception or module 'EException'")
]
// SOURCE=E_InheritException.fs SCFLAGS="--test:ErrorRanges" # E_InheritException.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_InheritException.fs"|])>]
let``E_InheritException_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 945, Line 9, Col 5, Line 9, Col 24, "Cannot inherit a sealed type")
(Error 1133, Line 9, Col 5, Line 9, Col 24, "No constructors are available for the type 'FSharpExn'")
]
// SOURCE=E_MatchFailure.fsx SCFLAGS=--test:ErrorRanges # E_MatchFailure.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_MatchFailure.fsx"|])>]
let``E_MatchFailure_fsx`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 39, Line 6, Col 9, Line 6, Col 21, "The value or constructor 'MatchFailure' is not defined. Maybe you want one of the following:\n MatchFailureException")
]
// SOURCE=E_MustStartWithCap01.fs # E_MustStartWithCap01
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_MustStartWithCap01.fs"|])>]
let``E_MustStartWithCap01_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 53, Line 8, Col 1, Line 8, Col 39, "Discriminated union cases and exception labels must be uppercase identifiers")
]
// SOURCE=E_Undefined.fsx SCFLAGS=--test:ErrorRanges # E_Undefined.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_Undefined.fsx"|])>]
let``E_Undefined_fsx`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 39, Line 6, Col 9, Line 6, Col 18, "The value or constructor 'Undefined' is not defined.")
]
// SOURCE=GeneratedTypeNameNoClash01.fsx SCFLAGS="--test:ErrorRanges" # GeneratedTypeNameNoClash01.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"GeneratedTypeNameNoClash01.fsx"|])>]
let``GeneratedTypeNameNoClash01_fsx`` compilation =
compilation
|> asExe
|> withOptions ["--warnaserror+"; "--nowarn:988"]
|> compileExeAndRun
|> shouldSucceed
// SOURCE=ImportCSharpException01.fsx # ImportCSharpException01.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"ImportCSharpException01.fsx"|])>]
let``ImportCSharpException01_fsx`` compilation =
let cSharpException =
CSharpFromPath (Path.Combine(__SOURCE_DIRECTORY__, "CSharpException.cs"))
|> withName "CSharpException"
compilation
|> asExe
|> withOptions ["--warnaserror+"; "--nowarn:988"]
|> withReferences [cSharpException]
|> compileExeAndRun
|> shouldSucceed
// SOURCE=LowercaseIdentifier01.fsx # LowercaseIdentifier01.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"LowercaseIdentifier01.fsx"|])>]
let``LowercaseIdentifier01_fsx`` compilation =
compilation
|> asExe
|> withOptions ["--warnaserror+"; "--nowarn:988"]
|> compileExeAndRun
|> shouldSucceed
// SOURCE=NamedFields01.fsx # NamedFields01.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"NamedFields01.fsx"|])>]
let``NamedFields01_fsx`` compilation =
compilation
|> asExe
|> withOptions ["--warnaserror+"; "--nowarn:988"; "--nowarn:25"]
|> compileExeAndRun
|> shouldSucceed
// SOURCE=PatternMatch_SampleCodeFromSpec01.fsx # PatternMatch_SampleCodeFromSpec01.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"PatternMatch_SampleCodeFromSpec01.fsx"|])>]
let``PatternMatch_SampleCodeFromSpec01_fsx`` compilation =
compilation
|> asExe
|> withOptions ["--warnaserror+"; "--nowarn:988"]
|> compileExeAndRun
|> shouldSucceed
// SOURCE=ReflectionAPI.fsx # ReflectionAPI.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"ReflectionAPI.fsx"|])>]
let``ReflectionAPI_fsx`` compilation =
compilation
|> asExe
|> withOptions ["--warnaserror+"; "--nowarn:988"]
|> compileExeAndRun
|> shouldSucceed
......@@ -8,7 +8,9 @@ exception E1
exception E2 of int
exception E3 of int * int
exception E4 of (int * int)
[<NoEquality; NoComparison>]
exception E5 of (int -> int)
[<NoEquality; NoComparison>]
exception E6 of (int -> int) * (int -> int)
exception E7 of (int * int) * int
......@@ -30,4 +32,4 @@ let m e = match e with
| E7(x,y) -> x = (1,2) && y = 3
| _ -> false
(if (m e1) && (m e2) && (m e3) && (m e4) && (m e5) && (m e6) && (m e7) then 0 else 1 ) |> exit
if not((m e1) && (m e2) && (m e3) && (m e4) && (m e5) && (m e6) && (m e7)) then failwith "Failed: 1"
......@@ -3,8 +3,6 @@
//<Expects status="success"></Expects>
#light
#r "CSharpException.dll"
// F# exception definition + abbreviation
exception E = CSharpException.CSharpException
......@@ -20,4 +18,4 @@ let r2 = try
| E as c -> c.Message = "C#Exception"
| _ -> false
(if r1 && r2 then 0 else 1) |> exit
if not (r1 && r2) then failwith "Failed: 1"
......@@ -15,11 +15,11 @@ let result =
| AAA(V3 = ""; V2 = 10; V1 = 5) -> 0
| _ -> 1
if result <> 0 then exit 1
if result <> 0 then failwith "Failed: 1"
let x = AAA(5, V2 = 10, V3 = "")
let (AAA(V3 = y)) = x
if y <> "" then exit 1
if y <> "" then failwith "Failed: 2"
exception CCC of bField : bool * iField : int
......
......@@ -9,4 +9,4 @@ let p = Microsoft.FSharp.Reflection.FSharpType.IsExceptionRepresentation(typeof<
let p' = Microsoft.FSharp.Reflection.FSharpType.IsExceptionRepresentation(typeof<E'>)
let p'' = Microsoft.FSharp.Reflection.FSharpType.IsExceptionRepresentation(typeof<System.Exception>)
(if p && p' && (not p'') then 0 else 1) |> exit
if not(p && p' && (not p'')) then failwith "Failed: 1"
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace FSharp.Compiler.ComponentTests.Conformance.BasicTypeAndModuleDefinitions.GeneratedEqualityHashingComparison.Attributes
open System.IO
open Xunit
open FSharp.Test
open FSharp.Test.Compiler
module Diags =
// SOURCE=E_AdjustUses01a.fs SCFLAGS=--test:ErrorRanges # E_AdjustUses01a.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AdjustUses01a.fs"|])>]
let``E_AdjustUses01a_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 501, Line 7, Col 3, Line 7, Col 23, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.")
]
// SOURCE=E_AdjustUses01b.fs SCFLAGS=--test:ErrorRanges # E_AdjustUses01b.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AdjustUses01b.fs"|])>]
let``E_AdjustUses01b_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 501, Line 7, Col 3, Line 7, Col 23, "The object constructor 'StructuralComparisonAttribute' takes 0 argument(s) but is here given 1. The required signature is 'new: unit -> StructuralComparisonAttribute'.")
]
......@@ -14,4 +14,4 @@ module M04 =
let v1 = not (r1 = r2) // expected true
let v2 = r2 = r2b // expected true
let v3 = r1 < r2 // expected true
(if v1 && v2 && v3 then 0 else 1) |> exit
if not (v1 && v2 && v3) then failwith "Failed: 1"
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace FSharp.Compiler.ComponentTests.Conformance.BasicTypeAndModuleDefinitions.GeneratedEqualityHashingComparison.Attributes
open System.IO
open Xunit
open FSharp.Test
open FSharp.Test.Compiler
module New =
// SOURCE=Test01.fs SCFLAGS="--test:ErrorRanges" # Test01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test01.fs"|])>]
let``Test01_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 381, Line 8, Col 8, Line 8, Col 9, "A type cannot have both the 'ReferenceEquality' and 'StructuralEquality' or 'StructuralComparison' attributes")
]
// SOURCE=Test02.fs SCFLAGS="--test:ErrorRanges" # Test02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test02.fs"|])>]
let``Test02_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 1, Line 14, Col 17, Line 14, Col 19, "The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute")
(Error 1, Line 15, Col 12, Line 15, Col 14, "The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute")
(Error 1, Line 16, Col 12, Line 16, Col 14, "The type 'R' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface")
]
// SOURCE=Test03.fs SCFLAGS="--test:ErrorRanges" # Test03.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test03.fs"|])>]
let``Test03_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 1, Line 14, Col 12, Line 14, Col 14, "The type 'R' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface")
]
// SOURCE=Test04.fs SCFLAGS="--test:ErrorRanges" # Test04.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test04.fs"|])>]
let``Test04_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 380, Line 9, Col 8, Line 9, Col 9, "The 'StructuralEquality' attribute must be used in conjunction with the 'NoComparison' or 'StructuralComparison' attributes")
(Error 385, Line 9, Col 8, Line 9, Col 9, "A type with attribute 'CustomComparison' must have an explicit implementation of at least one of 'System.IComparable' or 'System.Collections.IStructuralComparable'")
]
// SOURCE=Test05.fs SCFLAGS="--test:ErrorRanges" # Test05.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test05.fs"|])>]
let``Test05_fsx`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 1, Line 12, Col 17, Line 12, Col 19, "The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute")
(Error 1, Line 13, Col 12, Line 13, Col 14, "The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute")
(Error 1, Line 14, Col 12, Line 14, Col 14, "The type 'R' does not support the 'comparison' constraint because it has the 'NoComparison' attribute")
]
// SOURCE=Test06.fs SCFLAGS="--test:ErrorRanges" # Test06.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test06.fs"|])>]
let``Test06_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 377, Line 9, Col 8, Line 9, Col 9, "This type uses an invalid mix of the attributes 'NoEquality', 'ReferenceEquality', 'StructuralEquality', 'NoComparison' and 'StructuralComparison'")
(Error 385, Line 9, Col 8, Line 9, Col 9, "A type with attribute 'CustomComparison' must have an explicit implementation of at least one of 'System.IComparable' or 'System.Collections.IStructuralComparable'")
]
// SOURCE=Test07.fs SCFLAGS="--test:ErrorRanges" # Test07.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test07.fs"|])>]
let``Test07_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 380, Line 7, Col 8, Line 7, Col 9, "The 'StructuralEquality' attribute must be used in conjunction with the 'NoComparison' or 'StructuralComparison' attributes")
]
// SOURCE=Test08.fs SCFLAGS="--test:ErrorRanges" # Test08.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test08.fs"|])>]
let``Test08_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 1, Line 13, Col 17, Line 13, Col 19, "The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute")
(Error 1, Line 14, Col 12, Line 14, Col 14, "The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute")
]
// SOURCE=Test09.fs SCFLAGS="--test:ErrorRanges" # Test09.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test09.fs"|])>]
let``Test09_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldSucceed
// SOURCE=Test10.fs SCFLAGS="--test:ErrorRanges" # Test10.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test10.fs"|])>]
let``Test10_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 381, Line 8, Col 8, Line 8, Col 9, "A type cannot have both the 'ReferenceEquality' and 'StructuralEquality' or 'StructuralComparison' attributes")
]
// SOURCE=Test11.fs SCFLAGS="--test:ErrorRanges" # Test11.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test11.fs"|])>]
let``Test11_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 1, Line 14, Col 17, Line 14, Col 19, "The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute")
(Error 1, Line 15, Col 12, Line 15, Col 14, "The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute")
(Error 1, Line 16, Col 12, Line 16, Col 14, "The type 'R' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface")
]
// SOURCE=Test12.fs SCFLAGS="--test:ErrorRanges" # Test12.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test12.fs"|])>]
let``Test12_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 379, Line 8, Col 8, Line 8, Col 9, "The 'StructuralComparison' attribute must be used in conjunction with the 'StructuralEquality' attribute")
]
// SOURCE=Test13.fs SCFLAGS="--test:ErrorRanges" # Test13.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test13.fs"|])>]
let``Test13_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 385, Line 8, Col 8, Line 8, Col 9, "A type with attribute 'CustomComparison' must have an explicit implementation of at least one of 'System.IComparable' or 'System.Collections.IStructuralComparable'")
]
// SOURCE=Test14.fs SCFLAGS="--test:ErrorRanges" # Test14.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test14.fs"|])>]
let``Test14_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 1, Line 14, Col 17, Line 14, Col 19, "The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute")
(Error 1, Line 15, Col 12, Line 15, Col 14, "The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute")
(Error 1, Line 16, Col 12, Line 16, Col 14, "The type 'R' does not support the 'comparison' constraint because it has the 'NoComparison' attribute")
]
// SOURCE=Test15.fs SCFLAGS="--test:ErrorRanges" # Test15.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test15.fs"|])>]
let``Test15_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 39, Line 18, Col 23, Line 18, Col 25, "The value or constructor 'v3' is not defined.")
]
// SOURCE=Test16.fs SCFLAGS="--test:ErrorRanges" # Test16.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test16.fs"|])>]
let``Test16_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 380, Line 8, Col 8, Line 8, Col 9, "The 'StructuralEquality' attribute must be used in conjunction with the 'NoComparison' or 'StructuralComparison' attributes")
]
// SOURCE=Test17.fs SCFLAGS="--test:ErrorRanges" # Test17.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test17.fs"|])>]
let``Test17_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 1, Line 14, Col 17, Line 14, Col 19, "The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute")
(Error 1, Line 15, Col 12, Line 15, Col 14, "The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute")
(Error 1, Line 16, Col 12, Line 16, Col 14, "The type 'R' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface")
(Error 39, Line 20, Col 1, Line 20, Col 2, "The value or constructor 'v' is not defined.")
]
// SOURCE=Test18.fs SCFLAGS="--test:ErrorRanges" # Test18.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test18.fs"|])>]
let``Test18_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldSucceed
// SOURCE=Test19.fs SCFLAGS="--test:ErrorRanges" # Test19.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test19.fs"|])>]
let``Test19_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldSucceed
// SOURCE=Test20.fs SCFLAGS="--test:ErrorRanges" # Test20.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test20.fs"|])>]
let``Test20_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 1, Line 14, Col 17, Line 14, Col 19, "The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute")
(Error 1, Line 15, Col 12, Line 15, Col 14, "The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute")
(Error 1, Line 16, Col 12, Line 16, Col 14, "The type 'R' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface")
]
// SOURCE=Test21.fs SCFLAGS="--test:ErrorRanges" # Test21.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test21.fs"|])>]
let``Test21_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 379, Line 8, Col 8, Line 8, Col 9, "The 'StructuralComparison' attribute must be used in conjunction with the 'StructuralEquality' attribute")
]
// SOURCE=Test22.fs SCFLAGS="--test:ErrorRanges" # Test22.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test22.fs"|])>]
let``Test22_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 1, Line 15, Col 13, Line 15, Col 15, "The type 'R' does not support the 'comparison' constraint because it has the 'NoComparison' attribute")
]
// SOURCE=Test23.fs SCFLAGS="--test:ErrorRanges" # Test23.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test23.fs"|])>]
let``Test23_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 1, Line 14, Col 17, Line 14, Col 19, "The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute")
(Error 1, Line 15, Col 17, Line 15, Col 19, "The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute")
(Error 1, Line 17, Col 13, Line 17, Col 15, "The type 'R' does not support the 'comparison' constraint because it has the 'NoComparison' attribute")
]
// SOURCE=Test24.fs SCFLAGS="--test:ErrorRanges" # Test24.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test24.fs"|])>]
let``Test24_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 1, Line 14, Col 12, Line 14, Col 14, "The type 'R' does not support the 'comparison' constraint because it has the 'NoComparison' attribute")
]
// SOURCE=Test25.fs SCFLAGS="--test:ErrorRanges" # Test25.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test25.fs"|])>]
let``Test25_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 1, Line 14, Col 12, Line 14, Col 14, "The type 'R' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface")
]
// SOURCE=Test26.fs SCFLAGS="--test:ErrorRanges" # Test26.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test26.fs"|])>]
let``Test26_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 1, Line 14, Col 17, Line 14, Col 19, "The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute")
(Error 1, Line 15, Col 12, Line 15, Col 14, "The type 'R' does not support the 'equality' constraint because it has the 'NoEquality' attribute")
(Error 1, Line 16, Col 12, Line 16, Col 14, "The type 'R' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface")
]
// SOURCE=Test27.fs SCFLAGS="--test:ErrorRanges" # Test27.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test27.fs"|])>]
let``Test27_fs`` compilation =
compilation
|> asExe
|> withOptions ["--test:ErrorRanges"; "--warnaserror+"; "--nowarn:988"]
|> compileExeAndRun
|> shouldSucceed
// SOURCE=Test28.fs SCFLAGS="--test:ErrorRanges" # Test28.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Test28.fs"|])>]
let``Test28_fs`` compilation =
compilation
|> asExe
|> compile
|> shouldFail
|> withDiagnostics [
(Error 378, Line 10, Col 6, Line 10, Col 12, "The 'NoEquality' attribute must be used in conjunction with the 'NoComparison' attribute")
(Warning 386, Line 10, Col 6, Line 10, Col 12, "A type with attribute 'NoEquality' should not usually have an explicit implementation of 'Object.Equals(obj)'. Disable this warning if this is intentional for interoperability purposes")
(Warning 346, Line 10, Col 6, Line 10, Col 12, "The struct, record or union type 'MyType' has an explicit implementation of 'Object.Equals'. Consider implementing a matching override for 'Object.GetHashCode()'")
]
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册