Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
DedSec256 committed Nov 13, 2023
1 parent 1e60265 commit 8128b34
Show file tree
Hide file tree
Showing 19 changed files with 142 additions and 74 deletions.
6 changes: 3 additions & 3 deletions src/Compiler/pars.fsy
Original file line number Diff line number Diff line change
Expand Up @@ -4892,7 +4892,7 @@ atomicExpr:
parseState.LexBuffer.CheckLanguageFeatureAndRecover LanguageFeature.AccessorFunctionShorthand mWhole

let mExpr = mDot.EndRange
if not $3 then reportParseErrorAt mExpr (FSComp.SR.parsUnexpectedEndOfFileExpression())
if not $3 then reportParseErrorAt mDot (FSComp.SR.parsUnexpectedEndOfFileExpression())

let expr = arbExpr ("dotLambda1", mExpr)
let trivia: SynExprDotLambdaTrivia = { UnderscoreRange = mUnderscore ; DotRange = Some mDot }
Expand All @@ -4903,11 +4903,11 @@ atomicExpr:
parseState.LexBuffer.CheckLanguageFeatureAndRecover LanguageFeature.AccessorFunctionShorthand mUnderscore

let mExpr = mUnderscore.EndRange
if not $2 then reportParseErrorAt mExpr (FSComp.SR.parsUnexpectedEndOfFileExpression())
if not $2 then reportParseErrorAt mUnderscore (FSComp.SR.parsUnexpectedEndOfFileExpression())

let expr = arbExpr ("dotLambda2", mExpr)
let trivia: SynExprDotLambdaTrivia = { UnderscoreRange = mUnderscore ; DotRange = None }
SynExpr.DotLambda(expr, mUnderscore, trivia), false }
SynExpr.FromParseError(SynExpr.Ident(Ident("_", mUnderscore)), mUnderscore), false }

| atomicExpr HIGH_PRECEDENCE_BRACK_APP atomicExpr
{ let arg1, _ = $1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let a = ( upcast _ ) : obj
let b = ( _ :> _ ) : obj
let c = ( _ :> obj)
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
ImplFile
(ParsedImplFileInput
("/root/Expression/DotLambda - _ Recovery - Casts.fsx", true,
QualifiedNameOfFile DotLambda - _ Recovery - Casts$fsx, [], [],
[SynModuleOrNamespace
([DotLambda - _ Recovery - Casts], false, AnonModule,
[Let
(false,
[SynBinding
(None, Normal, false, false, [],
PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector),
SynValData
(None, SynValInfo ([], SynArgInfo ([], false, None)), None,
None), Named (SynIdent (a, None), false, None, (1,4--1,5)),
None,
Typed
(Paren
(InferredUpcast
(FromParseError (Ident _, (1,17--1,18)), (1,10--1,18)),
(1,8--1,9), Some (1,19--1,20), (1,8--1,20)),
LongIdent (SynLongIdent ([obj], [], [None])), (1,8--1,26)),
(1,4--1,5), Yes (1,0--1,26), { LeadingKeyword = Let (1,0--1,3)
InlineKeyword = None
EqualsRange = Some (1,6--1,7) })],
(1,0--1,26));
Let
(false,
[SynBinding
(None, Normal, false, false, [],
PreXmlDoc ((2,0), FSharp.Compiler.Xml.XmlDocCollector),
SynValData
(None, SynValInfo ([], SynArgInfo ([], false, None)), None,
None), Named (SynIdent (b, None), false, None, (2,4--2,5)),
None,
Typed
(Paren
(Upcast
(FromParseError (Ident _, (2,10--2,11)),
Anon (2,15--2,16), (2,10--2,16)), (2,8--2,9),
Some (2,17--2,18), (2,8--2,18)),
LongIdent (SynLongIdent ([obj], [], [None])), (2,8--2,24)),
(2,4--2,5), Yes (2,0--2,24), { LeadingKeyword = Let (2,0--2,3)
InlineKeyword = None
EqualsRange = Some (2,6--2,7) })],
(2,0--2,24));
Let
(false,
[SynBinding
(None, Normal, false, false, [],
PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector),
SynValData
(None, SynValInfo ([], SynArgInfo ([], false, None)), None,
None), Named (SynIdent (c, None), false, None, (3,4--3,5)),
None,
Paren
(Upcast
(FromParseError (Ident _, (3,10--3,11)),
LongIdent (SynLongIdent ([obj], [], [None])),
(3,10--3,18)), (3,8--3,9), Some (3,18--3,19),
(3,8--3,19)), (3,4--3,5), Yes (3,0--3,19),
{ LeadingKeyword = Let (3,0--3,3)
InlineKeyword = None
EqualsRange = Some (3,6--3,7) })], (3,0--3,19))],
PreXmlDocEmpty, [], None, (1,0--4,0), { LeadingKeyword = None })],
(true, true), { ConditionalDirectives = []
CodeComments = [] }, set []))

(1,19)-(1,20) parse error Unexpected symbol ')' in expression. Expected '.' or other token.
(2,12)-(2,14) parse error Unexpected symbol ':>' in expression. Expected '.' or other token.
(3,12)-(3,14) parse error Unexpected symbol ':>' in expression. Expected '.' or other token.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
ImplFile
(ParsedImplFileInput
("/root/Expression/DotLambda - _ Recovery - Eof.fsx", true,
QualifiedNameOfFile DotLambda - _ Recovery - Eof$fsx, [], [],
[SynModuleOrNamespace
([DotLambda - _ Recovery - Eof], false, AnonModule,
[Expr
(App
(NonAtomic, false,
App
(NonAtomic, true,
LongIdent
(false,
SynLongIdent
([op_PipeRight], [], [Some (OriginalNotation "|>")]),
None, (1,2--1,4)), Const (Int32 1, (1,0--1,1)),
(1,0--1,4)), FromParseError (Ident _, (1,5--1,6)),
(1,0--1,6)), (1,0--1,6))], PreXmlDocEmpty, [], None, (1,0--1,6),
{ LeadingKeyword = None })], (true, true),
{ ConditionalDirectives = []
CodeComments = [] }, set []))

(1,5)-(1,6) parse error Unexpected end of input in expression
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ImplFile
(ParsedImplFileInput
("/root/Expression/DotLambda - _ Recovery.fsx", true,
QualifiedNameOfFile DotLambda - _ Recovery$fsx, [], [],
[SynModuleOrNamespace
([DotLambda - _ Recovery], false, AnonModule,
[Expr
(Paren
(FromParseError (Ident _, (1,1--1,2)), (1,0--1,1),
Some (1,2--1,3), (1,0--1,3)), (1,0--1,3))], PreXmlDocEmpty, [],
None, (1,0--1,3), { LeadingKeyword = None })], (true, true),
{ ConditionalDirectives = []
CodeComments = [] }, set []))

