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

Commitc52b4dd

Browse files
forkilatkin
authored andcommitted
Show warning when DU is accessed without type but RequiredQualifiedAccess was set
fixesdotnet#95closesdotnet#103commit 8bc07748cd50a0436b39de6066e4c2aaf52d8be0Author: latkin <latkin@microsoft.com>Date: Mon Jan 26 16:47:06 2015 -0800 Fix typo in test baselinecommit 210baa88919d8bcd37db9fc1e0f9911acbc317e7Author: latkin <latkin@microsoft.com>Date: Mon Jan 26 16:46:28 2015 -0800 Fix improper unqualified DU accesses in project systemcommitef1fb6bAuthor: Steffen Forkmann <steffen.forkmann@msu-solutions.de>Date: Mon Jan 26 17:51:05 2015 +0100 Put Deprecated message into FSComp.txt - relates todotnet#95commitfa5e972Author: Steffen Forkmann <steffen.forkmann@msu-solutions.de>Date: Mon Jan 26 16:03:38 2015 +0100 Add test for DU which is accessed without type but RequiredQualifiedAccess was set - relates todotnet#95commite8a652eAuthor: Steffen Forkmann <steffen.forkmann@msu-solutions.de>Date: Mon Jan 26 10:00:43 2015 +0100 Fix a case wheredotnet#95 is violated in the compiler itselfcommit7c9c968Author: Steffen Forkmann <steffen.forkmann@msu-solutions.de>Date: Sun Jan 25 20:10:05 2015 +0100 Show warning when DU is accessed without type but RequiredQualifiedAccess was set -closesdotnet#95
1 parent11ede75 commitc52b4dd

File tree

10 files changed

+53
-36
lines changed

10 files changed

+53
-36
lines changed

‎src/fsharp/FSComp.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,7 @@ lexfltSeparatorTokensOfPatternMatchMisaligned,"The '|' tokens separating rules o
10221022
1130,nrInvalidFieldLabel,"Invalid field label"
10231023
1132,nrInvalidExpression,"Invalid expression '%s'"
10241024
1133,nrNoConstructorsAvailableForType,"No constructors are available for the type '%s'"
1025+
1134,nrUnionTypeNeedsQualifiedAccess,"The union type for union case '%s' was defined with the RequireQualifiedAccessAttribute. Include the name of the union type ('%s') in the name you are using.""
10251026
# -----------------------------------------------------------------------------
10261027
# ilwrite.fs errors
10271028
# -----------------------------------------------------------------------------

