提交 27fd7d27 编写于 作者: D Don Syme

Merge commit '89e476cf' into feature/ext

......@@ -8,9 +8,9 @@
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="7.0.0-beta.22215.2">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="7.0.0-beta.22218.3">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>4000024394df3049886c50e54ad0a2b903221ef0</Sha>
<Sha>8425453874961a7d7d2379e3f39c104f9ad0a0bd</Sha>
<SourceBuild RepoName="arcade" ManagedOnly="true" />
</Dependency>
</ToolsetDependencies>
......
......@@ -72,8 +72,8 @@ jobs:
lclSource: ${{ parameters.LclSource }}
lclPackageId: ${{ parameters.LclPackageId }}
isCreatePrSelected: ${{ parameters.CreatePr }}
isAutoCompletePrSelected: ${{ parameters.AutoCompletePr }}
${{ if eq(parameters.CreatePr, true) }}:
isAutoCompletePrSelected: ${{ parameters.AutoCompletePr }}
isUseLfLineEndingsSelected: ${{ parameters.UseLfLineEndings }}
${{ if eq(parameters.RepoType, 'gitHub') }}:
isShouldReusePrSelected: ${{ parameters.ReusePr }}
......
......@@ -17,7 +17,7 @@
"perl": "5.32.1.1"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22215.2",
"Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22218.3",
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2"
}
}
......@@ -865,6 +865,7 @@ type ILParameter =
IsOptional: bool
CustomAttrsStored: ILAttributesStored
MetadataIndex: int32 }
member CustomAttrs: ILAttributes
type ILParameters = ILParameter list
......
......@@ -347,24 +347,24 @@ let ImportILTypeFromMetadata amap m scoref tinst minst ilty =
ImportILType scoref amap m (tinst@minst) ilty
/// Read an Abstract IL type from metadata, including any attributes that may affect the type itself, and convert to an F# type.
let ImportILTypeFromMetadataWithAttributes amap m scoref tinst minst ilty cattrs =
let ImportILTypeFromMetadataWithAttributes amap m scoref tinst minst ilty getCattrs =
let ty = ImportILType scoref amap m (tinst@minst) ilty
// If the type is a byref and one of attributes from a return or parameter has IsReadOnly, then it's a inref.
if isByrefTy amap.g ty && TryFindILAttribute amap.g.attrib_IsReadOnlyAttribute cattrs then
if isByrefTy amap.g ty && TryFindILAttribute amap.g.attrib_IsReadOnlyAttribute (getCattrs ()) then
mkInByrefTy amap.g (destByrefTy amap.g ty)
else
ty
/// Get the parameter type of an IL method.
let ImportParameterTypeFromMetadata amap m ilty cattrs scoref tinst mist =
ImportILTypeFromMetadataWithAttributes amap m scoref tinst mist ilty cattrs
let ImportParameterTypeFromMetadata amap m ilty getCattrs scoref tinst mist =
ImportILTypeFromMetadataWithAttributes amap m scoref tinst mist ilty getCattrs
/// Get the return type of an IL method, taking into account instantiations for type, return attributes and method generic parameters, and
/// translating 'void' to 'None'.
let ImportReturnTypeFromMetadata amap m ilty cattrs scoref tinst minst =
let ImportReturnTypeFromMetadata amap m ilty getCattrs scoref tinst minst =
match ilty with
| ILType.Void -> None
| retTy -> Some(ImportILTypeFromMetadataWithAttributes amap m scoref tinst minst retTy cattrs)
| retTy -> Some(ImportILTypeFromMetadataWithAttributes amap m scoref tinst minst retTy getCattrs)
/// Search for the relevant extension values again if a name resolution environment is provided
......@@ -607,8 +607,9 @@ type OptionalArgInfo =
match ilParam.Marshal with
| Some(ILNativeType.IUnknown | ILNativeType.IDispatch | ILNativeType.Interface) -> Constant ILFieldInit.Null
| _ ->
if TryFindILAttributeOpt g.attrib_IUnknownConstantAttribute ilParam.CustomAttrs then WrapperForIUnknown
elif TryFindILAttributeOpt g.attrib_IDispatchConstantAttribute ilParam.CustomAttrs then WrapperForIDispatch
let attrs = ilParam.CustomAttrs
if TryFindILAttributeOpt g.attrib_IUnknownConstantAttribute attrs then WrapperForIUnknown
elif TryFindILAttributeOpt g.attrib_IDispatchConstantAttribute attrs then WrapperForIDispatch
else MissingValue
else
DefaultValue
......@@ -887,19 +888,21 @@ type ILMethInfo =
/// Get the argument types of the the IL method. If this is an C#-style extension method
/// then drop the object argument.
member x.GetParamTypes(amap, m, minst) =
x.ParamMetadata |> List.map (fun p -> ImportParameterTypeFromMetadata amap m p.Type p.CustomAttrs x.MetadataScope x.DeclaringTypeInst minst)
x.ParamMetadata |> List.map (fun p -> ImportParameterTypeFromMetadata amap m p.Type (fun _ -> p.CustomAttrs) x.MetadataScope x.DeclaringTypeInst minst)
/// Get all the argument types of the IL method. Include the object argument even if this is
/// an C#-style extension method.
member x.GetRawArgTypes(amap, m, minst) =
x.RawMetadata.Parameters |> List.map (fun p -> ImportParameterTypeFromMetadata amap m p.Type p.CustomAttrs x.MetadataScope x.DeclaringTypeInst minst)
x.RawMetadata.Parameters |> List.map (fun p -> ImportParameterTypeFromMetadata amap m p.Type (fun _ -> p.CustomAttrs) x.MetadataScope x.DeclaringTypeInst minst)
/// Get info about the arguments of the IL method. If this is an C#-style extension method then
/// drop the object argument.
///
/// Any type parameters of the enclosing type are instantiated in the type returned.
member x.GetParamNamesAndTypes(amap, m, minst) =
x.ParamMetadata |> List.map (fun p -> ParamNameAndType(Option.map (mkSynId m) p.Name, ImportParameterTypeFromMetadata amap m p.Type p.CustomAttrs x.MetadataScope x.DeclaringTypeInst minst) )
let scope = x.MetadataScope
let tinst = x.DeclaringTypeInst
x.ParamMetadata |> List.map (fun p -> ParamNameAndType(Option.map (mkSynId m) p.Name, ImportParameterTypeFromMetadata amap m p.Type (fun _ -> p.CustomAttrs) scope tinst minst) )
/// Get a reference to the method (dropping all generic instantiations), as an Abstract IL ILMethodRef.
member x.ILMethodRef =
......@@ -928,7 +931,7 @@ type ILMethInfo =
// method instantiation.
if x.IsILExtensionMethod then
let p = x.RawMetadata.Parameters.Head
[ ImportParameterTypeFromMetadata amap m p.Type p.CustomAttrs x.MetadataScope x.DeclaringTypeInst minst ]
[ ImportParameterTypeFromMetadata amap m p.Type (fun _ -> p.CustomAttrs) x.MetadataScope x.DeclaringTypeInst minst ]
else if x.IsInstance then
[ x.ApparentEnclosingType ]
else
......@@ -936,7 +939,7 @@ type ILMethInfo =
/// Get the compiled return type of the method, where 'void' is None.
member x.GetCompiledReturnTy (amap, m, minst) =
ImportReturnTypeFromMetadata amap m x.RawMetadata.Return.Type x.RawMetadata.Return.CustomAttrs x.MetadataScope x.DeclaringTypeInst minst
ImportReturnTypeFromMetadata amap m x.RawMetadata.Return.Type (fun _ -> x.RawMetadata.Return.CustomAttrs) x.MetadataScope x.DeclaringTypeInst minst
/// Get the F# view of the return type of the method, where 'void' is 'unit'.
member x.GetFSharpReturnTy (amap, m, minst) =
......@@ -1462,9 +1465,10 @@ type MethInfo =
match x with
| ILMeth(g, ilMethInfo, _) ->
[ [ for p in ilMethInfo.ParamMetadata do
let isParamArrayArg = TryFindILAttribute g.attrib_ParamArrayAttribute p.CustomAttrs
let attrs = p.CustomAttrs
let isParamArrayArg = TryFindILAttribute g.attrib_ParamArrayAttribute attrs
let reflArgInfo =
match TryDecodeILAttribute g.attrib_ReflectedDefinitionAttribute.TypeRef p.CustomAttrs with
match TryDecodeILAttribute g.attrib_ReflectedDefinitionAttribute.TypeRef attrs with
| Some ([ILAttribElem.Bool b ], _) -> ReflectedArgInfo.Quote b
| Some _ -> ReflectedArgInfo.Quote false
| _ -> ReflectedArgInfo.None
......@@ -1473,9 +1477,9 @@ type MethInfo =
// Note: we get default argument values from VB and other .NET language metadata
let optArgInfo = OptionalArgInfo.FromILParameter g amap m ilMethInfo.MetadataScope ilMethInfo.DeclaringTypeInst p
let isCallerLineNumberArg = TryFindILAttribute g.attrib_CallerLineNumberAttribute p.CustomAttrs
let isCallerFilePathArg = TryFindILAttribute g.attrib_CallerFilePathAttribute p.CustomAttrs
let isCallerMemberNameArg = TryFindILAttribute g.attrib_CallerMemberNameAttribute p.CustomAttrs
let isCallerLineNumberArg = TryFindILAttribute g.attrib_CallerLineNumberAttribute attrs
let isCallerFilePathArg = TryFindILAttribute g.attrib_CallerFilePathAttribute attrs
let isCallerMemberNameArg = TryFindILAttribute g.attrib_CallerMemberNameAttribute attrs
let callerInfo =
match isCallerLineNumberArg, isCallerFilePathArg, isCallerMemberNameArg with
......@@ -1617,10 +1621,10 @@ type MethInfo =
match x with
| ILMeth(_, ilminfo, _) ->
let ftinfo = ILTypeInfo.FromType g (TType_app(tcref, formalEnclosingTyparTys, g.knownWithoutNull))
let formalRetTy = ImportReturnTypeFromMetadata amap m ilminfo.RawMetadata.Return.Type ilminfo.RawMetadata.Return.CustomAttrs ftinfo.ILScopeRef ftinfo.TypeInstOfRawMetadata formalMethTyparTys
let formalRetTy = ImportReturnTypeFromMetadata amap m ilminfo.RawMetadata.Return.Type (fun _ -> ilminfo.RawMetadata.Return.CustomAttrs) ftinfo.ILScopeRef ftinfo.TypeInstOfRawMetadata formalMethTyparTys
let formalParams =
[ [ for p in ilminfo.RawMetadata.Parameters do
let paramType = ImportILTypeFromMetadataWithAttributes amap m ftinfo.ILScopeRef ftinfo.TypeInstOfRawMetadata formalMethTyparTys p.Type p.CustomAttrs
let paramType = ImportILTypeFromMetadataWithAttributes amap m ftinfo.ILScopeRef ftinfo.TypeInstOfRawMetadata formalMethTyparTys p.Type (fun _ -> p.CustomAttrs)
yield TSlotParam(p.Name, paramType, p.IsIn, p.IsOut, p.IsOptional, []) ] ]
formalRetTy, formalParams
#if !NO_TYPEPROVIDERS
......
......@@ -81,14 +81,14 @@ val ExistsHeadTypeInEntireHierarchy: g:TcGlobals -> amap:ImportMap -> m:range ->
val ImportILTypeFromMetadata: amap:ImportMap -> m:range -> scoref:ILScopeRef -> tinst:TType list -> minst:TType list -> ilty:ILType -> TType
/// Read an Abstract IL type from metadata, including any attributes that may affect the type itself, and convert to an F# type.
val ImportILTypeFromMetadataWithAttributes: amap:ImportMap -> m:range -> scoref:ILScopeRef -> tinst:TType list -> minst:TType list -> ilty:ILType -> cattrs:ILAttributes -> TType
val ImportILTypeFromMetadataWithAttributes: amap:ImportMap -> m:range -> scoref:ILScopeRef -> tinst:TType list -> minst:TType list -> ilty:ILType -> getCattrs: (unit -> ILAttributes) -> TType
/// Get the parameter type of an IL method.
val ImportParameterTypeFromMetadata: amap:ImportMap -> m:range -> ilty:ILType -> cattrs:ILAttributes -> scoref:ILScopeRef -> tinst:TType list -> mist:TType list -> TType
val ImportParameterTypeFromMetadata: amap:ImportMap -> m:range -> ilty:ILType -> getCattrs: (unit -> ILAttributes) -> scoref:ILScopeRef -> tinst:TType list -> mist:TType list -> TType
/// Get the return type of an IL method, taking into account instantiations for type, return attributes and method generic parameters, and
/// translating 'void' to 'None'.
val ImportReturnTypeFromMetadata: amap:ImportMap -> m:range -> ilty:ILType -> cattrs:ILAttributes -> scoref:ILScopeRef -> tinst:TType list -> minst:TType list -> TType option
val ImportReturnTypeFromMetadata: amap:ImportMap -> m:range -> ilty:ILType -> getCattrs: (unit -> ILAttributes) -> scoref:ILScopeRef -> tinst:TType list -> minst:TType list -> TType option
/// Copy constraints. If the constraint comes from a type parameter associated
/// with a type constructor then we are simply renaming type variables. If it comes
......
......@@ -1153,7 +1153,7 @@ module FSharpExprConvert =
// is not sufficient to resolve to a symbol unambiguously in these cases.
let argtys = [ ilMethRef.ArgTypes |> List.map (ImportILTypeFromMetadata cenv.amap m scoref tinst1 tinst2) ]
let rty =
match ImportReturnTypeFromMetadata cenv.amap m ilMethRef.ReturnType emptyILCustomAttrs scoref tinst1 tinst2 with
match ImportReturnTypeFromMetadata cenv.amap m ilMethRef.ReturnType (fun _ -> emptyILCustomAttrs) scoref tinst1 tinst2 with
| None -> if isCtor then enclosingType else g.unit_ty
| Some ty -> ty
......
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace FSharp.Compiler.ComponentTests.Conformance.DeclarationElements.AccessibilityAnnotations
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=E_ExposeLessVisible01.fs # E_ExposeLessVisible01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_ExposeLessVisible01.fs"|])>]
let ``E_ExposeLessVisible01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 410, Line 5, Col 19, Line 5, Col 20, "The type 'A' is less accessible than the value, member or type 'x' it is used in.")
]
//SOURCE=E_BaseIFaceLessAccessible01.fs SCFLAGS="-a --test:ErrorRanges" # E_BaseIFaceLessAccessible01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_BaseIFaceLessAccessible01.fs"|])>]
let ``E_BaseIFaceLessAccessible01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 410, Line 11, Col 8, Line 11, Col 23, "The type 'I1' is less accessible than the value, member or type 'IAmAnInterface1' it is used in.")
]
//SOURCE=E_LocalLetBinding02.fs SCFLAGS="--test:ErrorRanges" # E_LocalLetBinding02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_LocalLetBinding02.fs"|])>]
let ``E_LocalLetBinding02_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 646, Line 7, Col 13, Line 7, Col 16, "Multiple visibility attributes have been specified for this identifier. 'let' bindings in classes are always private, as are any 'let' bindings inside expressions.")
]
//SOURCE=E_privateThingsInaccessible.fs # E_privateThingsInaccessible.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_privateThingsInaccessible.fs"|])>]
let ``E_privateThingsInaccessible_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 1094, Line 18, Col 17, Line 18, Col 41, "The value 'somePrivateField' is not accessible from this code location")
(Error 1094, Line 19, Col 17, Line 19, Col 42, "The value 'somePrivateMethod' is not accessible from this code location")
(Error 491, Line 23, Col 17, Line 23, Col 34, "The member or object constructor 'PrivateMethod' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.")
]
//SOURCE=E_privateThingsInaccessible02.fs SCFLAGS="--test:ErrorRanges" # E_privateThingsInaccessible02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_privateThingsInaccessible02.fs"|])>]
let ``E_PrivateThingsInaccessible02_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 1092, Line 26, Col 19, Line 26, Col 32, "The type 'PrivateModule' is not accessible from this code location")
(Error 1094, Line 26, Col 17, Line 26, Col 34, "The value 'x' is not accessible from this code location")
(Error 1092, Line 27, Col 19, Line 27, Col 32, "The type 'PrivateModule' is not accessible from this code location")
(Error 1094, Line 27, Col 17, Line 27, Col 34, "The value 'f' is not accessible from this code location")
(Error 1094, Line 29, Col 17, Line 29, Col 20, "The value 'y' is not accessible from this code location")
(Error 1094, Line 30, Col 17, Line 30, Col 20, "The value 'g' is not accessible from this code location")
]
//SOURCE=E_privateThingsInaccessible03.fs SCFLAGS="--test:ErrorRanges" # E_privateThingsInaccessible03.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_privateThingsInaccessible03.fs"|])>]
let ``E_PrivateThingsInaccessible03_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 1092, Line 11, Col 15, Line 11, Col 28, "The type 'PrivateModule' is not accessible from this code location")
(Error 1094, Line 11, Col 13, Line 11, Col 30, "The value 'x' is not accessible from this code location")
(Error 39, Line 15, Col 13, Line 15, Col 26, "The value, namespace, type or module 'PrivateModule' is not defined.")
]
//SOURCE=E_privateThingsInaccessible04.fs SCFLAGS="--test:ErrorRanges" # E_privateThingsInaccessible04.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_privateThingsInaccessible04.fs"|])>]
let ``E_PrivateThingsInaccessible04_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 39, Line 25, Col 17, Line 25, Col 30, "The value, namespace, type or module 'PrivateModule' is not defined.")
(Error 39, Line 26, Col 17, Line 26, Col 30, "The value, namespace, type or module 'PrivateModule' is not defined.")
(Error 39, Line 28, Col 17, Line 28, Col 18, "The value or constructor 'y' is not defined.")
(Error 39, Line 29, Col 17, Line 29, Col 18, "The value or constructor 'g' is not defined.")
]
//SOURCE=E_privateThingsInaccessible05.fs SCFLAGS="--test:ErrorRanges" # E_privateThingsInaccessible05.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_privateThingsInaccessible05.fs"|])>]
let ``E_PrivateThingsInaccessible05_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 1096, Line 11, Col 9, Line 11, Col 24, "The record, struct or class field 'foo' is not accessible from this code location")
]
//SOURCE=E_PrivateImplicitCtor01.fs SCFLAGS="--test:ErrorRanges" # E_PrivateImplicitCtor01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_PrivateImplicitCtor01.fs"|])>]
let ``E_PrivateImplicitCtor01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 509, Line 24, Col 10, Line 24, Col 18, "Method or object constructor 'C' not found")
]
//SOURCE=E_ProtectedThingsInaccessible01.fs SCFLAGS="--test:ErrorRanges" # E_ProtectedThingsInaccessible01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_ProtectedThingsInaccessible01.fs"|])>]
let ``E_ProtectedThingsInaccessible01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 629, Line 11, Col 24, Line 11, Col 41, "Method 'MemberwiseClone' is not accessible from this code location")
]
//SOURCE=E_MoreAccessibleBaseClass01.fs # E_MoreAccessibleBaseClass01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_MoreAccessibleBaseClass01.fs"|])>]
let ``E_MoreAccessibleBaseClass01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 410, Line 10, Col 6, Line 10, Col 8, "The type 'C1' is less accessible than the value, member or type 'C2' it is used in.")
]
//SOURCE=E_MoreAccessibleBaseClass02.fs # E_MoreAccessibleBaseClass02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_MoreAccessibleBaseClass02.fs"|])>]
let ``E_MoreAccessibleBaseClass02_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 410, Line 12, Col 6, Line 12, Col 7, "The type 'I2' is less accessible than the value, member or type 'D' it is used in.")
(Error 410, Line 18, Col 6, Line 18, Col 25, "The type 'I3' is less accessible than the value, member or type 'IAmAnotherInterface' it is used in.")
]
//SOURCE=InterfaceImplementationVisibility.fs # InterfaceImplementationVisibility.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"InterfaceImplementationVisibility.fs"|])>]
let ``InterfaceImplementationVisibility_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
//SOURCE=InternalizedIFaces02.fs SCFLAGS="-a --warnaserror" # InternalizedIFaces02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"InternalizedIFaces02.fs"|])>]
let ``InternalizedIFaces02_fs`` compilation =
compilation
|> withOptions ["--nowarn:1178";]
|> verifyCompileAndRun
|> shouldSucceed
//SOURCE=internalMethodsWorkCorrectly.fs # InternalMethodsWorkCorrectly.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"InternalMethodsWorkCorrectly.fs"|])>]
let ``InternalMethodsWorkCorrectly_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
//SOURCE=LessOrMoreAccessibleCode01.fs # LessOrMoreAccessibleCode01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"LessOrMoreAccessibleCode01.fs"|])>]
let ``LessOrMoreAccessibleCode01_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
//SOURCE=LocalLetBinding01.fs SCFLAGS="-a --test:ErrorRanges" # LocalLetBinding01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"LocalLetBinding01.fs"|])>]
let ``LocalLetBinding01_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
......@@ -14,12 +14,12 @@ type C private (x : int) =
// OK: Access public ctor
let t1 = new A(1)
if t1.Value <> 1 then exit 1
if t1.Value <> 1 then failwith "Failed: 1"
// OK: Access internal ctor
let t2 = new B(2)
if t2.Value <> 2 then exit 1
if t2.Value <> 2 then failwith "Failed: 2"
// ERROR: Access private ctor
let t3 = new C(3)
if t3.Value <> 3 then exit 1
if t3.Value <> 3 then failwith "Failed: 3"
......@@ -30,12 +30,7 @@ module Module2 =
let test8 = PublicModule.x // OK
let test9 = PublicModule.f 2 // OK
// Shouldn't compile and get this far
exit 1
// Shouldn't compile and get this far
exit 1
......@@ -19,6 +19,5 @@ module testModule =
let result = x.InternalMethod_GetDevoweledString()
if result <> InternalModule.deVowelStr startingValue then exit 1
exit 0
if result <> InternalModule.deVowelStr startingValue then failwith "Failed: 1"
......@@ -17,6 +17,4 @@ let internal a = HelperModule.make 2
let b = Module.makeData 1
if HelperModule.handle a <> 2 || Module.getInt b <> 1 then exit 1
exit 0
if HelperModule.handle a <> 2 || Module.getInt b <> 1 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.DeclarationElements.AccessibilityAnnotations
open Xunit
open FSharp.Test
open FSharp.Test.Compiler
module OnOverridesAndIFaceImpl =
let verifyCompile compilation =
compilation
|> asExe
|> withOptions ["--nowarn:988"]
|> compile
let verifyCompileAndRun compilation =
compilation
|> asExe
|> withOptions ["--nowarn:988"]
|> compileAndRun
// SOURCE=E_InterfaceImpl01.fs SCFLAGS="--test:ErrorRanges" # E_InterfaceImpl01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_InterfaceImpl01.fs"|])>]
let ``E_InterfaceImpl01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 941, Line 19, Col 38, Line 19, Col 40, "Accessibility modifiers are not permitted on overrides or interface implementations")
(Error 941, Line 24, Col 39, Line 24, Col 41, "Accessibility modifiers are not permitted on overrides or interface implementations")
(Error 941, Line 29, Col 40, Line 29, Col 42, "Accessibility modifiers are not permitted on overrides or interface implementations")
]
// SOURCE=E_OnOverrides01.fs SCFLAGS="--test:ErrorRanges" # E_OnOverrides01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_OnOverrides01.fs"|])>]
let ``E_OnOverrides01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 941, Line 13, Col 33, Line 13, Col 34, "Accessibility modifiers are not permitted on overrides or interface implementations")
(Error 941, Line 18, Col 34, Line 18, Col 35, "Accessibility modifiers are not permitted on overrides or interface implementations")
(Error 941, Line 23, Col 35, Line 23, Col 36, "Accessibility modifiers are not permitted on overrides or interface implementations")
]
// SOURCE=E_OnOverrides02.fs SCFLAGS="--test:ErrorRanges" # E_OnOverrides02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_OnOverrides02.fs"|])>]
let ``E_OnOverrides02_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 941, Line 14, Col 28, Line 14, Col 29, "Accessibility modifiers are not permitted on overrides or interface implementations")
(Error 941, Line 20, Col 28, Line 20, Col 29, "Accessibility modifiers are not permitted on overrides or interface implementations")
(Error 941, Line 26, Col 28, Line 26, Col 29, "Accessibility modifiers are not permitted on overrides or interface implementations")
]
// SOURCE=E_OnOverrides03.fs SCFLAGS="--test:ErrorRanges" # E_OnOverrides03.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_OnOverrides03.fs"|])>]
let ``E_OnOverrides03_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 941, Line 15, Col 28, Line 15, Col 29, "Accessibility modifiers are not permitted on overrides or interface implementations")
(Error 941, Line 21, Col 28, Line 21, Col 29, "Accessibility modifiers are not permitted on overrides or interface implementations")
(Error 941, Line 27, Col 28, Line 27, Col 29, "Accessibility modifiers are not permitted on overrides or interface implementations")
]
// SOURCE=E_OnOverrides04.fs SCFLAGS="--test:ErrorRanges" # E_OnOverrides04.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_OnOverrides04.fs"|])>]
let ``E_OnOverrides04_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 941, Line 14, Col 28, Line 14, Col 29, "Accessibility modifiers are not permitted on overrides or interface implementations")
(Error 941, Line 20, Col 28, Line 20, Col 29, "Accessibility modifiers are not permitted on overrides or interface implementations")
(Error 941, Line 26, Col 28, Line 26, Col 29, "Accessibility modifiers are not permitted on overrides or interface implementations")
]
// SOURCE=E_OnOverrides05.fs SCFLAGS="--test:ErrorRanges" # E_OnOverrides05.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_OnOverrides05.fs"|])>]
let ``E_OnOverrides05_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 941, Line 19, Col 28, Line 19, Col 29, "Accessibility modifiers are not permitted on overrides or interface implementations")
]
......@@ -16,4 +16,4 @@ end
let r1 = DerivedClass().SomeMethod()
let r2 = DerivedClass.AnotherMethod()
exit <| if r1 <> 3 && r2 <> 4 then 1 else 0
if r1 <> 3 && r2 <> 4 then failwith "Failed: 1"
......@@ -12,6 +12,6 @@ end
try
let r1 = DerivedClass().SomeMethod()
let r2 = DerivedClass.AnotherMethod()
exit <| if r1 <> 3 && r2 <> 3 then 1 else 0
if r1 <> 3 && r2 <> 3 then failwith "Failed: 1"
with
| :? System.MethodAccessException -> exit 1
| :? System.MethodAccessException -> 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.DeclarationElements.AccessibilityAnnotations
open Xunit
open FSharp.Test
open FSharp.Test.Compiler
module OnTypeMembers =
let verifyCompile compilation =
compilation
|> asExe
|> withOptions ["--nowarn:988"]
|> compile
let verifyCompileAndRun compilation =
compilation
|> asExe
|> withOptions ["--nowarn:988"]
|> compileAndRun
// SOURCE=AccessProtectedStatic01.fs SCFLAGS="-r:BaseClass.dll" PRECMD="\$CSC_PIPE /target:library BaseClass.cs" # AccessProtectedStatic01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AccessProtectedStatic01.fs"|])>]
let ``AccessProtectedStatic01_fs`` compilation =
let lib =
CSharpFromPath (__SOURCE_DIRECTORY__ ++ "BaseClass.cs")
|> withName "ReadWriteLib"
compilation
|> withReferences [lib]
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=E_AccessProtectedInstance01.fs SCFLAGS="-r:BaseClass.dll --test:ErrorRanges" PRECMD="\$CSC_PIPE /target:library BaseClass.cs" # AccessProtectedInstance01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AccessProtectedInstance01.fs"|])>]
let ``AccessProtectedInstance01_fs`` compilation =
let lib =
CSharpFromPath (__SOURCE_DIRECTORY__ ++ "BaseClass.cs")
|> withName "ReadWriteLib"
compilation
|> withReferences [lib]
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=E_AccessPrivateMember01.fs SCFLAGS="--test:ErrorRanges" # E_AccessPrivateMember01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AccessPrivateMember01.fs"|])>]
let ``E_AccessPrivateMember01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Warning 1178, Line 9, Col 10, Line 9, Col 17, "The struct, record or union type 'SpecSet' is not structurally comparable because the type 'SpecMulti' does not satisfy the 'comparison' constraint. Consider adding the 'NoComparison' attribute to the type 'SpecSet' to clarify that the type is not comparable")
(Error 491, Line 14, Col 13, Line 14, Col 28, "The member or object constructor 'Impl' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.")
]
// SOURCE=E_OnProperty01.fs # E_OnProperty01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_OnProperty01.fs"|])>]
let ``E_OnProperty01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 491, Line 42, Col 1, Line 42, Col 6, "The member or object constructor 'Foo' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.")
(Error 491, Line 42, Col 9, Line 42, Col 16, "The member or object constructor 'test1' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.")
(Error 491, Line 42, Col 19, Line 42, Col 26, "The member or object constructor 'test2' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.")
(Error 491, Line 42, Col 29, Line 42, Col 36, "The member or object constructor 'test5' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.")
(Error 491, Line 42, Col 40, Line 42, Col 47, "The member or object constructor 'test6' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.")
(Error 807, Line 42, Col 60, Line 42, Col 67, "Property 'test8' is not readable")
(Error 491, Line 43, Col 1, Line 43, Col 13, "The member or object constructor 'test3' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.")
(Error 491, Line 44, Col 1, Line 44, Col 13, "The member or object constructor 'test4' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.")
(Error 491, Line 45, Col 1, Line 45, Col 13, "The member or object constructor 'test5' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.")
(Error 491, Line 46, Col 1, Line 46, Col 13, "The member or object constructor 'test6' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.")
(Error 810, Line 47, Col 1, Line 47, Col 8, "Property 'test7' cannot be set")
(Error 257, Line 47, Col 1, Line 47, Col 8, "Invalid mutation of a constant expression. Consider copying the expression to a mutable local, e.g. 'let mutable x = ...'.")
]
// SOURCE=E_OnProperty02.fs SCFLAGS="--test:ErrorRanges" # E_OnProperty02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_OnProperty02.fs"|])>]
let ``E_OnProperty02_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 10, Line 15, Col 49, Line 15, Col 50, "Unexpected symbol ')' in pattern")
(Error 1244, Line 15, Col 48, Line 15, Col 50, "Attempted to parse this as an operator name, but failed")
(Error 558, Line 16, Col 36, Line 16, Col 50, "Multiple accessibilities given for property getter or setter")
(Error 558, Line 19, Col 35, Line 19, Col 56, "Multiple accessibilities given for property getter or setter")
(Error 10, Line 20, Col 49, Line 20, Col 50, "Unexpected identifier in pattern")
(Error 1244, Line 20, Col 48, Line 20, Col 57, "Attempted to parse this as an operator name, but failed")
(Error 10, Line 23, Col 36, Line 23, Col 42, "Unexpected keyword 'public' in member definition")
]
// SOURCE=OnProperty01.fs # OnProperty01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"OnProperty01.fs"|])>]
let ``OnProperty01_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.AccessibilityAnnotations
open Xunit
open FSharp.Test
open FSharp.Test.Compiler
module PermittedLocations =
let verifyCompile compilation =
compilation
|> asExe
|> withOptions ["--nowarn:988"]
|> compile
let verifyCompileAndRun compilation =
compilation
|> asExe
|> withOptions ["--nowarn:988"]
|> compileAndRun
// SOURCE=E_accessibilityOnInterface.fs SCFLAGS="--test:ErrorRanges" # E_accessibilityOnInterface.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_accessibilityOnInterface.fs"|])>]
let ``E_accessibilityOnInterface_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 561, Line 18, Col 5, Line 18, Col 62, "Accessibility modifiers are not allowed on this member. Abstract slots always have the same visibility as the enclosing type.")
(Error 561, Line 19, Col 5, Line 19, Col 62, "Accessibility modifiers are not allowed on this member. Abstract slots always have the same visibility as the enclosing type.")
(Error 561, Line 20, Col 5, Line 20, Col 62, "Accessibility modifiers are not allowed on this member. Abstract slots always have the same visibility as the enclosing type.")
(Error 10, Line 21, Col 14, Line 21, Col 20, "Unexpected keyword 'public' in member definition. Expected identifier, '(', '(*)' or other token.")
(Error 561, Line 21, Col 14, Line 22, Col 62, "Accessibility modifiers are not allowed on this member. Abstract slots always have the same visibility as the enclosing type.")
(Error 10, Line 23, Col 14, Line 23, Col 22, "Unexpected keyword 'internal' in member definition. Expected identifier, '(', '(*)' or other token.")
]
// SOURCE=E_accessibilityOnInterface01.fs SCFLAGS="--test:ErrorRanges" # E_accessibilityOnInterface01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_accessibilityOnInterface01.fs"|])>]
let ``E_accessibilityOnInterface01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 561, Line 13, Col 5, Line 13, Col 67, "Accessibility modifiers are not allowed on this member. Abstract slots always have the same visibility as the enclosing type.")
]
// SOURCE=E_accessibilityOnInterface02.fs SCFLAGS="--test:ErrorRanges" # E_accessibilityOnInterface02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_accessibilityOnInterface02.fs"|])>]
let ``E_accessibilityOnInterface02_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 561, Line 15, Col 5, Line 15, Col 68, "Accessibility modifiers are not allowed on this member. Abstract slots always have the same visibility as the enclosing type.")
]
// SOURCE=E_accessibilityOnInterface03.fs SCFLAGS="--test:ErrorRanges" # E_accessibilityOnInterface03.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_accessibilityOnInterface03.fs"|])>]
let ``E_accessibilityOnInterface03_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 561, Line 15, Col 5, Line 15, Col 69, "Accessibility modifiers are not allowed on this member. Abstract slots always have the same visibility as the enclosing type.")
]
// SOURCE=E_accessibilityOnInterface04.fs SCFLAGS="--test:ErrorRanges" # E_accessibilityOnInterface04.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_accessibilityOnInterface04.fs"|])>]
let ``E_accessibilityOnInterface04_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 10, Line 15, Col 14, Line 15, Col 20, "Unexpected keyword 'public' in member definition. Expected identifier, '(', '(*)' or other token.")
]
// SOURCE=E_accessibilityOnInterface05.fs SCFLAGS="--test:ErrorRanges" # E_accessibilityOnInterface05.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_accessibilityOnInterface05.fs"|])>]
let ``E_accessibilityOnInterface05_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 10, Line 15, Col 14, Line 15, Col 21, "Unexpected keyword 'private' in member definition. Expected identifier, '(', '(*)' or other token.")
]
// SOURCE=E_accessibilityOnInterface06.fs SCFLAGS="--test:ErrorRanges" # E_accessibilityOnInterface06.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_accessibilityOnInterface06.fs"|])>]
let ``E_accessibilityOnInterface06_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 10, Line 15, Col 14, Line 15, Col 22, "Unexpected keyword 'internal' in member definition. Expected identifier, '(', '(*)' or other token.")
]
// SOURCE=E_accessibilityOnRecords.fs SCFLAGS="--test:ErrorRanges" # E_accessibilityOnRecords.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_accessibilityOnRecords.fs"|])>]
let ``E_accessibilityOnRecords_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 575, Line 10, Col 21, Line 10, Col 41, "Accessibility modifiers are not permitted on record fields. Use 'type R = internal ...' or 'type R = private ...' to give an accessibility to the whole representation.")
(Error 575, Line 11, Col 21, Line 11, Col 39, "Accessibility modifiers are not permitted on record fields. Use 'type R = internal ...' or 'type R = private ...' to give an accessibility to the whole representation.")
(Error 575, Line 12, Col 21, Line 12, Col 37, "Accessibility modifiers are not permitted on record fields. Use 'type R = internal ...' or 'type R = private ...' to give an accessibility to the whole representation.")
]
// SOURCE=E_accessibilityOnRecords02.fs SCFLAGS="--test:ErrorRanges" # E_accessibilityOnRecords02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_accessibilityOnRecords02.fs"|])>]
let ``E_accessibilityOnRecords02_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 575, Line 8, Col 13, Line 8, Col 28, "Accessibility modifiers are not permitted on record fields. Use 'type R = internal ...' or 'type R = private ...' to give an accessibility to the whole representation.")
]
// SOURCE=E_orderingOfAccessibilityKeyword_let01.fs SCFLAGS="--test:ErrorRanges" # E_orderingOfAccessibilityKeyword_let01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_orderingOfAccessibilityKeyword_let01.fs"|])>]
let ``E_orderingOfAccessibilityKeyword_let01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 531, Line 11, Col 13, Line 11, Col 20, "Accessibility modifiers should come immediately prior to the identifier naming a construct")
(Warning 58, Line 12, Col 23, Line 12, Col 26, "Possible incorrect indentation: this token is offside of context started at position (11:23). Try indenting this token further or using standard formatting conventions.")
(Error 531, Line 12, Col 13, Line 12, Col 19, "Accessibility modifiers should come immediately prior to the identifier naming a construct")
(Warning 58, Line 13, Col 23, Line 13, Col 26, "Possible incorrect indentation: this token is offside of context started at position (12:23). Try indenting this token further or using standard formatting conventions.")
(Error 531, Line 13, Col 13, Line 13, Col 21, "Accessibility modifiers should come immediately prior to the identifier naming a construct")
]
// SOURCE=E_orderingOfAccessibilityKeyword_member01.fs SCFLAGS="--test:ErrorRanges" # E_orderingOfAccessibilityKeyword_member01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_orderingOfAccessibilityKeyword_member01.fs"|])>]
let ``E_orderingOfAccessibilityKeyword_member01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 531, Line 8, Col 26, Line 8, Col 32, "Accessibility modifiers should come immediately prior to the identifier naming a construct")
]
// SOURCE=E_orderingOfAccessibilityKeyword_module01.fs SCFLAGS="--test:ErrorRanges" # E_orderingOfAccessibilityKeyword_module01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_orderingOfAccessibilityKeyword_module01.fs"|])>]
let ``E_orderingOfAccessibilityKeyword_module01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 531, Line 6, Col 1, Line 6, Col 7, "Accessibility modifiers should come immediately prior to the identifier naming a construct")
]
// SOURCE=E_orderingOfAccessibilityKeyword_type01.fs SCFLAGS="--test:ErrorRanges" # E_orderingOfAccessibilityKeyword_type01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_orderingOfAccessibilityKeyword_type01.fs"|])>]
let ``E_orderingOfAccessibilityKeyword_type01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 531, Line 8, Col 13, Line 8, Col 20, "Accessibility modifiers should come immediately prior to the identifier naming a construct")
]
......@@ -32,9 +32,10 @@
<Compile Include="Conformance\ClassTypes\ExplicitObjectConstructors\ExplicitObjectConstructors.fs" />
<Compile Include="Conformance\ClassTypes\ImplicitObjectConstructors\ImplicitObjectConstructors.fs" />
<Compile Include="Conformance\ClassTypes\ValueRestriction\ValueRestriction.fs" />
<Compile Include="Conformance\DeclarationElements\LetBindings\ActivePatternBindings\ActivePatternBindings.fs" />
<Compile Include="Conformance\DeclarationElements\LetBindings\Basic\Basic.fs" />
<Compile Include="Conformance\DeclarationElements\LetBindings\ExplicitTypeParameters\ExplicitTypeParameters.fs" />
<Compile Include="Conformance\DeclarationElements\AccessibilityAnnotations\Basic\Basic.fs" />
<Compile Include="Conformance\DeclarationElements\AccessibilityAnnotations\OnOverridesAndIFaceImpl\OnOverridesAndIFaceImpl.fs" />
<Compile Include="Conformance\DeclarationElements\AccessibilityAnnotations\OnTypeMembers\OnTypeMembers.fs" />
<Compile Include="Conformance\DeclarationElements\AccessibilityAnnotations\PermittedLocations\PermittedLocations.fs" />
<Compile Include="Conformance\DeclarationElements\LetBindings\TypeFunctions\TypeFunctions.fs" />
<Compile Include="Conformance\DeclarationElements\UseBindings\UseBindings.fs" />
<Compile Include="Conformance\Expressions\ApplicationExpressions\BasicApplication\BasicApplication.fs" />
......@@ -157,6 +158,9 @@
<None Include="**\*.cs;**\*.fs;**\*.fsx;**\*.fsi;" Exclude="@(Compile)">
<Link>%(RelativeDir)\TestSource\%(Filename)%(Extension)</Link>
</None>
<None Include="**\*.cs;**\*.fs;**\*.fsx;**\*.fsi" Exclude="@(Compile)">
<Link>%(RelativeDir)\TestSource\%(Filename)%(Extension)</Link>
</None>
<None Include="**\*.bsl">
<Link>%(RelativeDir)\BaseLine\%(Filename)%(Extension)</Link>
</None>
......
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace FSharp.Compiler.ComponentTests.Conformance.DeclarationElements.AccessibilityAnnotations
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=E_InterfaceImpl01.fs SCFLAGS="--test:ErrorRanges" # E_InterfaceImpl01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_InterfaceImpl01.fs"|])>]
let ``E_InterfaceImpl01.fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 410, Line 5, Col 19, Line 5, Col 20, "The type 'A' is less accessible than the value, member or type 'x' it is used in.")
]
// SOURCE=E_OnOverrides01.fs SCFLAGS="--test:ErrorRanges" # E_OnOverrides01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_OnOverrides01.fs"|])>]
let ``E_OnOverrides01.fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 410, Line 5, Col 19, Line 5, Col 20, "The type 'A' is less accessible than the value, member or type 'x' it is used in.")
]
// SOURCE=E_OnOverrides02.fs SCFLAGS="--test:ErrorRanges" # E_OnOverrides02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_OnOverrides02.fs"|])>]
let ``E_OnOverrides02.fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 410, Line 5, Col 19, Line 5, Col 20, "The type 'A' is less accessible than the value, member or type 'x' it is used in.")
]
// SOURCE=E_OnOverrides03.fs SCFLAGS="--test:ErrorRanges" # E_OnOverrides03.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_OnOverrides03.fs"|])>]
let ``E_OnOverrides03.fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 410, Line 5, Col 19, Line 5, Col 20, "The type 'A' is less accessible than the value, member or type 'x' it is used in.")
]
// SOURCE=E_OnOverrides04.fs SCFLAGS="--test:ErrorRanges" # E_OnOverrides04.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_OnOverrides04.fs"|])>]
let ``E_OnOverrides04.fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 410, Line 5, Col 19, Line 5, Col 20, "The type 'A' is less accessible than the value, member or type 'x' it is used in.")
]
// SOURCE=E_OnOverrides05.fs SCFLAGS="--test:ErrorRanges" # E_OnOverrides05.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_OnOverrides05.fs"|])>]
let ``E_OnOverrides05.fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 410, Line 5, Col 19, Line 5, Col 20, "The type 'A' is less accessible than the value, member or type 'x' it is used in.")
]
SOURCE=E_InterfaceImpl01.fs SCFLAGS="--test:ErrorRanges" # E_InterfaceImpl01.fs
SOURCE=E_OnOverrides01.fs SCFLAGS="--test:ErrorRanges" # E_OnOverrides01.fs
SOURCE=E_OnOverrides02.fs SCFLAGS="--test:ErrorRanges" # E_OnOverrides02.fs
SOURCE=E_OnOverrides03.fs SCFLAGS="--test:ErrorRanges" # E_OnOverrides03.fs
SOURCE=E_OnOverrides04.fs SCFLAGS="--test:ErrorRanges" # E_OnOverrides04.fs
SOURCE=E_OnOverrides05.fs SCFLAGS="--test:ErrorRanges" # E_OnOverrides05.fs
SOURCE=OnProperty01.fs # OnProperty01.fs
SOURCE=E_OnProperty01.fs # E_OnProperty01.fs
SOURCE=E_OnProperty02.fs SCFLAGS="--test:ErrorRanges" # E_OnProperty02.fs
SOURCE=AccessProtectedStatic01.fs SCFLAGS="-r:BaseClass.dll" PRECMD="\$CSC_PIPE /target:library BaseClass.cs" # AccessProtectedStatic01.fs
SOURCE=E_AccessProtectedInstance01.fs SCFLAGS="-r:BaseClass.dll --test:ErrorRanges" PRECMD="\$CSC_PIPE /target:library BaseClass.cs" # AccessProtectedInstance01.fs
SOURCE=E_AccessPrivateMember01.fs SCFLAGS="--test:ErrorRanges" # E_AccessPrivateMember01.fs
\ No newline at end of file
#
# Disabling until it is clear what the behavior is on multiple errors...
# SOURCE=E_accessibilityOnInterface.fs SCFLAGS="--test:ErrorRanges" # E_accessibilityOnInterface.fs
#
SOURCE=E_accessibilityOnRecords.fs SCFLAGS="--test:ErrorRanges" # E_accessibilityOnRecords.fs
SOURCE=E_accessibilityOnRecords02.fs SCFLAGS="--test:ErrorRanges" # E_accessibilityOnRecords02.fs
SOURCE=E_orderingOfAccessibilityKeyword_let01.fs SCFLAGS="--test:ErrorRanges" # E_orderingOfAccessibilityKeyword_let01.fs
SOURCE=E_orderingOfAccessibilityKeyword_member01.fs SCFLAGS="--test:ErrorRanges" # E_orderingOfAccessibilityKeyword_member01.fs
SOURCE=E_orderingOfAccessibilityKeyword_module01.fs SCFLAGS="--test:ErrorRanges" # E_orderingOfAccessibilityKeyword_module01.fs
SOURCE=E_orderingOfAccessibilityKeyword_type01.fs SCFLAGS="--test:ErrorRanges" # E_orderingOfAccessibilityKeyword_type01.fs
SOURCE=E_accessibilityOnInterface01.fs SCFLAGS="--test:ErrorRanges" # E_accessibilityOnInterface01.fs
SOURCE=E_accessibilityOnInterface02.fs SCFLAGS="--test:ErrorRanges" # E_accessibilityOnInterface02.fs
SOURCE=E_accessibilityOnInterface03.fs SCFLAGS="--test:ErrorRanges" # E_accessibilityOnInterface03.fs
SOURCE=E_accessibilityOnInterface04.fs SCFLAGS="--test:ErrorRanges" # E_accessibilityOnInterface04.fs
SOURCE=E_accessibilityOnInterface05.fs SCFLAGS="--test:ErrorRanges" # E_accessibilityOnInterface05.fs
SOURCE=E_accessibilityOnInterface06.fs SCFLAGS="--test:ErrorRanges" # E_accessibilityOnInterface06.fs
SOURCE=E_BaseIFaceLessAccessible01.fs SCFLAGS="-a --test:ErrorRanges" # E_BaseIFaceLessAccessible01.fs
SOURCE=InternalizedIFaces02.fs SCFLAGS="-a --warnaserror" # InternalizedIFaces02.fs
SOURCE=LocalLetBinding01.fs SCFLAGS="-a --test:ErrorRanges" # LocalLetBinding01.fs
SOURCE=E_LocalLetBinding02.fs SCFLAGS="--test:ErrorRanges" # E_LocalLetBinding02.fs
SOURCE=E_privateThingsInaccessible.fs # E_PrivateThingsInaccessible.fs
SOURCE=E_privateThingsInaccessible02.fs SCFLAGS="--test:ErrorRanges" # E_PrivateThingsInaccessible02.fs
SOURCE=E_privateThingsInaccessible03.fs SCFLAGS="--test:ErrorRanges" # E_PrivateThingsInaccessible03.fs
SOURCE=E_privateThingsInaccessible04.fs SCFLAGS="--test:ErrorRanges" # E_PrivateThingsInaccessible04.fs
SOURCE=E_privateThingsInaccessible05.fs SCFLAGS="--test:ErrorRanges" # E_PrivateThingsInaccessible05.fs
SOURCE=internalMethodsWorkCorrectly.fs # InternalMethodsWorkCorrectly.fs
SOURCE=E_PrivateImplicitCtor01.fs SCFLAGS="--test:ErrorRanges" # E_PrivateImplicitCtor01.fs
SOURCE=E_ExposeLessVisible01.fs # E_ExposeLessVisible01.fs
SOURCE=LessOrMoreAccessibleCode01.fs # LessOrMoreAccessibleCode01.fs
SOURCE=E_ProtectedThingsInaccessible01.fs SCFLAGS="--test:ErrorRanges" # E_ProtectedThingsInaccessible01.fs
SOURCE=E_MoreAccessibleBaseClass01.fs # E_MoreAccessibleBaseClass01.fs
SOURCE=E_MoreAccessibleBaseClass02.fs # E_MoreAccessibleBaseClass02.fs
SOURCE=InterfaceImplementationVisibility.fs # InterfaceImplementationVisibility.fs
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册