Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4eed66b

Browse files
authored
Fixes: #4957 --- Intellisense for Indexed properties were broken by a recent (#4958)
* Fixes: #4957* remaining codepaths* Rename helper
1 parent6f7953c commit4eed66b

File tree

7 files changed

+28
-24
lines changed

7 files changed

+28
-24
lines changed

‎src/fsharp/ConstraintSolver.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2604,7 +2604,7 @@ let CodegenWitnessThatTypSupportsTraitConstraint tcVal g amap m (traitInfo:Trait
26042604
| Some sln->
26052605
match slnwith
26062606
| ILMethSln(origTy, extOpt, mref, minst)->
2607-
letmetadataTy=helpEnsureTypeHasMetadata g origTy
2607+
letmetadataTy=convertToTypeWithMetadataIfPossible g origTy
26082608
lettcref,_tinst= destAppTy g metadataTy
26092609
letmdef= IL.resolveILMethodRef tcref.ILTyconRawMetadata mref
26102610
letilMethInfo=

‎src/fsharp/InfoReader.fs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ let rec GetImmediateIntrinsicMethInfosOfTypeAux (optFilter,ad) g amap m origTy m
7171
// Tuple types also support the methods get_Item1-8, get_Rest from the compiled tuple type.
7272
// In this case convert to the .NET Tuple type that carries metadata and try again
7373
if isAnyTupleTy g metadataTythen
74-
letbetterMetadataTy=helpEnsureTypeHasMetadata g metadataTy
74+
letbetterMetadataTy=convertToTypeWithMetadataIfPossible g metadataTy
7575
GetImmediateIntrinsicMethInfosOfTypeAux(optFilter,ad) g amap m origTy betterMetadataTy
7676
// Function types support methods FSharpFunc<_,_>.FromConverter and friends from .NET metadata,
7777
// but not instance methods (you can't write "f.Invoke(x)", you have to write "f x")
7878
elif isFunTy g metadataTythen
79-
letbetterMetadataTy=helpEnsureTypeHasMetadata g metadataTy
79+
letbetterMetadataTy=convertToTypeWithMetadataIfPossible g metadataTy
8080
GetImmediateIntrinsicMethInfosOfTypeAux(optFilter,ad) g amap m origTy betterMetadataTy
8181
|> List.filter(fun minfo->not minfo.IsInstance)
8282
else
@@ -165,7 +165,7 @@ let rec GetImmediateIntrinsicPropInfosOfTypeAux (optFilter,ad) g amap m origTy m
165165
// Tuple types also support the properties Item1-8, Rest from the compiled tuple type
166166
// In this case convert to the .NET Tuple type that carries metadata and try again
167167
if isAnyTupleTy g metadataTy|| isFunTy g metadataTythen
168-
letbetterMetadataTy=helpEnsureTypeHasMetadata g metadataTy
168+
letbetterMetadataTy=convertToTypeWithMetadataIfPossible g metadataTy
169169
GetImmediateIntrinsicPropInfosOfTypeAux(optFilter,ad) g amap m origTy betterMetadataTy
170170
else
171171
match tryDestAppTy g metadataTywith
@@ -465,7 +465,7 @@ let rec GetIntrinsicConstructorInfosOfTypeAux (infoReader:InfoReader) m origTy m
465465
// Tuple types also support constructors. In this case convert to the .NET Tuple type that carries metadata and try again
466466
// Function types also support constructors. In this case convert to the FSharpFunc type that carries metadata and try again
467467
if isAnyTupleTy g metadataTy|| isFunTy g metadataTythen
468-
letbetterMetadataTy=helpEnsureTypeHasMetadata g metadataTy
468+
letbetterMetadataTy=convertToTypeWithMetadataIfPossible g metadataTy
469469
GetIntrinsicConstructorInfosOfTypeAux infoReader m origTy betterMetadataTy
470470
else
471471
match tryDestAppTy g metadataTywith

‎src/fsharp/NameResolution.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1889,7 +1889,7 @@ let private ResolveObjectConstructorPrim (ncenv:NameResolver) edenv resInfo m ad
18891889
raze(Error(FSComp.SR.nrNoConstructorsAvailableForType(NicePrint.minimalStringOfType edenv typ),m))
18901890
else
18911891
letctorInfos= ctorInfos|> List.filter(IsMethInfoAccessible amap m ad)
1892-
letmetadataTy=helpEnsureTypeHasMetadata g typ
1892+
letmetadataTy=convertToTypeWithMetadataIfPossible g typ
18931893
success(resInfo,Item.MakeCtorGroup((tcrefOfAppTy g metadataTy).LogicalName,(defaultStructCtorInfo@ctorInfos)))
18941894

18951895
/// Perform name resolution for an identifier which must resolve to be an object constructor.

‎src/fsharp/TastOps.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ let mkInstForAppTy g typ =
795795
letdomainOfFunTy g ty= fst(destFunTy g ty)
796796
letrangeOfFunTy g ty= snd(destFunTy g ty)
797797

798-
lethelpEnsureTypeHasMetadata g ty=
798+
letconvertToTypeWithMetadataIfPossible g ty=
799799
if isAnyTupleTy g tythen
800800
let(tupInfo,tupElemTys)= destAnyTupleTy g ty
801801
mkOuterCompiledTupleTy g(evalTupInfoIsStruct tupInfo) tupElemTys

‎src/fsharp/TastOps.fsi‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ val mkGetTupleItemN : TcGlobals -> range -> int -> ILType -> bool -> Expr -> TTy
252252
val evalTupInfoIsStruct: TupInfo-> bool
253253

254254
/// If it is a tuple type, ensure it's outermost type is a .NET tuple type, otherwise leave unchanged
255-
valhelpEnsureTypeHasMetadata: TcGlobals-> TType-> TType
255+
valconvertToTypeWithMetadataIfPossible: TcGlobals-> TType-> TType
256256

257257

258258
//-------------------------------------------------------------------------

‎src/fsharp/TypeChecker.fs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4923,7 +4923,7 @@ and TcTypeAndRecover cenv newOk checkCxs occ env tpenv ty =
49234923
TcTypeOrMeasureAndRecover (Some TyparKind.Type) cenv newOk checkCxs occ env tpenv ty
49244924

49254925
and TcNestedTypeApplication cenv newOk checkCxs occ env tpenv mWholeTypeApp typ tyargs =
4926-
let typ =helpEnsureTypeHasMetadata cenv.g typ
4926+
let typ =convertToTypeWithMetadataIfPossible cenv.g typ
49274927
if not (isAppTy cenv.g typ) then error(Error(FSComp.SR.tcTypeHasNoNestedTypes(), mWholeTypeApp))
49284928
match typ with
49294929
| TType_app(tcref, tinst) ->
@@ -13226,7 +13226,7 @@ module MutRecBindingChecking =
1322613226
// Phase2B: typecheck the argument to an 'inherits' call and build the new object expr for the inherit-call
1322713227
| Phase2AInherit (synBaseTy, arg, baseValOpt, m) ->
1322813228
let baseTy, tpenv = TcType cenv NoNewTypars CheckCxs ItemOccurence.Use envInstance tpenv synBaseTy
13229-
let baseTy = baseTy |>helpEnsureTypeHasMetadata cenv.g
13229+
let baseTy = baseTy |>convertToTypeWithMetadataIfPossible cenv.g
1323013230
let inheritsExpr, tpenv = TcNewExpr cenv envInstance tpenv baseTy (Some synBaseTy.Range) true arg m
1323113231
let envInstance = match baseValOpt with Some baseVal -> AddLocalVal cenv.tcSink scopem baseVal envInstance | None -> envInstance
1323213232
let envNonRec = match baseValOpt with Some baseVal -> AddLocalVal cenv.tcSink scopem baseVal envNonRec | None -> envNonRec

‎src/fsharp/infos.fs‎

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ type ILTypeInfo =
670670
memberx.ToType=let(ILTypeInfo(_,ty,_,_))= xin ty
671671

672672
/// Get the compiled nominal type. In the case of tuple types, this is a .NET tuple type
673-
memberx.ToAppType=helpEnsureTypeHasMetadata x.TcGlobals x.ToType
673+
memberx.ToAppType=convertToTypeWithMetadataIfPossible x.TcGlobals x.ToType
674674

675675
memberx.TyconRefOfRawMetadata= tcrefOfAppTy x.TcGlobals x.ToAppType
676676

@@ -690,7 +690,7 @@ type ILTypeInfo =
690690
if isAnyTupleTy g tythen
691691
// When getting .NET metadata for the properties and methods
692692
// of an F# tuple type, use the compiled nominal type, which is a .NET tuple type
693-
letmetadataTy=helpEnsureTypeHasMetadata g ty
693+
letmetadataTy=convertToTypeWithMetadataIfPossible g ty
694694
assert(isILAppTy g metadataTy)
695695
letmetadataTyconRef= tcrefOfAppTy g metadataTy
696696
let(TILObjectReprData(scoref,enc,tdef))= metadataTyconRef.ILTyconInfo
@@ -727,7 +727,7 @@ type ILMethInfo =
727727
memberx.ApparentEnclosingType=match xwith ILMethInfo(_,ty,_,_,_)-> ty
728728

729729
/// Like ApparentEnclosingType but use the compiled nominal type if this is a method on a tuple type
730-
memberx.ApparentEnclosingAppType=helpEnsureTypeHasMetadata x.TcGlobals x.ApparentEnclosingType
730+
memberx.ApparentEnclosingAppType=convertToTypeWithMetadataIfPossible x.TcGlobals x.ApparentEnclosingType
731731

732732
/// Get the declaring type associated with an extension member, if any.
733733
memberx.ILExtensionMethodDeclaringTyconRef=match xwith ILMethInfo(_,_,tcrefOpt,_,_)-> tcrefOpt
@@ -897,9 +897,7 @@ type MethInfo =
897897

898898
/// Get the enclosing type of the method info, using a nominal type for tuple types
899899
memberx.ApparentEnclosingAppType=
900-
match xwith
901-
| ILMeth(_,ilminfo,_)-> ilminfo.ApparentEnclosingAppType
902-
|_-> x.ApparentEnclosingType
900+
convertToTypeWithMetadataIfPossible x.TcGlobals x.ApparentEnclosingType
903901

904902
memberx.ApparentEnclosingTyconRef=
905903
tcrefOfAppTy x.TcGlobals x.ApparentEnclosingAppType
@@ -1005,7 +1003,8 @@ type MethInfo =
10051003
memberx.FormalMethodTypars=
10061004
match xwith
10071005
| ILMeth(_,ilmeth,_)-> ilmeth.FormalMethodTypars
1008-
| FSMeth(g,typ,vref,_)->
1006+
| FSMeth(g,_,vref,_)->
1007+
lettyp= x.ApparentEnclosingAppType
10091008
let_,memberMethodTypars,_,_= AnalyzeTypeOfMemberVal x.IsCSharpStyleExtensionMember g(typ,vref)
10101009
memberMethodTypars
10111010
| DefaultStructCtor_->[]
@@ -1283,7 +1282,8 @@ type MethInfo =
12831282
match xwith
12841283
| ILMeth(_g,ilminfo,_)->
12851284
ilminfo.GetCompiledReturnTy(amap, m, minst)
1286-
| FSMeth(g,typ,vref,_)->
1285+
| FSMeth(g,_,vref,_)->
1286+
lettyp= x.ApparentEnclosingAppType
12871287
letinst= GetInstantiationForMemberVal g x.IsCSharpStyleExtensionMember(typ,vref,minst)
12881288
let_,_,retTy,_= AnalyzeTypeOfMemberVal x.IsCSharpStyleExtensionMember g(typ,vref)
12891289
retTy|> Option.map(instType inst)
@@ -1320,8 +1320,9 @@ type MethInfo =
13201320
memberx.GetObjArgTypes(amap,m,minst)=
13211321
match xwith
13221322
| ILMeth(_,ilminfo,_)-> ilminfo.GetObjArgTypes(amap, m, minst)
1323-
| FSMeth(g,typ,vref,_)->
1323+
| FSMeth(g,_,vref,_)->
13241324
if x.IsInstancethen
1325+
lettyp= x.ApparentEnclosingAppType
13251326
// The 'this' pointer of an extension member can depend on the minst
13261327
if x.IsExtensionMemberthen
13271328
letinst= GetInstantiationForMemberVal g x.IsCSharpStyleExtensionMember(typ,vref,minst)
@@ -1521,7 +1522,8 @@ type MethInfo =
15211522
match xwith
15221523
| ILMeth(_g,ilminfo,_)->
15231524
[ ilminfo.GetParamNamesAndTypes(amap,m,minst)]
1524-
| FSMeth(g,typ,vref,_)->
1525+
| FSMeth(g,_,vref,_)->
1526+
lettyp= x.ApparentEnclosingAppType
15251527
letitems= ParamNameAndType.FromMember x.IsCSharpStyleExtensionMember g vref
15261528
letinst= GetInstantiationForMemberVal g x.IsCSharpStyleExtensionMember(typ,vref,minst)
15271529
items|> ParamNameAndType.InstantiateCurried inst
@@ -1561,7 +1563,8 @@ type MethInfo =
15611563
if x.IsExtensionMemberthen[]
15621564
else
15631565
match xwith
1564-
| FSMeth(g,typ,vref,_)->
1566+
| FSMeth(g,_,vref,_)->
1567+
lettyp= x.ApparentEnclosingAppType
15651568
letmemberParentTypars,_,_,_= AnalyzeTypeOfMemberValfalse g(typ,vref)
15661569
memberParentTypars
15671570
|_->
@@ -1790,7 +1793,7 @@ type ILPropInfo =
17901793
memberx.ApparentEnclosingType=match xwith ILPropInfo(tinfo,_)-> tinfo.ToType
17911794

17921795
/// Like ApparentEnclosingType but use the compiled nominal type if this is a method on a tuple type
1793-
memberx.ApparentEnclosingAppType=helpEnsureTypeHasMetadata x.TcGlobals x.ApparentEnclosingType
1796+
memberx.ApparentEnclosingAppType=convertToTypeWithMetadataIfPossible x.TcGlobals x.ApparentEnclosingType
17941797

17951798
/// Get the raw Abstract IL metadata for the IL property
17961799
memberx.RawMetadata=match xwith ILPropInfo(_,pd)-> pd
@@ -2096,8 +2099,9 @@ type PropInfo =
20962099
memberx.GetPropertyType(amap,m)=
20972100
match xwith
20982101
| ILProp ilpinfo-> ilpinfo.GetPropertyType(amap,m)
2099-
| FSProp(g,typ,Some vref,_)
2100-
| FSProp(g,typ,_,Some vref)->
2102+
| FSProp(g,_,Some vref,_)
2103+
| FSProp(g,_,_,Some vref)->
2104+
lettyp= x.ApparentEnclosingAppType
21012105
letinst= GetInstantiationForPropertyVal g(typ,vref)
21022106
ReturnTypeOfPropertyVal g vref.Deref|> instType inst
21032107

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp