Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/Compiler/Checking/CheckExpressions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5190,6 +5190,12 @@ and TcExprThen (cenv: cenv) overallTy env tpenv isArg synExpr delayed =

match synExpr with

// A.
// A.B.
| SynExpr.DiscardAfterMissingQualificationAfterDot (expr1, _, m) ->
let _, _, tpenv = suppressErrorReporting (fun () -> TcExprOfUnknownTypeThen cenv env tpenv expr1 [DelayedDot])
mkDefault(m, overallTy.Commit), tpenv

// A
// A.B.C
| LongOrSingleIdent (isOpt, longId, altNameRefCellOpt, mLongId) ->
Expand Down Expand Up @@ -5457,7 +5463,8 @@ and TcExprUndelayed (cenv: cenv) (overallTy: OverallTy) env tpenv (synExpr: SynE
| SynExpr.LongIdent _
| SynExpr.App _
| SynExpr.Dynamic _
| SynExpr.DotGet _ ->
| SynExpr.DotGet _
| SynExpr.DiscardAfterMissingQualificationAfterDot _ ->
error(Error(FSComp.SR.tcExprUndelayed(), synExpr.Range))

| SynExpr.Const (SynConst.String (s, _, m), _) ->
Expand Down Expand Up @@ -5602,10 +5609,6 @@ and TcExprUndelayed (cenv: cenv) (overallTy: OverallTy) env tpenv (synExpr: SynE
//SolveTypeAsError cenv env.DisplayEnv m overallTy
mkDefault(m, overallTy.Commit), tpenv

| SynExpr.DiscardAfterMissingQualificationAfterDot (expr1, _, m) ->
let _, _, tpenv = suppressErrorReporting (fun () -> TcExprOfUnknownTypeThen cenv env tpenv expr1 [DelayedDot])
mkDefault(m, overallTy.Commit), tpenv

| SynExpr.FromParseError (expr1, m) ->
//SolveTypeAsError cenv env.DisplayEnv m overallTy
let _, tpenv = suppressErrorReporting (fun () -> TcExpr cenv overallTy env tpenv expr1)
Expand Down
54 changes: 54 additions & 0 deletions tests/service/Symbols.fs
Original file line number Diff line number Diff line change
Expand Up @@ -373,3 +373,57 @@ let tester2: int Group = []
|> shouldEqual $"int array{rank}d"

| other -> Assert.Fail(sprintf "myArr was supposed to be a value, but is %A" other)

[<Test>]
let ``Unfinished long ident type `` () =
let _, checkResults = getParseAndCheckResults """
let g (s: string) = ()

let f1 a1 a2 a3 a4 =
if true then
a1
a2

a3
a4

g a2
g a4

let f2 b1 b2 b3 b4 b5 =
if true then
b1.
b2.
b5.

b3.
b4.

g b2
g b4
g b5.
"""
let symbolTypes =
["a1", Some "unit"
"a2", Some "unit"
"a3", Some "unit"
"a4", Some "unit"

"b1", None
"b2", Some "string"
"b3", None
"b4", Some "string"
"b5", None]
|> dict

for symbol in getSymbolUses checkResults |> getSymbols do
match symbol with
| :? FSharpMemberOrFunctionOrValue as mfv ->
match symbolTypes.TryGetValue(mfv.DisplayName) with
| true, Some expectedType ->
mfv.FullType.TypeDefinition.DisplayName |> should equal expectedType
| true, None ->
mfv.FullType.IsGenericParameter |> should equal true
mfv.FullType.AllInterfaces.Count |> should equal 0
| _ -> ()
| _ -> ()