Skip to content

Commit aaf4c11

Browse files
authored
Process longId for SynTypeDefnKind.Augmentation. (#15897)
* Process longId when for SynTypeDefnKind.Augmentation.
1 parent 70c0736 commit aaf4c11

File tree

2 files changed

+88
-3
lines changed

2 files changed

+88
-3
lines changed

src/Compiler/Driver/GraphChecking/FileContentMapping.fs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ let visitSynUnionCase (SynUnionCase (attributes = attributes; caseType = caseTyp
103103
let visitSynEnumCase (SynEnumCase (attributes = attributes)) = visitSynAttributes attributes
104104

105105
let visitSynTypeDefn
106-
(SynTypeDefn (typeInfo = SynComponentInfo (attributes = attributes; typeParams = typeParams; constraints = constraints)
106+
(SynTypeDefn (typeInfo = SynComponentInfo (attributes = attributes; longId = longId; typeParams = typeParams; constraints = constraints)
107107
typeRepr = typeRepr
108108
members = members))
109109
: FileContentEntry list =
@@ -131,6 +131,9 @@ let visitSynTypeDefn
131131
| SynTypeDefnKind.Delegate (signature, _) ->
132132
yield! visitSynType signature
133133
yield! List.collect visitSynMemberDefn members
134+
| SynTypeDefnKind.Augmentation _ ->
135+
yield! visitLongIdent longId
136+
yield! List.collect visitSynMemberDefn members
134137
| _ -> yield! List.collect visitSynMemberDefn members
135138
| SynTypeDefnRepr.Exception _ ->
136139
// This is only used in the typed tree
@@ -140,7 +143,10 @@ let visitSynTypeDefn
140143
]
141144

142145
let visitSynTypeDefnSig
143-
(SynTypeDefnSig (typeInfo = SynComponentInfo (attributes = attributes; typeParams = typeParams; constraints = constraints)
146+
(SynTypeDefnSig (typeInfo = SynComponentInfo (attributes = attributes
147+
longId = longId
148+
typeParams = typeParams
149+
constraints = constraints)
144150
typeRepr = typeRepr
145151
members = members))
146152
=
@@ -159,7 +165,10 @@ let visitSynTypeDefnSig
159165
| SynTypeDefnSimpleRepr.General _
160166
| SynTypeDefnSimpleRepr.LibraryOnlyILAssembly _ -> ()
161167
| SynTypeDefnSimpleRepr.TypeAbbrev (rhsType = rhsType) -> yield! visitSynType rhsType
162-
| SynTypeDefnSimpleRepr.None _
168+
// This is a type augmentation in a signature file
169+
| SynTypeDefnSimpleRepr.None _ ->
170+
yield! visitLongIdent longId
171+
yield! List.collect visitSynMemberSig members
163172
// This is only used in the typed tree
164173
// The parser doesn't construct this
165174
| SynTypeDefnSimpleRepr.Exception _ -> ()

tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/Scenarios.fs

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,4 +612,80 @@ open Foo.Bar.Y // Y.fs
612612
"""
613613
(set [| 1 |])
614614
]
615+
scenario
616+
"Identifier in type augmentation can link files"
617+
[
618+
sourceFile
619+
"PoolingValueTasks.fs"
620+
"""
621+
namespace IcedTasks
622+
623+
module PoolingValueTasks =
624+
type PoolingValueTaskBuilderBase() =
625+
class
626+
end
627+
"""
628+
Set.empty
629+
sourceFile
630+
"ColdTask.fs"
631+
"""
632+
namespace IcedTasks
633+
634+
module ColdTasks =
635+
module AsyncExtensions =
636+
type PoolingValueTasks.PoolingValueTaskBuilderBase with
637+
member this.Source (a:int) = a
638+
"""
639+
(set [| 0 |])
640+
]
641+
scenario
642+
"Identifier in type augmentation in signature file can link files"
643+
[
644+
sourceFile
645+
"PoolingValueTasks.fsi"
646+
"""
647+
namespace IcedTasks
648+
649+
module PoolingValueTasks =
650+
type PoolingValueTaskBuilderBase =
651+
class
652+
new: unit -> PoolingValueTaskBuilderBase
653+
end
654+
"""
655+
Set.empty
656+
sourceFile
657+
"PoolingValueTasks.fs"
658+
"""
659+
namespace IcedTasks
660+
661+
module PoolingValueTasks =
662+
type PoolingValueTaskBuilderBase() =
663+
class
664+
end
665+
"""
666+
(set [| 0 |])
667+
sourceFile
668+
"ColdTask.fsi"
669+
"""
670+
namespace IcedTasks
671+
672+
module ColdTasks =
673+
module AsyncExtensions =
674+
type PoolingValueTasks.PoolingValueTaskBuilderBase with
675+
676+
member Source: a: int -> int
677+
"""
678+
(set [| 0 |])
679+
sourceFile
680+
"ColdTask.fs"
681+
"""
682+
namespace IcedTasks
683+
684+
module ColdTasks =
685+
module AsyncExtensions =
686+
type PoolingValueTasks.PoolingValueTaskBuilderBase with
687+
member this.Source (a:int) = a
688+
"""
689+
(set [| 0; 2 |])
690+
]
615691
]

0 commit comments

Comments
 (0)