Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider '_' for members with access modifiers #7631

Merged
merged 4 commits into from
Oct 1, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 5 additions & 0 deletions src/fsharp/pars.fsy
Original file line number Diff line number Diff line change
Expand Up @@ -1924,6 +1924,11 @@ atomicPatternLongIdent:
}
| 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
cartermp marked this conversation as resolved.
Show resolved Hide resolved
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) }


Expand Down
9 changes: 9 additions & 0 deletions tests/fsharp/core/members/basics/test.fs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ let test (s : string) b =

let check s b1 b2 = test s (b1 = b2)

//--------------------------------------------------------------
// Test defining a type using wildcard self identifiers

type ClassType0 () =
member _.myNumber () = 0
member private _.myPrivateNumber () = 1
cartermp marked this conversation as resolved.
Show resolved Hide resolved
member inline _.myInlineNumber () = 2
member inline private _.myPrivateInlineNumber () = 3

//--------------------------------------------------------------
// Test defining a record using object-expression syntax

Expand Down