@@ -455,7 +455,7 @@ module TcRecdUnionAndEnumDeclarations =
455
455
let ValidateFieldNames ( synFields : SynField list , tastFields : RecdField list ) =
456
456
let seen = Dictionary()
457
457
( synFields, tastFields) ||> List.iter2 ( fun sf f ->
458
- match seen.TryGetValue f.Name with
458
+ match seen.TryGetValue f.LogicalName with
459
459
| true , synField ->
460
460
match sf, synField with
461
461
| SynField(_, _, Some id, _, _, _, _, _), SynField(_, _, Some _, _, _, _, _, _) ->
@@ -465,7 +465,7 @@ module TcRecdUnionAndEnumDeclarations =
465
465
error( Error( FSComp.SR.tcFieldNameConflictsWithGeneratedNameForAnonymousField( id.idText), id.idRange))
466
466
| _ -> assert false
467
467
| _ ->
468
- seen.Add( f.Name , sf))
468
+ seen.Add( f.LogicalName , sf))
469
469
470
470
let TcUnionCaseDecl cenv env parent thisTy thisTyInst tpenv ( SynUnionCase ( Attributes synAttrs , id , args , xmldoc , vis , m )) =
471
471
let attrs = TcAttributes cenv env AttributeTargets.UnionCaseDecl synAttrs // the attributes of a union case decl get attached to the generated "static factory" method
@@ -503,7 +503,7 @@ module TcRecdUnionAndEnumDeclarations =
503
503
if not ( typeEquiv cenv.g recordTy thisTy) then
504
504
error( Error( FSComp.SR.tcReturnTypesForUnionMustBeSameAsType(), m))
505
505
rfields, recordTy
506
- let names = rfields |> List.map ( fun f -> f.Name )
506
+ let names = rfields |> List.map ( fun f -> f.DisplayNameCore )
507
507
let doc = xmldoc.ToXmlDoc( true , Some names)
508
508
Construct.NewUnionCase id rfields recordTy attrs doc vis
509
509
@@ -1379,7 +1379,7 @@ module IncrClassChecking =
1379
1379
[ for b in memberBinds do
1380
1380
yield b.Var.CompiledName cenv.g.CompilerGlobalState
1381
1381
yield b.Var.DisplayName
1382
- yield b.Var.CoreDisplayName
1382
+ yield b.Var.DisplayNameCoreMangled
1383
1383
yield b.Var.LogicalName ]
1384
1384
let reps = IncrClassReprInfo.Empty( g, takenFieldNames)
1385
1385
@@ -2040,7 +2040,7 @@ module MutRecBindingChecking =
2040
2040
2041
2041
if needsSafeStaticInit && hasStaticBindings then
2042
2042
let rfield = MakeSafeInitField g envForDecls tcref.Range true
2043
- SafeInitField( mkRecdFieldRef tcref rfield.Name , rfield)
2043
+ SafeInitField( mkRecdFieldRef tcref rfield.LogicalName , rfield)
2044
2044
else
2045
2045
NoSafeInitInfo
2046
2046
@@ -3147,7 +3147,7 @@ module EstablishTypeDefinitionCores =
3147
3147
if InstanceMembersNeedSafeInitCheck cenv m thisTy then
3148
3148
let rfield = MakeSafeInitField cenv.g env m false
3149
3149
let tcref = tcrefOfAppTy cenv.g thisTy
3150
- SafeInitField ( mkRecdFieldRef tcref rfield.Name , rfield)
3150
+ SafeInitField ( mkRecdFieldRef tcref rfield.LogicalName , rfield)
3151
3151
else
3152
3152
NoSafeInitInfo
3153
3153
@@ -3321,7 +3321,7 @@ module EstablishTypeDefinitionCores =
3321
3321
if not inSig && not hasMeasureAttr then
3322
3322
errorR( Error( FSComp.SR.tcTypeRequiresDefinition(), m))
3323
3323
if hasMeasureAttr then
3324
- TFSharpObjectRepr { fsobjmodel_ kind = TTyconClass
3324
+ TFSharpObjectRepr { fsobjmodel_ kind = TFSharpClass
3325
3325
fsobjmodel_ vslots = []
3326
3326
fsobjmodel_ rfields = Construct.MakeRecdFieldsTable [] }
3327
3327
else
@@ -3353,7 +3353,7 @@ module EstablishTypeDefinitionCores =
3353
3353
InferTyconKind cenv.g ( SynTypeDefnKind.Record, attrs, [], [], inSig, true , m) |> ignore
3354
3354
3355
3355
// Note: the table of record fields is initially empty
3356
- TRecdRepr ( Construct.MakeRecdFieldsTable [])
3356
+ TFSharpRecdRepr ( Construct.MakeRecdFieldsTable [])
3357
3357
3358
3358
| SynTypeDefnSimpleRepr.General ( kind, _, slotsigs, fields, isConcrete, _, _, _) ->
3359
3359
let kind = InferTyconKind cenv.g ( kind, attrs, slotsigs, fields, inSig, isConcrete, m)
@@ -3363,10 +3363,10 @@ module EstablishTypeDefinitionCores =
3363
3363
| _ ->
3364
3364
let kind =
3365
3365
match kind with
3366
- | SynTypeDefnKind.Class -> TTyconClass
3367
- | SynTypeDefnKind.Interface -> TTyconInterface
3368
- | SynTypeDefnKind.Delegate _ -> TTyconDelegate ( MakeSlotSig( " Invoke" , cenv.g.unit_ ty, [], [], [], None))
3369
- | SynTypeDefnKind.Struct -> TTyconStruct
3366
+ | SynTypeDefnKind.Class -> TFSharpClass
3367
+ | SynTypeDefnKind.Interface -> TFSharpInterface
3368
+ | SynTypeDefnKind.Delegate _ -> TFSharpDelegate ( MakeSlotSig( " Invoke" , cenv.g.unit_ ty, [], [], [], None))
3369
+ | SynTypeDefnKind.Struct -> TFSharpStruct
3370
3370
| _ -> error( InternalError( " should have inferred tycon kind" , m))
3371
3371
3372
3372
let repr =
@@ -3377,7 +3377,7 @@ module EstablishTypeDefinitionCores =
3377
3377
TFSharpObjectRepr repr
3378
3378
3379
3379
| SynTypeDefnSimpleRepr.Enum _ ->
3380
- let kind = TTyconEnum
3380
+ let kind = TFSharpEnum
3381
3381
let repr =
3382
3382
{ fsobjmodel_ kind = kind
3383
3383
fsobjmodel_ vslots = []
@@ -3413,7 +3413,7 @@ module EstablishTypeDefinitionCores =
3413
3413
3414
3414
let typeBeforeArguments =
3415
3415
match tcrefBeforeStaticArguments.TypeReprInfo with
3416
- | TProvidedTypeExtensionPoint info -> info.ProvidedType
3416
+ | TProvidedTypeRepr info -> info.ProvidedType
3417
3417
| _ -> failwith " unreachable"
3418
3418
3419
3419
if IsGeneratedTypeDirectReference ( typeBeforeArguments, m) then
@@ -3443,7 +3443,7 @@ module EstablishTypeDefinitionCores =
3443
3443
checkTypeName()
3444
3444
let resolutionEnvironment =
3445
3445
match tcrefForContainer.TypeReprInfo with
3446
- | TProvidedTypeExtensionPoint info -> info.ResolutionEnvironment
3446
+ | TProvidedTypeRepr info -> info.ResolutionEnvironment
3447
3447
| _ -> failwith " unreachable"
3448
3448
resolutionEnvironment
3449
3449
@@ -3848,7 +3848,7 @@ module EstablishTypeDefinitionCores =
3848
3848
for fspec in fields do
3849
3849
if not fspec.IsCompilerGenerated then
3850
3850
let info = RecdFieldInfo( thisTyInst, thisTyconRef.MakeNestedRecdFieldRef fspec)
3851
- let nenv ' = AddFakeNameToNameEnv fspec.Name nenv ( Item.RecdField info)
3851
+ let nenv ' = AddFakeNameToNameEnv fspec.LogicalName nenv ( Item.RecdField info)
3852
3852
// Name resolution gives better info for tooltips
3853
3853
let item = Item.RecdField( FreshenRecdFieldRef cenv.nameResolver m ( thisTyconRef.MakeNestedRecdFieldRef fspec))
3854
3854
CallNameResolutionSink cenv.tcSink ( fspec.Range, nenv, item, emptyTyparInst, ItemOccurence.Binding, ad)
@@ -3879,7 +3879,7 @@ module EstablishTypeDefinitionCores =
3879
3879
hiddenReprChecks false
3880
3880
noAllowNullLiteralAttributeCheck()
3881
3881
if hasMeasureAttr then
3882
- let repr = TFSharpObjectRepr { fsobjmodel_ kind= TTyconClass
3882
+ let repr = TFSharpObjectRepr { fsobjmodel_ kind= TFSharpClass
3883
3883
fsobjmodel_ vslots=[]
3884
3884
fsobjmodel_ rfields= Construct.MakeRecdFieldsTable [] }
3885
3885
repr, None, NoSafeInitInfo
@@ -3928,12 +3928,13 @@ module EstablishTypeDefinitionCores =
3928
3928
let unionCases = TcRecdUnionAndEnumDeclarations.TcUnionCaseDecls cenv envinner innerParent thisTy thisTyInst tpenv unionCases
3929
3929
3930
3930
if tycon.IsStructRecordOrUnionTycon && unionCases.Length > 1 then
3931
- let fieldNames = [ for uc in unionCases do for ft in uc.FieldTable.TrueInstanceFieldsAsList do yield ft.Name ]
3931
+ let fieldNames = [ for uc in unionCases do for ft in uc.FieldTable.TrueInstanceFieldsAsList do yield ft.LogicalName ]
3932
3932
if fieldNames |> List.distinct |> List.length <> fieldNames.Length then
3933
3933
errorR( Error( FSComp.SR.tcStructUnionMultiCaseDistinctFields(), m))
3934
3934
3935
3935
writeFakeUnionCtorsToSink unionCases
3936
- Construct.MakeUnionRepr unionCases, None, NoSafeInitInfo
3936
+ let repr = Construct.MakeUnionRepr unionCases
3937
+ repr, None, NoSafeInitInfo
3937
3938
3938
3939
| SynTypeDefnSimpleRepr.Record (_, fields, _) ->
3939
3940
noMeasureAttributeCheck()
@@ -3944,7 +3945,8 @@ module EstablishTypeDefinitionCores =
3944
3945
let recdFields = TcRecdUnionAndEnumDeclarations.TcNamedFieldDecls cenv envinner innerParent false tpenv fields
3945
3946
recdFields |> CheckDuplicates ( fun f -> f.Id) " field" |> ignore
3946
3947
writeFakeRecordFieldsToSink recdFields
3947
- TRecdRepr ( Construct.MakeRecdFieldsTable recdFields), None, NoSafeInitInfo
3948
+ let repr = TFSharpRecdRepr ( Construct.MakeRecdFieldsTable recdFields)
3949
+ repr, None, NoSafeInitInfo
3948
3950
3949
3951
| SynTypeDefnSimpleRepr.LibraryOnlyILAssembly ( s, _) ->
3950
3952
let s = ( s :?> ILType)
@@ -4005,20 +4007,20 @@ module EstablishTypeDefinitionCores =
4005
4007
errorR ( Error( FSComp.SR.tcStructTypesCannotContainAbstractMembers(), m))
4006
4008
structLayoutAttributeCheck true
4007
4009
4008
- TTyconStruct
4010
+ TFSharpStruct
4009
4011
| SynTypeDefnKind.Interface ->
4010
4012
if hasSealedAttr = Some true then errorR ( Error( FSComp.SR.tcInterfaceTypesCannotBeSealed(), m))
4011
4013
noCLIMutableAttributeCheck()
4012
4014
structLayoutAttributeCheck false
4013
4015
noAbstractClassAttributeCheck()
4014
4016
allowNullLiteralAttributeCheck()
4015
4017
noFieldsCheck userFields
4016
- TTyconInterface
4018
+ TFSharpInterface
4017
4019
| SynTypeDefnKind.Class ->
4018
4020
noCLIMutableAttributeCheck()
4019
4021
structLayoutAttributeCheck( not isIncrClass)
4020
4022
allowNullLiteralAttributeCheck()
4021
- TTyconClass
4023
+ TFSharpClass
4022
4024
| SynTypeDefnKind.Delegate ( ty, arity) ->
4023
4025
noCLIMutableAttributeCheck()
4024
4026
noSealedAttributeCheck FSComp.SR.tcTypesAreAlwaysSealedDelegate
@@ -4032,7 +4034,7 @@ module EstablishTypeDefinitionCores =
4032
4034
if curriedArgInfos.Length > 1 then error( Error( FSComp.SR.tcDelegatesCannotBeCurried(), m))
4033
4035
let ttps = thisTyconRef.Typars m
4034
4036
let fparams = curriedArgInfos.Head |> List.map MakeSlotParam
4035
- TTyconDelegate ( MakeSlotSig( " Invoke" , thisTy, ttps, [], [ fparams], returnTy))
4037
+ TFSharpDelegate ( MakeSlotSig( " Invoke" , thisTy, ttps, [], [ fparams], returnTy))
4036
4038
| _ ->
4037
4039
error( InternalError( " should have inferred tycon kind" , m))
4038
4040
@@ -4080,7 +4082,7 @@ module EstablishTypeDefinitionCores =
4080
4082
4081
4083
| SynTypeDefnSimpleRepr.Enum ( decls, m) ->
4082
4084
let fieldTy , fields' = TcRecdUnionAndEnumDeclarations.TcEnumDecls cenv envinner innerParent thisTy decls
4083
- let kind = TTyconEnum
4085
+ let kind = TFSharpEnum
4084
4086
structLayoutAttributeCheck false
4085
4087
noCLIMutableAttributeCheck()
4086
4088
noSealedAttributeCheck FSComp.SR.tcTypesAreAlwaysSealedEnum
@@ -4390,7 +4392,7 @@ module EstablishTypeDefinitionCores =
4390
4392
4391
4393
// Phase 1B. Establish the kind of each type constructor
4392
4394
// Here we run InferTyconKind and record partial information about the kind of the type constructor.
4393
- // This means TyconObjModelKind is set, which means isSealedTy, isInterfaceTy etc. give accurate results.
4395
+ // This means TyconFSharpObjModelKind is set, which means isSealedTy, isInterfaceTy etc. give accurate results.
4394
4396
let withAttrs =
4395
4397
( envMutRecPrelim, withEnvs) ||> MutRecShapes.mapTyconsWithEnv ( fun envForDecls ( origInfo , tyconOpt ) ->
4396
4398
let res =
0 commit comments