From 0ef7dbe3ee2e6e6de118bb0ef32f7136bbc91917 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Thu, 27 Feb 2020 19:54:58 +0300 Subject: [PATCH] Fix wild self id pat range, simplify grammar --- src/fsharp/pars.fsy | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/fsharp/pars.fsy b/src/fsharp/pars.fsy index 66ee0bd792e0..3189ef020602 100644 --- a/src/fsharp/pars.fsy +++ b/src/fsharp/pars.fsy @@ -1933,18 +1933,12 @@ opt_typ: | COLON typ { Some $2 } atomicPatternLongIdent: - | UNDERSCORE DOT pathOp { + | opt_access UNDERSCORE DOT pathOp { if not (parseState.LexBuffer.SupportsFeature LanguageFeature.SingleUnderscorePattern) then - raiseParseErrorAt (rhs parseState 2) (FSComp.SR.parsUnexpectedSymbolDot()) - let (LongIdentWithDots(lid,dotms)) = $3 in (None,LongIdentWithDots(ident("_",rhs parseState 1)::lid, rhs parseState 2::dotms)) - } + raiseParseErrorAt (rhs parseState 3) (FSComp.SR.parsUnexpectedSymbolDot()) + let (LongIdentWithDots(lid,dotms)) = $4 in ($1,LongIdentWithDots(ident("_", rhs parseState 2) :: lid, rhs parseState 3 :: dotms)) } | GLOBAL DOT pathOp { let (LongIdentWithDots(lid,dotms)) = $3 in (None,LongIdentWithDots(ident(MangledGlobalName,rhs parseState 1) :: lid, rhs parseState 2 :: dotms)) } | pathOp { (None,$1) } - | access UNDERSCORE DOT pathOp { - if not (parseState.LexBuffer.SupportsFeature LanguageFeature.SingleUnderscorePattern) then - raiseParseErrorAt (rhs parseState 2) (FSComp.SR.parsUnexpectedSymbolDot()) - let (LongIdentWithDots(lid,dotms)) = $4 in (Some($1),LongIdentWithDots(ident("_",rhs parseState 1)::lid, rhs parseState 2::dotms)) - } | access pathOp { (Some($1), $2) }