(1,2)-(1,3) parse error Unexpected symbol ')' in expression. Expected '.' or other token.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
ImplFile
(ParsedImplFileInput
("/root/DotLambda/_. Recovery - Eof.fsx", true,
QualifiedNameOfFile _. Recovery - Eof$fsx, [], [],
("/root/Expression/DotLambda - _. Recovery - Eof.fsx", true,
QualifiedNameOfFile DotLambda - _. Recovery - Eof$fsx, [], [],
[SynModuleOrNamespace
([_; Recovery - Eof], false, AnonModule,
([DotLambda - _; Recovery - Eof], false, AnonModule,
[Expr
(App
(NonAtomic, false,
Expand All @@ -23,4 +23,4 @@ ImplFile
(true, true), { ConditionalDirectives = []
CodeComments = [] }, set []))

(1,7)-(1,7) parse error Unexpected end of input in expression
(1,6)-(1,7) parse error Unexpected end of input in expression
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
ImplFile
(ParsedImplFileInput
("/root/DotLambda/_. Recovery.fsx", true,
QualifiedNameOfFile _. Recovery$fsx, [], [],
("/root/Expression/DotLambda - _. Recovery.fsx", true,
QualifiedNameOfFile DotLambda - _. Recovery$fsx, [], [],
[SynModuleOrNamespace
([_; Recovery], false, AnonModule,
([DotLambda - _; Recovery], false, AnonModule,
[Expr
(Paren
(DotLambda
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ImplFile
DotLambda
(Ident P, (1,10--1,13),
{ UnderscoreRange = (1,10--1,11)
DotRange = (1,11--1,12) }), (1,8--1,13)),
DotRange = Some (1,11--1,12) }), (1,8--1,13)),
Const (Int32 123, (1,14--1,17)), (1,8--1,17)), (1,4--1,5),
Yes (1,0--1,17), { LeadingKeyword = Let (1,0--1,3)
InlineKeyword = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ImplFile
(NonAtomic, false,
DotLambda
(Ident P, (1,8--1,11), { UnderscoreRange = (1,8--1,9)
DotRange = (1,9--1,10) }),
DotRange = Some (1,9--1,10) }),
Const (Int32 123, (1,12--1,15)), (1,8--1,15)), (1,4--1,5),
Yes (1,0--1,15), { LeadingKeyword = Let (1,0--1,3)
InlineKeyword = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ ImplFile
(Atomic, false, Ident ToString,
Const (Unit, (1,23--1,25)), (1,15--1,25)),
(1,13--1,25), { UnderscoreRange = (1,13--1,14)
DotRange = (1,14--1,15) }), (1,8--1,25)),
(1,4--1,5), NoneAtLet, { LeadingKeyword = Let (1,0--1,3)
InlineKeyword = None
EqualsRange = Some (1,6--1,7) })],
(1,0--1,25))], PreXmlDocEmpty, [], None, (1,0--1,25),
{ LeadingKeyword = None })], (true, true),
{ ConditionalDirectives = []
CodeComments = [] }, set []))
DotRange = Some (1,14--1,15) }),
(1,8--1,25)), (1,4--1,5), NoneAtLet,
{ LeadingKeyword = Let (1,0--1,3)
InlineKeyword = None
EqualsRange = Some (1,6--1,7) })], (1,0--1,25))],
PreXmlDocEmpty, [], None, (1,0--1,25), { LeadingKeyword = None })],
(true, true), { ConditionalDirectives = []
CodeComments = [] }, set []))
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ImplFile
(App
(Atomic, false, Ident ToString, Const (Unit, (1,15--1,17)),
(1,7--1,17)), (1,5--1,17), { UnderscoreRange = (1,5--1,6)
DotRange = (1,6--1,7) }),
DotRange = Some (1,6--1,7) }),
(1,0--1,17)), (1,0--1,17))], PreXmlDocEmpty, [], None,
(1,0--1,17), { LeadingKeyword = None })], (true, true),
{ ConditionalDirectives = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ ImplFile
DotLambda
(Ident MyMethodCall, (1,13--1,27),
{ UnderscoreRange = (1,13--1,14)
DotRange = (1,14--1,15) }), Const (Unit, (1,28--1,30)),
(1,13--1,30)), (1,4--1,10), Yes (1,0--1,30),
{ LeadingKeyword = Let (1,0--1,3)
InlineKeyword = None
EqualsRange = Some (1,11--1,12) })], (1,0--1,30))],
PreXmlDocEmpty, [], None, (1,0--1,30), { LeadingKeyword = None })],
(true, true), { ConditionalDirectives = []
CodeComments = [] }, set []))
DotRange = Some (1,14--1,15) }),
Const (Unit, (1,28--1,30)), (1,13--1,30)), (1,4--1,10),
Yes (1,0--1,30), { LeadingKeyword = Let (1,0--1,3)
InlineKeyword = None
EqualsRange = Some (1,11--1,12) })],
(1,0--1,30))], PreXmlDocEmpty, [], None, (1,0--1,30),
{ LeadingKeyword = None })], (true, true),
{ ConditionalDirectives = []
CodeComments = [] }, set []))
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ImplFile
DotLambda
(Ident ThisIsMyFunction, (1,13--1,31),
{ UnderscoreRange = (1,13--1,14)
DotRange = (1,14--1,15) }), Ident a,
DotRange = Some (1,14--1,15) }), Ident a,
(1,13--1,33)), Ident b, (1,13--1,35)), Ident c,
(1,13--1,37)), (1,4--1,10), Yes (1,0--1,37),
{ LeadingKeyword = Let (1,0--1,3)
Expand Down
26 changes: 0 additions & 26 deletions tests/service/data/SyntaxTree/Expression/_ Recovery - Eof.fsx.bsl

This file was deleted.

18 changes: 0 additions & 18 deletions tests/service/data/SyntaxTree/Expression/_ Recovery.fsx.bsl

This file was deleted.

0 comments on commit 8128b34

Please sign in to comment.