Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
14fd06f
Allow using nested types in unqualified scenarios
TIHan Jun 20, 2020
eabfc6a
Renaming OpenStaticClasses to OpenTypeDeclaration
TIHan Jun 22, 2020
69f1328
Added 'open type' declaration
TIHan Jun 23, 2020
b5ecdd8
Added more tests
TIHan Jun 23, 2020
ed170c0
Fixing build
TIHan Jun 23, 2020
3987aea
Added tooling support
TIHan Jun 23, 2020
0ec3f63
More updates
TIHan Jun 23, 2020
f928b2f
Some refactor
TIHan Jun 24, 2020
e7bebce
open static prototype
dsyme Jun 24, 2020
23a9d3a
open static prototype
dsyme Jun 24, 2020
847345c
Merging master and Don's changes
TIHan Jun 24, 2020
5feed0a
Fixes on merge
TIHan Jun 24, 2020
d885764
Fixing build
TIHan Jun 24, 2020
6ebd971
Fixing some tests
TIHan Jun 24, 2020
4135fce
Trying to figure out nested
TIHan Jun 25, 2020
a3f16dc
Added eUnqualifiedTyconTypeArgs
TIHan Jun 28, 2020
d3e4bbf
Properly opening generic types with nested generic types
TIHan Jun 28, 2020
c4f9a93
Update test baseline
TIHan Jun 29, 2020
94c0892
Include range on target
TIHan Jun 29, 2020
3b37aa8
Fixing build
TIHan Jun 29, 2020
7d0a5c3
Fixing build
TIHan Jun 29, 2020
7169f9f
Fixing build
TIHan Jun 29, 2020
022a25b
Error if not an appty
TIHan Jun 29, 2020
0307cb8
Slightly better error
TIHan Jun 29, 2020
ad5734e
Getting tests to pass
TIHan Jun 29, 2020
eaca692
Trying to fix tests
TIHan Jun 29, 2020
ea6f8f7
Get current tests to pass
TIHan Jun 29, 2020
8308951
Partial working unused opens
TIHan Jun 30, 2020
faaec18
Almost there
TIHan Jun 30, 2020
df81cf5
Some fixed
TIHan Jun 30, 2020
0858beb
Reverting back to original service analysis
TIHan Jun 30, 2020
bd76d23
Fixed test
TIHan Jun 30, 2020
a7cb900
Fixed test
TIHan Jun 30, 2020
9fcdcf9
Fixed build
TIHan Jun 30, 2020
561616f
Fixing tests
TIHan Jul 1, 2020
110a37d
Fixing tests
TIHan Jul 1, 2020
55129fc
Fixing more tests
TIHan Jul 1, 2020
27c48be
Removing broken tests
TIHan Jul 1, 2020
82c9002
Added more tests. Checking for byrefs
TIHan Jul 8, 2020
270313d
More tests
TIHan Jul 9, 2020
45a5d10
More tests
TIHan Jul 9, 2020
e8c75aa
Update tests
TIHan Jul 9, 2020
e9fc47a
Rename
TIHan Jul 9, 2020
eeaa6c7
Better names
TIHan Jul 9, 2020
f21a4ee
Merge branch 'master' into feature/open-static-classes-cont
TIHan Jul 10, 2020
947e203
Added test case for inherited members
TIHan Jul 14, 2020
1118595
Added more tests with CSharp style extension members
TIHan Jul 14, 2020
4a33b19
Minor format
TIHan Jul 14, 2020
6b45af2
Minor updates
TIHan Jul 15, 2020
d4f3872
Fixing nested types
TIHan Jul 16, 2020
6eb8f07
Fixed nested types possibly
TIHan Jul 16, 2020
4d763b9
Trying to fix it
TIHan Jul 16, 2020
a14c805
Some cleanup
TIHan Jul 16, 2020
dc8152c
More cleanup
TIHan Jul 17, 2020
c4dcdae
Partial
TIHan Jul 17, 2020
dca1c6f
Partially working
TIHan Jul 17, 2020
29220ea
Fixed nested types
TIHan Jul 18, 2020
baee9d1
Fixing tests
TIHan Jul 18, 2020
d756a50
Removed NumStaticArgs
TIHan Jul 21, 2020
a315ffa
Rename AddEntties/OpenEntities to AddModuleOrNamespaceRefs/OpenModule…
TIHan Jul 21, 2020
05fa1cc
minor cleanup
TIHan Jul 21, 2020
2dd0fe3
Minor rename
TIHan Jul 22, 2020
35fca6c
Another rename
TIHan Jul 22, 2020
ddbce14
Update src/fsharp/symbols/Symbols.fs
TIHan Jul 23, 2020
9b90d4b
Trying to add type provider test
TIHan Jul 23, 2020
c800a08
Merge remote-tracking branch 'upstream/master' into feature/open-stat…
TIHan Jul 23, 2020
439046e
Remove type provider test for now
TIHan Jul 24, 2020
cf878b6
Merge branch 'feature/open-static-classes-cont' of github.com:TIHan/v…
TIHan Jul 24, 2020
8676130
Starting to convert tests
TIHan Jul 24, 2020
30f5704
More tests converted
TIHan Jul 24, 2020
32700ba
More tests converted
TIHan Jul 24, 2020
58821c0
more tests converted
TIHan Jul 24, 2020
2e40b29
Merge remote-tracking branch 'upstream/master' into feature/open-stat…
TIHan Jul 27, 2020
3d42c6d
Added type provider tests
TIHan Jul 28, 2020
5bad5b2
Added complex generic types with nested generic types
TIHan Jul 28, 2020
2babcd2
Added units of measure tests and named types
TIHan Jul 28, 2020
4189e26
Added more tests
TIHan Jul 29, 2020
3013fb7
Added two more tests
TIHan Jul 29, 2020
ea3003f
Added one more test
TIHan Jul 29, 2020
cc53b26
Added enum test case
TIHan Jul 30, 2020
a5c9657
Added enum tests and support
TIHan Jul 30, 2020
aa288fe
Adding union case support
TIHan Jul 31, 2020
97a22de
merging master
TIHan Aug 3, 2020
46602ff
Merged master
TIHan Aug 5, 2020
cf030ef
Removing unions support
TIHan Aug 5, 2020
72bae82
Fixing build
TIHan Aug 5, 2020
6eda4ce
Disallowing operators to come into scope
TIHan Aug 6, 2020
7e88f52
Minor refactoring
TIHan Aug 6, 2020
08731c5
Access to record labels and union cases
TIHan Aug 6, 2020
edab625
Fixing opening generic types
TIHan Aug 6, 2020
07bd541
Do not need to return enclosing type instantiations from a dot
TIHan Aug 6, 2020
6ec6a41
Added generic union and record tests
TIHan Aug 6, 2020
9d3b4bd
Combining intrinsic and extension method groups. Ignoring generic rec…
TIHan Aug 10, 2020
223edf5
Merge branch 'master' into feature/open-static-classes-cont
TIHan Aug 10, 2020
ff3975f
Update FSComp.txt.ja.xlf
TIHan Aug 10, 2020
5848087
Fixing build
TIHan Aug 10, 2020
1151da5
Update OpenTypeDeclarationTests.fs
TIHan Aug 10, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/fsharp/CompileOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5635,7 +5635,7 @@ let GetInitialTcEnv (thisAssemblyName: string, initm: range, tcConfig: TcConfig,
let tcEnv = CreateInitialTcEnv(tcGlobals, amap, initm, thisAssemblyName, ccus)

if tcConfig.checkOverflow then
try TcOpenDecl TcResultsSink.NoSink tcGlobals amap initm initm tcEnv (pathToSynLid initm (splitNamespace FSharpLib.CoreOperatorsCheckedName))
try TcOpenModuleOrNamespaceDecl TcResultsSink.NoSink tcGlobals amap initm tcEnv (pathToSynLid initm (splitNamespace FSharpLib.CoreOperatorsCheckedName), initm)
with e -> errorRecovery e initm; tcEnv
else
tcEnv
Expand Down Expand Up @@ -5792,7 +5792,7 @@ let TypeCheckOneInputEventually (checkForErrors, tcConfig: TcConfig, tcImports:
| None -> tcEnv
| Some prefixPath ->
let m = qualNameOfFile.Range
TcOpenDecl tcSink tcGlobals amap m m tcEnv prefixPath
TcOpenModuleOrNamespaceDecl tcSink tcGlobals amap m tcEnv (prefixPath, m)

let tcState =
{ tcState with
Expand Down Expand Up @@ -5840,13 +5840,13 @@ let TypeCheckOneInputEventually (checkForErrors, tcConfig: TcConfig, tcImports:
// Open the prefixPath for fsi.exe (tcImplEnv)
let tcImplEnv =
match prefixPathOpt with
| Some prefixPath -> TcOpenDecl tcSink tcGlobals amap m m tcImplEnv prefixPath
| Some prefixPath -> TcOpenModuleOrNamespaceDecl tcSink tcGlobals amap m tcImplEnv (prefixPath, m)
| _ -> tcImplEnv

// Open the prefixPath for fsi.exe (tcSigEnv)
let tcSigEnv =
match prefixPathOpt with
| Some prefixPath when not hadSig -> TcOpenDecl tcSink tcGlobals amap m m tcSigEnv prefixPath
| Some prefixPath when not hadSig -> TcOpenModuleOrNamespaceDecl tcSink tcGlobals amap m tcSigEnv (prefixPath, m)
| _ -> tcSigEnv

let ccuSig = CombineCcuContentFragments m [implFileSigType; tcState.tcsCcuSig ]
Expand Down
4 changes: 2 additions & 2 deletions src/fsharp/ConstraintSolver.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2799,8 +2799,8 @@ and ResolveOverloading

// Static IL interfaces methods are not supported in lower F# versions.
if calledMeth.Method.IsILMethod && not calledMeth.Method.IsInstance && isInterfaceTy g calledMeth.Method.ApparentEnclosingType then
tryLanguageFeatureRuntimeErrorRecover csenv.InfoReader LanguageFeature.DefaultInterfaceMemberConsumption m
tryLanguageFeatureErrorRecover g.langVersion LanguageFeature.DefaultInterfaceMemberConsumption m
checkLanguageFeatureRuntimeErrorRecover csenv.InfoReader LanguageFeature.DefaultInterfaceMemberConsumption m
checkLanguageFeatureErrorRecover g.langVersion LanguageFeature.DefaultInterfaceMemberConsumption m

calledMethOpt,
trackErrors {
Expand Down
4 changes: 2 additions & 2 deletions src/fsharp/ErrorLogger.fs
Original file line number Diff line number Diff line change
Expand Up @@ -691,12 +691,12 @@ let private tryLanguageFeatureErrorAux (langVersion: LanguageVersion) (langFeatu
else
None

let internal tryLanguageFeatureError langVersion langFeature m =
let internal checkLanguageFeatureError langVersion langFeature m =
match tryLanguageFeatureErrorAux langVersion langFeature m with
| Some e -> error (e)
| None -> ()

let internal tryLanguageFeatureErrorRecover langVersion langFeature m =
let internal checkLanguageFeatureErrorRecover langVersion langFeature m =
match tryLanguageFeatureErrorAux langVersion langFeature m with
| Some e -> errorR e
| None -> ()
Expand Down
3 changes: 2 additions & 1 deletion src/fsharp/FSComp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1480,6 +1480,7 @@ notAFunctionButMaybeDeclaration,"This value is not a function and cannot be appl
3247,couldNotLoadDependencyManagerExtension,"The dependency manager extension %s could not be loaded. Message: %s"
3250,expressionHasNoName,"Expression does not have a name."
3251,chkNoFirstClassNameOf,"Using the 'nameof' operator as a first-class function value is not permitted."
3252,tcIllegalByrefsInOpenTypeDeclaration,"Byref types are not allowed in an open type declaration."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
3252,tcIllegalByrefsInOpenTypeDeclaration,"Byref types are not allowed in an open type declaration."
3252,tcIllegalByrefsInOpenTypeDeclaration,"Byref types are not allowed in an 'open type' declaration."

3300,chkInvalidFunctionParameterType,"The parameter '%s' has an invalid type '%s'. This is not permitted by the rules of Common IL."
3301,chkInvalidFunctionReturnType,"The function or method has an invalid return type '%s'. This is not permitted by the rules of Common IL."
3302,packageManagementRequiresVFive,"The package management feature requires language version 5.0 use /langversion:preview"
Expand All @@ -1502,7 +1503,7 @@ featureWildCardInForLoop,"wild card in for loop"
featureRelaxWhitespace,"whitespace relexation"
featureNameOf,"nameof"
featureImplicitYield,"implicit yield"
featureOpenStaticClasses,"open static classes"
featureOpenTypeDeclaration,"open type declaration"
featureDotlessFloat32Literal,"dotless float32 literal"
featurePackageManagement,"package management"
featureFromEndSlicing,"from-end slicing"
Expand Down
12 changes: 8 additions & 4 deletions src/fsharp/InfoReader.fs
Original file line number Diff line number Diff line change
Expand Up @@ -571,9 +571,15 @@ let private tryLanguageFeatureRuntimeErrorAux (infoReader: InfoReader) langFeatu
if not (infoReader.IsLanguageFeatureRuntimeSupported langFeature) then
let featureStr = infoReader.g.langVersion.GetFeatureString langFeature
error (Error(FSComp.SR.chkFeatureNotRuntimeSupported featureStr, m))
false
else
true

let tryLanguageFeatureRuntimeError infoReader langFeature m =
tryLanguageFeatureRuntimeErrorAux infoReader langFeature m error
let checkLanguageFeatureRuntimeError infoReader langFeature m =
tryLanguageFeatureRuntimeErrorAux infoReader langFeature m error |> ignore

let checkLanguageFeatureRuntimeErrorRecover infoReader langFeature m =
tryLanguageFeatureRuntimeErrorAux infoReader langFeature m errorR |> ignore

let tryLanguageFeatureRuntimeErrorRecover infoReader langFeature m =
tryLanguageFeatureRuntimeErrorAux infoReader langFeature m errorR
Expand Down Expand Up @@ -922,5 +928,3 @@ let PropTypOfEventInfo (infoReader: InfoReader) m ad (einfo: EventInfo) =
let delTy = einfo.GetDelegateType(amap, m)
let argsTy = ArgsTypOfEventInfo infoReader m ad einfo
mkIEventType g delTy argsTy


6 changes: 3 additions & 3 deletions src/fsharp/LanguageFeatures.fs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type LanguageFeature =
| RelaxWhitespace
| NameOf
| ImplicitYield
| OpenStaticClasses
| OpenTypeDeclaration
| DotlessFloat32Literal
| PackageManagement
| FromEndSlicing
Expand Down Expand Up @@ -67,7 +67,7 @@ type LanguageVersion (specifiedVersionAsString) =

// F# preview
LanguageFeature.FromEndSlicing, previewVersion
LanguageFeature.OpenStaticClasses, previewVersion
LanguageFeature.OpenTypeDeclaration, previewVersion
LanguageFeature.PackageManagement, previewVersion
LanguageFeature.WitnessPassing, previewVersion
LanguageFeature.InterfacesWithMultipleGenericInstantiation, previewVersion
Expand Down Expand Up @@ -133,7 +133,7 @@ type LanguageVersion (specifiedVersionAsString) =
| LanguageFeature.RelaxWhitespace -> FSComp.SR.featureRelaxWhitespace()
| LanguageFeature.NameOf -> FSComp.SR.featureNameOf()
| LanguageFeature.ImplicitYield -> FSComp.SR.featureImplicitYield()
| LanguageFeature.OpenStaticClasses -> FSComp.SR.featureOpenStaticClasses()
| LanguageFeature.OpenTypeDeclaration -> FSComp.SR.featureOpenTypeDeclaration()
| LanguageFeature.DotlessFloat32Literal -> FSComp.SR.featureDotlessFloat32Literal()
| LanguageFeature.PackageManagement -> FSComp.SR.featurePackageManagement()
| LanguageFeature.FromEndSlicing -> FSComp.SR.featureFromEndSlicing()
Expand Down
2 changes: 1 addition & 1 deletion src/fsharp/LanguageFeatures.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type LanguageFeature =
| RelaxWhitespace
| NameOf
| ImplicitYield
| OpenStaticClasses
| OpenTypeDeclaration
| DotlessFloat32Literal
| PackageManagement
| FromEndSlicing
Expand Down
4 changes: 2 additions & 2 deletions src/fsharp/MethodCalls.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1752,8 +1752,8 @@ let ILFieldStaticChecks g amap infoReader ad m (finfo : ILFieldInfo) =

// Static IL interfaces fields are not supported in lower F# versions.
if isInterfaceTy g finfo.ApparentEnclosingType then
tryLanguageFeatureRuntimeErrorRecover infoReader LanguageFeature.DefaultInterfaceMemberConsumption m
tryLanguageFeatureErrorRecover g.langVersion LanguageFeature.DefaultInterfaceMemberConsumption m
checkLanguageFeatureRuntimeErrorRecover infoReader LanguageFeature.DefaultInterfaceMemberConsumption m
checkLanguageFeatureErrorRecover g.langVersion LanguageFeature.DefaultInterfaceMemberConsumption m

CheckILFieldAttributes g finfo m

Expand Down
4 changes: 2 additions & 2 deletions src/fsharp/MethodOverrides.fs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ module DispatchSlotChecking =

// Always try to raise a target runtime error if we have a DIM.
if reqdSlot.HasDefaultInterfaceImplementation then
tryLanguageFeatureRuntimeErrorRecover infoReader LanguageFeature.DefaultInterfaceMemberConsumption m
checkLanguageFeatureRuntimeErrorRecover infoReader LanguageFeature.DefaultInterfaceMemberConsumption m

let maybeResolvedSlot =
NameMultiMap.find dispatchSlot.LogicalName overridesKeyed
Expand All @@ -329,7 +329,7 @@ module DispatchSlotChecking =
then
// Always try to raise a language version error if we have a DIM that is not explicitly implemented.
if reqdSlot.HasDefaultInterfaceImplementation then
tryLanguageFeatureErrorRecover g.langVersion LanguageFeature.DefaultInterfaceMemberConsumption m
checkLanguageFeatureErrorRecover g.langVersion LanguageFeature.DefaultInterfaceMemberConsumption m

if reqdSlot.PossiblyNoMostSpecificImplementation then
errorR(Error(FSComp.SR.typrelInterfaceMemberNoMostSpecificImplementation(NicePrint.stringOfMethInfo amap m denv dispatchSlot), m))
Expand Down
Loading