diff --git a/src/Compiler/Driver/GraphChecking/FileContentMapping.fs b/src/Compiler/Driver/GraphChecking/FileContentMapping.fs index d2ed455d2a6..cfcdfa703c1 100644 --- a/src/Compiler/Driver/GraphChecking/FileContentMapping.fs +++ b/src/Compiler/Driver/GraphChecking/FileContentMapping.fs @@ -103,7 +103,7 @@ let visitSynUnionCase (SynUnionCase (attributes = attributes; caseType = caseTyp let visitSynEnumCase (SynEnumCase (attributes = attributes)) = visitSynAttributes attributes let visitSynTypeDefn - (SynTypeDefn (typeInfo = SynComponentInfo (attributes = attributes; typeParams = typeParams; constraints = constraints) + (SynTypeDefn (typeInfo = SynComponentInfo (attributes = attributes; longId = longId; typeParams = typeParams; constraints = constraints) typeRepr = typeRepr members = members)) : FileContentEntry list = @@ -131,6 +131,9 @@ let visitSynTypeDefn | SynTypeDefnKind.Delegate (signature, _) -> yield! visitSynType signature yield! List.collect visitSynMemberDefn members + | SynTypeDefnKind.Augmentation _ -> + yield! visitLongIdent longId + yield! List.collect visitSynMemberDefn members | _ -> yield! List.collect visitSynMemberDefn members | SynTypeDefnRepr.Exception _ -> // This is only used in the typed tree @@ -140,7 +143,10 @@ let visitSynTypeDefn ] let visitSynTypeDefnSig - (SynTypeDefnSig (typeInfo = SynComponentInfo (attributes = attributes; typeParams = typeParams; constraints = constraints) + (SynTypeDefnSig (typeInfo = SynComponentInfo (attributes = attributes + longId = longId + typeParams = typeParams + constraints = constraints) typeRepr = typeRepr members = members)) = @@ -159,7 +165,10 @@ let visitSynTypeDefnSig | SynTypeDefnSimpleRepr.General _ | SynTypeDefnSimpleRepr.LibraryOnlyILAssembly _ -> () | SynTypeDefnSimpleRepr.TypeAbbrev (rhsType = rhsType) -> yield! visitSynType rhsType - | SynTypeDefnSimpleRepr.None _ + // This is a type augmentation in a signature file + | SynTypeDefnSimpleRepr.None _ -> + yield! visitLongIdent longId + yield! List.collect visitSynMemberSig members // This is only used in the typed tree // The parser doesn't construct this | SynTypeDefnSimpleRepr.Exception _ -> () diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/Scenarios.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/Scenarios.fs index ed02db8e517..7931861dcfb 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/Scenarios.fs +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/Scenarios.fs @@ -612,4 +612,80 @@ open Foo.Bar.Y // Y.fs """ (set [| 1 |]) ] + scenario + "Identifier in type augmentation can link files" + [ + sourceFile + "PoolingValueTasks.fs" + """ +namespace IcedTasks + +module PoolingValueTasks = + type PoolingValueTaskBuilderBase() = + class + end +""" + Set.empty + sourceFile + "ColdTask.fs" + """ +namespace IcedTasks + +module ColdTasks = + module AsyncExtensions = + type PoolingValueTasks.PoolingValueTaskBuilderBase with + member this.Source (a:int) = a +""" + (set [| 0 |]) + ] + scenario + "Identifier in type augmentation in signature file can link files" + [ + sourceFile + "PoolingValueTasks.fsi" + """ +namespace IcedTasks + +module PoolingValueTasks = + type PoolingValueTaskBuilderBase = + class + new: unit -> PoolingValueTaskBuilderBase + end +""" + Set.empty + sourceFile + "PoolingValueTasks.fs" + """ +namespace IcedTasks + +module PoolingValueTasks = + type PoolingValueTaskBuilderBase() = + class + end +""" + (set [| 0 |]) + sourceFile + "ColdTask.fsi" + """ +namespace IcedTasks + +module ColdTasks = + module AsyncExtensions = + type PoolingValueTasks.PoolingValueTaskBuilderBase with + + member Source: a: int -> int +""" + (set [| 0 |]) + sourceFile + "ColdTask.fs" + """ +namespace IcedTasks + +module ColdTasks = + module AsyncExtensions = + type PoolingValueTasks.PoolingValueTaskBuilderBase with + member this.Source (a:int) = a +""" + (set [| 0; 2 |]) + ] ]