‎src/fsharp/check.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1471,6 +1471,6 @@ let CheckTopImpl (g,amap,reportErrors,infoReader,internalsVisibleToPaths,viewCcu
14711471

14721472
CheckModuleExpr cenv env mexpr;
14731473
CheckAttribs cenv env extraAttribs;
1474-
if cenv.usesQuotations&& QuotationTranslator.QuotationGenerationScope.ComputeQuotationFormat(cenv.g)= QuotationTranslator.FSharp_20_Plusthen
1474+
if cenv.usesQuotations&& QuotationTranslator.QuotationGenerationScope.ComputeQuotationFormat(cenv.g)= QuotationTranslator.QuotationSerializationFormat.FSharp_20_Plusthen
14751475
viewCcu.UsesFSharp20PlusQuotations<-true
14761476
cenv.entryPointGiven

‎src/fsharp/nameres.fs‎

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ type Item =
135135
/// Represents the resolution of a name to an F# value or function.
136136
| ValueofValRef
137137
/// Represents the resolution of a name to an F# union case.
138-
| UnionCaseofUnionCaseInfo
138+
| UnionCaseofUnionCaseInfo*bool
139139
/// Represents the resolution of a name to an F# active pattern result.
140140
| ActivePatternResultofActivePatternInfo*TType*int*range
141141
/// Represents the resolution of a name to an F# active pattern case within the body of an active pattern.
@@ -197,7 +197,7 @@ type Item =
197197
match dwith
198198
| Item.Value v-> v.DisplayName
199199
| Item.ActivePatternCase apref-> apref.Name
200-
| Item.UnionCaseuinfo-> DecompileOpName uinfo.UnionCase.DisplayName
200+
| Item.UnionCase(uinfo,_)-> DecompileOpName uinfo.UnionCase.DisplayName
201201
| Item.ExnCase tcref-> tcref.LogicalName
202202
| Item.RecdField rfinfo-> DecompileOpName rfinfo.RecdField.Name
203203
| Item.NewDef id-> id.idText
@@ -521,7 +521,7 @@ let AddRecdField (rfref:RecdFieldRef) tab = NameMultiMap.add rfref.FieldName rfr
521521
/// Add a set of union cases to the corresponding sub-table of the environment
522522
letAddUnionCases1(tab:Map<_,_>)(ucrefs:UnionCaseRef list)=
523523
(tab, ucrefs)||> List.fold(fun acc ucref->
524-
letitem= Item.UnionCase(GeneralizeUnionCaseRef ucref)
524+
letitem= Item.UnionCase(GeneralizeUnionCaseRef ucref,false)
525525
acc.Add(ucref.CaseName, item))
526526

527527
/// Add a set of union cases to the corresponding sub-table of the environment
@@ -530,13 +530,13 @@ let AddUnionCases2 bulkAddMode (eUnqualifiedItems: LayeredMap<_,_>) (ucrefs :Uni
530530
| BulkAdd.Yes->
531531
letitems=
532532
ucrefs|> Array.ofList|> Array.map(fun ucref->
533-
letitem= Item.UnionCase(GeneralizeUnionCaseRef ucref)
533+
letitem= Item.UnionCase(GeneralizeUnionCaseRef ucref,false)
534534
KeyValuePair(ucref.CaseName,item))
535535
eUnqualifiedItems.AddAndMarkAsCollapsible items
536536

537537
| BulkAdd.No->
538538
(eUnqualifiedItems,ucrefs)||> List.fold(fun acc ucref->
539-
letitem= Item.UnionCase(GeneralizeUnionCaseRef ucref)
539+
letitem= Item.UnionCase(GeneralizeUnionCaseRef ucref,false)
540540
acc.Add(ucref.CaseName, item))
541541

542542
/// Add any implied contents of a type definition to the environment.
@@ -754,7 +754,7 @@ let FreshenUnionCaseRef (ncenv: NameResolver) m (ucref:UnionCaseRef) =
754754
/// This must be called after fetching unqualified items that may need to be freshened
755755
letFreshenUnqualifiedItem(ncenv:NameResolver)m res=
756756
match reswith
757-
| Item.UnionCase(UnionCaseInfo(_,ucref))-> Item.UnionCase(FreshenUnionCaseRef ncenv m ucref)
757+
| Item.UnionCase(UnionCaseInfo(_,ucref),_)-> Item.UnionCase(FreshenUnionCaseRef ncenv m ucref,false)
758758
|_-> res
759759

760760

@@ -1549,7 +1549,7 @@ let rec ResolveLongIdentInTypePrim (ncenv:NameResolver) nenv lookupKind (resInfo
15491549
// Lookup: datatype constructors take precedence
15501550
match unionCaseSearchwith
15511551
| Some ucase->
1552-
success(resInfo,Item.UnionCase(ucase),rest)
1552+
success(resInfo,Item.UnionCase(ucase,false),rest)
15531553
| None->
15541554
match TryFindIntrinsicNamedItemOfType ncenv.InfoReader(nm,ad) findFlag m typwith
15551555
| Some(PropertyItem psets)when(match lookupKindwith LookupKind.Expr->true|_->false)->
@@ -1652,8 +1652,9 @@ let rec ResolveExprLongIdentInModuleOrNamespace (ncenv:NameResolver) nenv (typeN
16521652
match TryFindTypeWithUnionCase modref idwith
16531653
| Some tyconwhen IsTyconReprAccessible ncenv.amap m ad(modref.MkNestedTyconRef tycon)->
16541654
letucref= mkUnionCaseRef(modref.MkNestedTyconRef tycon) id.idText
1655+
letshowDeprecated= HasFSharpAttribute ncenv.g ncenv.g.attrib_RequireQualifiedAccessAttribute tycon.Attribs
16551656
letucinfo= FreshenUnionCaseRef ncenv m ucref
1656-
success(resInfo,Item.UnionCaseucinfo,rest)
1657+
success(resInfo,Item.UnionCase(ucinfo,showDeprecated),rest)
16571658
|_->
16581659
match mty.ExceptionDefinitionsByDemangledName.TryFind(id.idText)with
16591660
| Some exconwhen IsTyconReprAccessible ncenv.amap m ad(modref.MkNestedTyconRef excon)->
@@ -1854,8 +1855,9 @@ let rec ResolvePatternLongIdentInModuleOrNamespace (ncenv:NameResolver) nenv num
18541855
| Some tyconwhen IsTyconReprAccessible ncenv.amap m ad(modref.MkNestedTyconRef tycon)->
18551856
lettcref= modref.MkNestedTyconRef tycon
18561857
letucref= mkUnionCaseRef tcref id.idText
1858+
letshowDeprecated= HasFSharpAttribute ncenv.g ncenv.g.attrib_RequireQualifiedAccessAttribute tycon.Attribs
18571859
letucinfo= FreshenUnionCaseRef ncenv m ucref
1858-
success(resInfo,Item.UnionCaseucinfo,rest)
1860+
success(resInfo,Item.UnionCase(ucinfo,showDeprecated),rest)
18591861
|_->
18601862
match mty.ExceptionDefinitionsByDemangledName.TryFind(id.idText)with
18611863
| Some exncwhen IsEntityAccessible ncenv.amap m ad(modref.MkNestedTyconRef exnc)->
@@ -2411,7 +2413,7 @@ let IsUnionCaseUnseen ad g amap m (ucref:UnionCaseRef) =
24112413
letItemIsUnseen ad g amap m item=
24122414
match itemwith
24132415
| Item.Value x-> IsValUnseen ad g m x
2414-
| Item.UnionCase x-> IsUnionCaseUnseen ad g amap m x.UnionCaseRef
2416+
| Item.UnionCase(x,_)-> IsUnionCaseUnseen ad g amap m x.UnionCaseRef
24152417
| Item.ExnCase x-> IsTyconUnseen ad g amap m x
24162418
|_->false
24172419

@@ -2466,7 +2468,7 @@ let ResolveCompletionsInType (ncenv: NameResolver) nenv isApplicableMeth m ad st
24662468
lettc,tinst= destAppTy g typ
24672469
tc.UnionCasesAsRefList
24682470
|> List.filter(IsUnionCaseUnseen ad g ncenv.amap m>>not)
2469-
|> List.map(fun ucref-> Item.UnionCase(UnionCaseInfo(tinst,ucref)))
2471+
|> List.map(fun ucref-> Item.UnionCase(UnionCaseInfo(tinst,ucref),false))
24702472
else[]
24712473

24722474
leteinfos=
@@ -2738,7 +2740,7 @@ let rec ResolvePartialLongIdentInModuleOrNamespace (ncenv: NameResolver) nenv is
27382740
@(UnionCaseRefsInModuleOrNamespace modref
27392741
|> List.filter(IsUnionCaseUnseen ad g ncenv.amap m>>not)
27402742
|> List.map GeneralizeUnionCaseRef
2741-
|> List.map Item.UnionCase)
2743+
|> List.map(fun x->Item.UnionCase(x,false)))
27422744

27432745
// Collect up the accessible active patterns in the module
27442746
@(ActivePatternElemsOfModuleOrNamespace modref

‎src/fsharp/nameres.fsi‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ type ArgumentContainer =
3838
typeItem=
3939
// These exist in the "eUnqualifiedItems" List.map in the type environment.
4040
| ValueofValRef
41-
| UnionCaseofUnionCaseInfo
41+
// UnionCaseInfo and temporary flag which is used to show a "use case is deprecated" message
42+
| UnionCaseofUnionCaseInfo*bool
4243
| ActivePatternResultofActivePatternInfo*TType*int*range
4344
| ActivePatternCaseofActivePatternElemRef
4445
| ExnCaseofTyconRef

‎src/fsharp/tc.fs‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,7 +1876,10 @@ let rec ApplyUnionCaseOrExn (makerForUnionCase,makerForExnTag) m cenv env overal
18761876
let mkf = makerForExnTag(ecref)
18771877
mkf,recdFieldTysOfExnDefRef ecref, [ for f in (recdFieldsOfExnDefRef ecref) -> f.Name ]
18781878

1879-
| Item.UnionCase ucinfo ->
1879+
| Item.UnionCase(ucinfo,showDeprecated) ->
1880+
if showDeprecated then
1881+
warning(Deprecated(FSComp.SR.nrUnionTypeNeedsQualifiedAccess(ucinfo.Name,ucinfo.Tycon.DisplayName) |> snd,m))
1882+
18801883
let ucref = ucinfo.UnionCaseRef
18811884
CheckUnionCaseAttributes cenv.g ucref m |> CommitOperationResult
18821885
CheckUnionCaseAccessible cenv.amap m ad ucref |> ignore
@@ -4872,7 +4875,7 @@ and TcPat warnOnUpper cenv env topValInfo vFlags (tpenv,names,takenNames) ty pat
48724875
| None ->
48734876
let caseName =
48744877
match item with
4875-
| Item.UnionCaseuci -> uci.Name
4878+
| Item.UnionCase(uci,_) -> uci.Name
48764879
| Item.ExnCase tcref -> tcref.DisplayName
48774880
| _ -> failwith "impossible"
48784881
error(Error(FSComp.SR.tcUnionCaseConstructorDoesNotHaveFieldWithGivenName(caseName, id.idText), id.idRange))
@@ -4881,7 +4884,7 @@ and TcPat warnOnUpper cenv env topValInfo vFlags (tpenv,names,takenNames) ty pat
48814884
| null ->
48824885
result.[idx] <- pat
48834886
let argContainerOpt = match item with
4884-
| Item.UnionCaseuci -> Some(ArgumentContainer.UnionCase(uci))
4887+
| Item.UnionCase(uci,_) -> Some(ArgumentContainer.UnionCase(uci))
48854888
| Item.ExnCase tref -> Some(ArgumentContainer.Type(tref))
48864889
| _ -> None
48874890
let argItem = Item.ArgName (id, (List.nth argtys idx), argContainerOpt)
@@ -7871,7 +7874,7 @@ and TcItemThen cenv overallTy env tpenv (item,mItem,rest,afterOverloadResolution
78717874
let ucref = mkChoiceCaseRef cenv.g mItem aparity n
78727875
let _,_,tinst,_ = infoOfTyconRef mItem ucref.TyconRef
78737876
let ucinfo = UnionCaseInfo(tinst,ucref)
7874-
ApplyUnionCaseOrExnTypes mItem cenv env ucaseAppTy (Item.UnionCaseucinfo)
7877+
ApplyUnionCaseOrExnTypes mItem cenv env ucaseAppTy (Item.UnionCase(ucinfo,false))
78757878
| _ ->
78767879
ApplyUnionCaseOrExnTypes mItem cenv env ucaseAppTy item
78777880
let nargtys = List.length argtys
@@ -7927,7 +7930,7 @@ and TcItemThen cenv overallTy env tpenv (item,mItem,rest,afterOverloadResolution
79277930
if box fittedArgs.[i] = null then
79287931
fittedArgs.[i] <- arg
79297932
let argContainerOpt = match item with
7930-
| Item.UnionCaseuci -> Some(ArgumentContainer.UnionCase(uci))
7933+
| Item.UnionCase(uci,_) -> Some(ArgumentContainer.UnionCase(uci))
79317934
| Item.ExnCase tref -> Some(ArgumentContainer.Type(tref))
79327935
| _ -> None
79337936
let argItem = Item.ArgName (id, (List.nth argtys i), argContainerOpt)
@@ -7956,7 +7959,7 @@ and TcItemThen cenv overallTy env tpenv (item,mItem,rest,afterOverloadResolution
79567959
else
79577960
let caseName =
79587961
match item with
7959-
| Item.UnionCaseuci -> uci.Name
7962+
| Item.UnionCase(uci,_) -> uci.Name
79607963
| Item.ExnCase tcref -> tcref.DisplayName
79617964
| _ -> failwith "impossible"
79627965
error(Error(FSComp.SR.tcUnionCaseConstructorDoesNotHaveFieldWithGivenName(caseName, id.idText), id.idRange))
@@ -14021,9 +14024,9 @@ module EstablishTypeDefinitionCores = begin
1402114024
// Constructors should be visible from IntelliSense, so add fake names for them
1402214025
for unionCase in unionCases do
1402314026
let info = UnionCaseInfo(thisTyInst,mkUnionCaseRef thisTyconRef unionCase.Id.idText)
14024-
let nenv' = AddFakeNameToNameEnv unionCase.Id.idText nenv (Item.UnionCaseinfo)
14027+
let nenv' = AddFakeNameToNameEnv unionCase.Id.idText nenv (Item.UnionCase(info,false))
1402514028
// Report to both - as in previous function
14026-
let item = Item.UnionCaseinfo
14029+
let item = Item.UnionCase(info,false)
1402714030
CallNameResolutionSink cenv.tcSink (unionCase.Range,nenv,item,item,ItemOccurence.Binding,envinner.DisplayEnv,ad)
1402814031
CallEnvSink cenv.tcSink (unionCase.Id.idRange, nenv', ad)
1402914032

‎src/fsharp/vs/ServiceDeclarations.fs‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ module internal ItemDescriptionsImpl =
162162
let recrangeOfItem(g:TcGlobals)isDeclInfo d=
163163
match dwith
164164
| Item.Value vref| Item.CustomBuilder(_,vref)-> Some(if isDeclInfothen vref.Rangeelse vref.DefinitionRange)
165-
| Item.UnionCaseucinfo-> Some ucinfo.UnionCase.Range
165+
| Item.UnionCase(ucinfo,_)-> Some ucinfo.UnionCase.Range
166166
| Item.ActivePatternCase apref-> Some apref.ActivePatternVal.Range
167167
| Item.ExnCase tcref-> Some tcref.Range
168168
| Item.RecdField rfinfo-> Some rfinfo.RecdFieldRef.Range
@@ -192,7 +192,7 @@ module internal ItemDescriptionsImpl =
192192
let recccuOfItem g d=
193193
match dwith
194194
| Item.Value vref| Item.CustomBuilder(_,vref)-> ccuOfValRef vref
195-
| Item.UnionCaseucinfo-> computeCcuOfTyconRef ucinfo.TyconRef
195+
| Item.UnionCase(ucinfo,_)-> computeCcuOfTyconRef ucinfo.TyconRef
196196
| Item.ActivePatternCase apref-> ccuOfValRef apref.ActivePatternVal
197197
| Item.ExnCase tcref-> computeCcuOfTyconRef tcref
198198
| Item.RecdField rfinfo-> computeCcuOfTyconRef rfinfo.RecdFieldRef.TyconRef
@@ -347,7 +347,7 @@ module internal ItemDescriptionsImpl =
347347
| None-> XmlCommentNone
348348
else
349349
XmlCommentNone
350-
| Item.UnionCaseucinfo-> GetXmlDocSigOfUnionCaseInfo ucinfo
350+
| Item.UnionCase(ucinfo,_)-> GetXmlDocSigOfUnionCaseInfo ucinfo
351351
| Item.ExnCase tcref-> GetXmlDocSigOfEntityRef infoReader m tcref
352352
| Item.RecdField rfinfo-> GetXmlDocSigOfRecdFieldInfo rfinfo
353353
| Item.NewDef_-> XmlCommentNone
@@ -511,7 +511,7 @@ module internal ItemDescriptionsImpl =
511511
| Wrap(Item.Value vref1| Item.CustomBuilder(_,vref1)), Wrap(Item.Value vref2| Item.CustomBuilder(_,vref2))-> valRefEq g vref1 vref2
512512
| Wrap(Item.ActivePatternCase(APElemRef(_apinfo1, vref1, idx1))), Wrap(Item.ActivePatternCase(APElemRef(_apinfo2, vref2, idx2)))->
513513
idx1= idx2&& valRefEq g vref1 vref2
514-
| Wrap(Item.UnionCase(UnionCaseInfo(_, ur1))), Wrap(Item.UnionCase(UnionCaseInfo(_, ur2)))-> g.unionCaseRefEq ur1 ur2
514+
| Wrap(Item.UnionCase(UnionCaseInfo(_, ur1),_)), Wrap(Item.UnionCase(UnionCaseInfo(_, ur2),_))-> g.unionCaseRefEq ur1 ur2
515515
| Wrap(Item.RecdField(RecdFieldInfo(_, RFRef(tcref1, n1)))), Wrap(Item.RecdField(RecdFieldInfo(_, RFRef(tcref2, n2))))->
516516
(tyconRefEq g tcref1 tcref2)&&(n1= n2)// there is no direct function as in the previous case
517517
| Wrap(Item.Property(_, pi1s)), Wrap(Item.Property(_, pi2s))->
@@ -542,7 +542,7 @@ module internal ItemDescriptionsImpl =
542542
| Wrap(Item.Value vref| Item.CustomBuilder(_,vref))-> hash vref.LogicalName
543543
| Wrap(Item.ActivePatternCase(APElemRef(_apinfo, vref, idx)))-> hash(vref.LogicalName, idx)
544544
| Wrap(Item.ExnCase(tcref))-> hash tcref.Stamp
545-
| Wrap(Item.UnionCase(UnionCaseInfo(_, UCRef(tcref, n))))-> hash(tcref.Stamp, n)
545+
| Wrap(Item.UnionCase(UnionCaseInfo(_, UCRef(tcref, n)),_))-> hash(tcref.Stamp, n)
546546
| Wrap(Item.RecdField(RecdFieldInfo(_, RFRef(tcref, n))))-> hash(tcref.Stamp, n)
547547
| Wrap(Item.Event evt)-> evt.ComputeHashCode()
548548
| Wrap(Item.Property(_name, pis))-> hash(pis|> List.map(fun pi-> pi.ComputeHashCode()))
@@ -611,7 +611,7 @@ module internal ItemDescriptionsImpl =
611611
DataTipElement(text, xml)
612612

613613
// Union tags (constructors)
614-
| Item.UnionCaseucinfo->
614+
| Item.UnionCase(ucinfo,_)->
615615
letuc= ucinfo.UnionCase
616616
letrty= generalizedTyconRef ucinfo.TyconRef
617617
letrecd= uc.RecdFields
@@ -886,7 +886,7 @@ module internal ItemDescriptionsImpl =
886886
bufferL os tpcsL
887887
else
888888
bufferL os(NicePrint.layoutPrettifiedTypeAndConstraints denv[] tau)
889-
| Item.UnionCaseucinfo->
889+
| Item.UnionCase(ucinfo,_)->
890890
letrty= generalizedTyconRef ucinfo.TyconRef
891891
NicePrint.outputTy denv os rty
892892
| Item.ActivePatternCase(apref)->
@@ -970,7 +970,7 @@ module internal ItemDescriptionsImpl =
970970
| Item.Value vref| Item.CustomBuilder(_,vref)-> getKeywordForValRef vref
971971
| Item.ActivePatternCase apref-> apref.ActivePatternVal|> getKeywordForValRef
972972

973-
| Item.UnionCaseucinfo->
973+
| Item.UnionCase(ucinfo,_)->
974974
(ucinfo.TyconRef|> ticksAndArgCountTextOfTyconRef)+"."+ucinfo.Name|> Some
975975

976976
| Item.RecdField rfi->

‎src/fsharp/vs/service.fs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ module internal Params =
180180
|> List.map ParamNameAndType.FromArgInfo
181181
|> List.map(fun(ParamNameAndType(nmOpt,pty))-> ParamData(false,false, NotOptional, nmOpt, ReflectedArgInfo.None, pty))
182182
ParamsOfParamDatas g denv paramDatas returnTy
183-
| Item.UnionCase(ucr)->
183+
| Item.UnionCase(ucr,_)->
184184
match ucr.UnionCase.RecdFieldswith
185185
|[f]->[ParamOfUnionCaseField g denv NicePrint.isGeneratedUnionCaseField-1 f]
186186
| fs-> fs|> List.mapi(ParamOfUnionCaseField g denv NicePrint.isGeneratedUnionCaseField)
@@ -294,7 +294,7 @@ type MethodOverloads( name: string, unsortedMethods: Method[] ) =
294294
if isFunction g rfinfo.FieldTypethen[item]else[]
295295
| Item.Value v->
296296
if isFunction g v.Typethen[item]else[]
297-
| Item.UnionCase(ucr)->
297+
| Item.UnionCase(ucr,_)->
298298
ifnot ucr.UnionCase.IsNullarythen[item]else[]
299299
| Item.ExnCase(ecr)->
300300
if recdFieldsOfExnDefRef ecr|> nonNilthen[item]else[]

‎tests/fsharp/typecheck/sigs/neg90.bsl‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ neg90.fs(4,9,4,12): typecheck error FS0001: A generic construct requires that th
44
neg90.fs(7,22,7,25): typecheck error FS0039: The type 'foo' isnot defined
55

66
neg90.fs(7,22,7,25): typecheck error FS0039: The type 'foo' isnot defined
7+
8+
neg90.fs(16,9,16,21): typecheck error FS0035: This construct is deprecated: The union typefor union case 'Member' was defined with the RequireQualifiedAccessAttribute. Include the name of the uniontype('DU')in the name you are using.'

‎tests/fsharp/typecheck/sigs/neg90.fs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,11 @@ let _ = foo<Recd>()
66
// See https://github.com/Microsoft/visualfsharp/issues/38
77
type[<Measure>]N= foo// foo is undefined
88
typeM2= float<N>
9+
10+
11+
// See https://github.com/Microsoft/visualfsharp/issues/95
12+
moduleFirst=
13+
[<RequireQualifiedAccess>]
14+
typeDU= Memberofint
15+
16+
let_= First.Member(0)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp