Skip to content

Commit 92c68a4

Browse files
committed
Merge pull request #425 from dsyme/fix-177
Fix 177
2 parents c1caa0a + 0334812 commit 92c68a4

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

src/fsharp/NameResolution.fs

+6-3
Original file line numberDiff line numberDiff line change
@@ -1884,11 +1884,14 @@ let rec ResolveLongIdentInTypePrim (ncenv:NameResolver) nenv lookupKind (resInfo
18841884
| ResolveTypeNamesToTypeRefs ->
18851885
OneSuccess (resInfo,Item.Types (nm,nestedTypes),rest)
18861886
else
1887-
ResolveLongIdentInTypes ncenv nenv lookupKind resInfo (depth+1) m ad rest findFlag typeNameResInfo nestedTypes
1887+
ResolveLongIdentInNestedTypes ncenv nenv lookupKind resInfo (depth+1) id m ad rest findFlag typeNameResInfo nestedTypes
18881888
(OneResult contentsSearchAccessible +++ nestedSearchAccessible)
18891889

1890-
and ResolveLongIdentInTypes (ncenv:NameResolver) nenv lookupKind resInfo depth m ad lid findFlag typeNameResInfo typs =
1891-
typs |> CollectResults (ResolveLongIdentInTypePrim ncenv nenv lookupKind resInfo depth m ad lid findFlag typeNameResInfo >> AtMostOneResult m)
1890+
and ResolveLongIdentInNestedTypes (ncenv:NameResolver) nenv lookupKind resInfo depth id m ad lid findFlag typeNameResInfo typs =
1891+
typs |> CollectResults (fun typ ->
1892+
let resInfo = if isAppTy ncenv.g typ then resInfo.AddEntity(id.idRange,tcrefOfAppTy ncenv.g typ) else resInfo
1893+
ResolveLongIdentInTypePrim ncenv nenv lookupKind resInfo depth m ad lid findFlag typeNameResInfo typ
1894+
|> AtMostOneResult m)
18921895

18931896
/// Resolve a long identifer using type-qualified name resolution.
18941897
let ResolveLongIdentInType sink ncenv nenv lookupKind m ad lid findFlag typeNameResInfo typ =

tests/service/CSharpProjectAnalysis.fs

+3-4
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ let ``Test that csharp references are recognized as such`` () =
9393
| None ->
9494
Assert.Fail ("CSharpClass was not found in CSharp_Analysis assembly!")
9595

96-
[<Test; Ignore("Failing test for https://github.com/fsharp/FSharp.Compiler.Service/issues/177")>]
96+
[<Test>]
9797
let ``Test that symbols of csharp inner classes/enums are reported`` () =
9898
let csharpAssembly = typeof<CSharpClass>.Assembly.Location
9999
let content = """
@@ -109,6 +109,5 @@ let _ = CSharpOuterClass.InnerClass.StaticMember()
109109
|> Async.RunSynchronously
110110
|> Array.map (fun su -> su.Symbol.ToString())
111111
|> shouldEqual
112-
[|"CSharpOuterClass"; "InnerEnum"; "symbol Case1";
113-
"CSharpOuterClass"; "InnerClass"; "val StaticMember";
114-
"NestedEnumClass"|]
112+
[|"InnerEnum"; "CSharpOuterClass"; "symbol Case1"; "InnerClass";
113+
"CSharpOuterClass"; "member StaticMember"; "NestedEnumClass"|]

tests/service/EditorTests.fs

+6-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ let ``Intro test`` () =
3535
let inputLines = input.Split('\n')
3636
let file = "/home/user/Test.fsx"
3737
let untyped, typeCheckResults = parseAndTypeCheckFileInProject(file, input)
38-
let identToken = Parser.tagOfToken(Parser.token.IDENT(""))
38+
let identToken = FSharpTokenTag.IDENT
3939

4040
// We only expect one reported error. However,
4141
// on Unix, using filenames like /home/user/Test.fsx gives a second copy of all parse errors due to the
@@ -216,7 +216,7 @@ let ``Expression typing test`` () =
216216
let inputLines = input3.Split('\n')
217217
let file = "/home/user/Test.fsx"
218218
let untyped, typeCheckResults = parseAndTypeCheckFileInProject(file, input3)
219-
let identToken = Parser.tagOfToken(Parser.token.IDENT(""))
219+
let identToken = FSharpTokenTag.IDENT
220220

221221
// We only expect one reported error. However,
222222
// on Unix, using filenames like /home/user/Test.fsx gives a second copy of all parse errors due to the
@@ -239,6 +239,10 @@ let ``Expression typing test`` () =
239239
"StartsWith"; "Substring"; "ToCharArray"; "ToLower"; "ToLowerInvariant";
240240
"ToString"; "ToUpper"; "ToUpperInvariant"; "Trim"; "TrimEnd"; "TrimStart"])
241241

242+
// The underlying problem is that the parser error recovery doesn't include _any_ information for
243+
// the incomplete member:
244+
// member x.Test =
245+
242246
[<Test; Ignore("Currently failing, see #139")>]
243247
let ``Find function from member 1`` () =
244248
let input =

tests/service/FsiTests.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ let ``ParseAndCheckInteraction test 1``() =
142142

143143
// Check we can't get a declaration location for text in the F# interactive state (because the file doesn't exist)
144144
// TODO: check that if we use # line directives, then the file will exist correctly
145-
let identToken = Parser.tagOfToken(Parser.token.IDENT(""))
145+
let identToken = FSharpTokenTag.IDENT
146146
typedResults.GetDeclarationLocationAlternate(1,6,"xxxxxx",["xxxxxx"]) |> Async.RunSynchronously |> shouldEqual (FSharpFindDeclResult.DeclNotFound FSharpFindDeclFailureReason.NoSourceCode)
147147

148148
// Check we can get a tooltip for text in the F# interactive state

0 commit comments

Comments
 (0)