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
7 changes: 7 additions & 0 deletions src/Compiler/Checking/CheckExpressions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4369,6 +4369,9 @@ and TcTypeOrMeasure kindOpt (cenv: cenv) newOk checkConstraints occ (iwsam: Warn
// The inner types are expected to be collected by (|TypesForTypar|) at this point.
error(Error((FSComp.SR.tcSynTypeOrInvalidInDeclaration()), m))

| SynType.FromParseError _ ->
NewErrorType (), tpenv

and CheckIWSAM (cenv: cenv) (env: TcEnv) checkConstraints iwsam m tcref =
let g = cenv.g
let ty = generalizedTyconRef g tcref
Expand Down Expand Up @@ -4561,6 +4564,10 @@ and TcTypeMeasureApp kindOpt (cenv: cenv) newOk checkConstraints occ env tpenv a
| _ ->
errorR(Error(FSComp.SR.tcTypeParameterInvalidAsTypeConstructor(), m))
NewErrorType (), tpenv

| StripParenTypes(SynType.FromParseError _) ->
NewErrorType (), tpenv

| _ ->
errorR(Error(FSComp.SR.tcIllegalSyntaxInTypeExpression(), m))
NewErrorType (), tpenv
Expand Down
1 change: 1 addition & 0 deletions src/Compiler/Driver/GraphChecking/FileContentMapping.fs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ let visitSynType (t: SynType) : FileContentEntry list =
| SynType.Or (lhsType, rhsType, _, _) ->
let continuations = List.map visit [ lhsType; rhsType ]
Continuation.concatenate continuations continuation
| SynType.FromParseError _ -> continuation []

visit t id

Expand Down
3 changes: 2 additions & 1 deletion src/Compiler/Service/ServiceParseTreeWalk.fs
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,8 @@ module SyntaxTraversal =
| SynType.AnonRecd _
| SynType.LongIdent _
| SynType.Var _
| SynType.StaticConstant _ -> None
| SynType.StaticConstant _
| SynType.FromParseError _ -> None

visitor.VisitType(origPath, defaultTraverse, ty)

Expand Down
6 changes: 4 additions & 2 deletions src/Compiler/Service/ServiceParsedInputOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,8 @@ module ParsedInput =
| SynType.AnonRecd _
| SynType.LongIdent _
| SynType.Var _
| SynType.StaticConstant _ -> None
| SynType.StaticConstant _
| SynType.FromParseError _ -> None

and walkClause clause =
let (SynMatchClause (pat = pat; whenExpr = e1; resultExpr = e2)) = clause
Expand Down Expand Up @@ -1701,7 +1702,8 @@ module ParsedInput =
| SynType.Anon _
| SynType.AnonRecd _
| SynType.Var _
| SynType.StaticConstant _ -> ()
| SynType.StaticConstant _
| SynType.FromParseError _ -> ()

and walkClause (SynMatchClause (pat = pat; whenExpr = e1; resultExpr = e2)) =
walkPat pat
Expand Down
5 changes: 4 additions & 1 deletion src/Compiler/SyntaxTree/SyntaxTree.fs
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,8 @@ type SynType =

| Or of lhsType: SynType * rhsType: SynType * range: range * trivia: SynTypeOrTrivia

| FromParseError of range: range

member x.Range =
match x with
| SynType.App (range = m)
Expand All @@ -459,7 +461,8 @@ type SynType =
| SynType.MeasurePower (range = m)
| SynType.Paren (range = m)
| SynType.SignatureParameter (range = m)
| SynType.Or (range = m) -> m
| SynType.Or (range = m)
| SynType.FromParseError (range = m) -> m
| SynType.LongIdent lidwd -> lidwd.Range

[<NoEquality; NoComparison; RequireQualifiedAccess>]
Expand Down
3 changes: 3 additions & 0 deletions src/Compiler/SyntaxTree/SyntaxTree.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,9 @@ type SynType =
/// F# syntax: ^a or ^b, used in trait calls
| Or of lhsType: SynType * rhsType: SynType * range: range * trivia: SynTypeOrTrivia

/// A type arising from a parse error
| FromParseError of range: range

/// Gets the syntax range of this construct
member Range: range

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8389,6 +8389,8 @@ FSharp.Compiler.Syntax.SynType+Array: FSharp.Compiler.Text.Range get_range()
FSharp.Compiler.Syntax.SynType+Array: FSharp.Compiler.Text.Range range
FSharp.Compiler.Syntax.SynType+Array: Int32 get_rank()
FSharp.Compiler.Syntax.SynType+Array: Int32 rank
FSharp.Compiler.Syntax.SynType+FromParseError: FSharp.Compiler.Text.Range get_range()
FSharp.Compiler.Syntax.SynType+FromParseError: FSharp.Compiler.Text.Range range
FSharp.Compiler.Syntax.SynType+Fun: FSharp.Compiler.Syntax.SynType argType
FSharp.Compiler.Syntax.SynType+Fun: FSharp.Compiler.Syntax.SynType get_argType()
FSharp.Compiler.Syntax.SynType+Fun: FSharp.Compiler.Syntax.SynType get_returnType()
Expand Down Expand Up @@ -8463,6 +8465,7 @@ FSharp.Compiler.Syntax.SynType+Tags: Int32 Anon
FSharp.Compiler.Syntax.SynType+Tags: Int32 AnonRecd
FSharp.Compiler.Syntax.SynType+Tags: Int32 App
FSharp.Compiler.Syntax.SynType+Tags: Int32 Array
FSharp.Compiler.Syntax.SynType+Tags: Int32 FromParseError
FSharp.Compiler.Syntax.SynType+Tags: Int32 Fun
FSharp.Compiler.Syntax.SynType+Tags: Int32 HashConstraint
FSharp.Compiler.Syntax.SynType+Tags: Int32 LongIdent
Expand Down Expand Up @@ -8497,6 +8500,7 @@ FSharp.Compiler.Syntax.SynType: Boolean IsAnon
FSharp.Compiler.Syntax.SynType: Boolean IsAnonRecd
FSharp.Compiler.Syntax.SynType: Boolean IsApp
FSharp.Compiler.Syntax.SynType: Boolean IsArray
FSharp.Compiler.Syntax.SynType: Boolean IsFromParseError
FSharp.Compiler.Syntax.SynType: Boolean IsFun
FSharp.Compiler.Syntax.SynType: Boolean IsHashConstraint
FSharp.Compiler.Syntax.SynType: Boolean IsLongIdent
Expand All @@ -8515,6 +8519,7 @@ FSharp.Compiler.Syntax.SynType: Boolean get_IsAnon()
FSharp.Compiler.Syntax.SynType: Boolean get_IsAnonRecd()
FSharp.Compiler.Syntax.SynType: Boolean get_IsApp()
FSharp.Compiler.Syntax.SynType: Boolean get_IsArray()
FSharp.Compiler.Syntax.SynType: Boolean get_IsFromParseError()
FSharp.Compiler.Syntax.SynType: Boolean get_IsFun()
FSharp.Compiler.Syntax.SynType: Boolean get_IsHashConstraint()
FSharp.Compiler.Syntax.SynType: Boolean get_IsLongIdent()
Expand All @@ -8533,6 +8538,7 @@ FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewAnon(FSharp.Co
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewAnonRecd(Boolean, Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.Syntax.Ident,FSharp.Compiler.Syntax.SynType]], FSharp.Compiler.Text.Range)
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewApp(FSharp.Compiler.Syntax.SynType, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], Boolean, FSharp.Compiler.Text.Range)
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewArray(Int32, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range)
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewFromParseError(FSharp.Compiler.Text.Range)
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewFun(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynTypeFunTrivia)
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewHashConstraint(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range)
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewLongIdent(FSharp.Compiler.Syntax.SynLongIdent)
Expand All @@ -8551,6 +8557,7 @@ FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+Anon
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+AnonRecd
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+App
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+Array
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+FromParseError
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+Fun
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+HashConstraint
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+LongIdent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8389,6 +8389,8 @@ FSharp.Compiler.Syntax.SynType+Array: FSharp.Compiler.Text.Range get_range()
FSharp.Compiler.Syntax.SynType+Array: FSharp.Compiler.Text.Range range
FSharp.Compiler.Syntax.SynType+Array: Int32 get_rank()
FSharp.Compiler.Syntax.SynType+Array: Int32 rank
FSharp.Compiler.Syntax.SynType+FromParseError: FSharp.Compiler.Text.Range get_range()
FSharp.Compiler.Syntax.SynType+FromParseError: FSharp.Compiler.Text.Range range
FSharp.Compiler.Syntax.SynType+Fun: FSharp.Compiler.Syntax.SynType argType
FSharp.Compiler.Syntax.SynType+Fun: FSharp.Compiler.Syntax.SynType get_argType()
FSharp.Compiler.Syntax.SynType+Fun: FSharp.Compiler.Syntax.SynType get_returnType()
Expand Down Expand Up @@ -8463,6 +8465,7 @@ FSharp.Compiler.Syntax.SynType+Tags: Int32 Anon
FSharp.Compiler.Syntax.SynType+Tags: Int32 AnonRecd
FSharp.Compiler.Syntax.SynType+Tags: Int32 App
FSharp.Compiler.Syntax.SynType+Tags: Int32 Array
FSharp.Compiler.Syntax.SynType+Tags: Int32 FromParseError
FSharp.Compiler.Syntax.SynType+Tags: Int32 Fun
FSharp.Compiler.Syntax.SynType+Tags: Int32 HashConstraint
FSharp.Compiler.Syntax.SynType+Tags: Int32 LongIdent
Expand Down Expand Up @@ -8497,6 +8500,7 @@ FSharp.Compiler.Syntax.SynType: Boolean IsAnon
FSharp.Compiler.Syntax.SynType: Boolean IsAnonRecd
FSharp.Compiler.Syntax.SynType: Boolean IsApp
FSharp.Compiler.Syntax.SynType: Boolean IsArray
FSharp.Compiler.Syntax.SynType: Boolean IsFromParseError
FSharp.Compiler.Syntax.SynType: Boolean IsFun
FSharp.Compiler.Syntax.SynType: Boolean IsHashConstraint
FSharp.Compiler.Syntax.SynType: Boolean IsLongIdent
Expand All @@ -8515,6 +8519,7 @@ FSharp.Compiler.Syntax.SynType: Boolean get_IsAnon()
FSharp.Compiler.Syntax.SynType: Boolean get_IsAnonRecd()
FSharp.Compiler.Syntax.SynType: Boolean get_IsApp()
FSharp.Compiler.Syntax.SynType: Boolean get_IsArray()
FSharp.Compiler.Syntax.SynType: Boolean get_IsFromParseError()
FSharp.Compiler.Syntax.SynType: Boolean get_IsFun()
FSharp.Compiler.Syntax.SynType: Boolean get_IsHashConstraint()
FSharp.Compiler.Syntax.SynType: Boolean get_IsLongIdent()
Expand All @@ -8533,6 +8538,7 @@ FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewAnon(FSharp.Co
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewAnonRecd(Boolean, Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.Syntax.Ident,FSharp.Compiler.Syntax.SynType]], FSharp.Compiler.Text.Range)
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewApp(FSharp.Compiler.Syntax.SynType, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], Boolean, FSharp.Compiler.Text.Range)
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewArray(Int32, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range)
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewFromParseError(FSharp.Compiler.Text.Range)
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewFun(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynTypeFunTrivia)
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewHashConstraint(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range)
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewLongIdent(FSharp.Compiler.Syntax.SynLongIdent)
Expand All @@ -8551,6 +8557,7 @@ FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+Anon
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+AnonRecd
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+App
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+Array
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+FromParseError
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+Fun
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+HashConstraint
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+LongIdent
Expand Down