-
Notifications
You must be signed in to change notification settings - Fork 830
Closed
Labels
BugImpact-High(Internal MS Team use only) Describes an issue with extreme impact on existing code.(Internal MS Team use only) Describes an issue with extreme impact on existing code.Regression
Milestone
Description
Expressions other than properties/method calls/indexing are allowed after _.
in dot-lambdas (see fsharp/fslang-suggestions#506, fsharp/fslang-design#710). I think this is a bug in #13907, unless there's something I'm missing from fsharp/fslang-design#710.
Repro steps
- Write a dot-lambda and put a literal or most any other atomic expression after the dot. This effectively means any arbitrarily-complex expression, as long as it's parenthesized.
_.expr
compiles asfun _ -> expr
, i.e., basicallyfun x -> ignore x; expr
.
let _ = _.3
let _ = _.1e-04
let _ = _."🙃"
let _ = _.[||]
let _ = _.{||}
let _ = _.typeof<int>
let _ = _.null
let _ = _.__SOURCE_DIRECTORY__
let _ = _.(<@ 1 @>)
let _ = _.(nameof nameof)
let _ = _.struct (1, 2, 3)
let _ = _.{ new System.IDisposable with member _.Dispose () = () }
let _ = _.(while true do ())
let _ = _.(let x = 3 in x + x)
Expected behavior
This was surprising to me. I would have expected only properties, method calls, or indexing to be allowed.
Actual behavior
Any arbitrary expression can be used on the right-hand side of a dot-lambda (_.
).
Known workarounds
N/A.
Related information
This is in main
and in the latest .NET 8 SDK.
T-Gro, edgarfgp, charlesroddie and DedSec256
Metadata
Metadata
Assignees
Labels
BugImpact-High(Internal MS Team use only) Describes an issue with extreme impact on existing code.(Internal MS Team use only) Describes an issue with extreme impact on existing code.Regression
Type
Projects
Status
Done