-
Notifications
You must be signed in to change notification settings - Fork 830
Closed
Labels
Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingType checking, attributes and all aspects of logic checkingBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.(Internal MS Team use only) Describes an issue with moderate impact on existing code.
Milestone
Description
Consider this:
type A = { X: int }
type B = { X: int }
let _x: (A -> int) list = [
fun a -> a.X
if true then fun a -> a.X
]
This fails with a type inference error:
Adding yield
works:
let _x: (A -> int) list = [
yield fun a -> a.X
if true then yield fun a -> a.X
]
As does type annotations to both a
parameters:
let _x: (A -> int) list = [
fun (a: A) -> a.X
if true then fun (a: A) -> a.X
]
As does removing the if
:
let _x: (A -> int) list = [
fun a -> a.X
fun a -> a.X
]
As a developer with no knowledge of the compiler, I can't see a compelling reason why I get the error. I would expect it to work.
Metadata
Metadata
Assignees
Labels
Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingType checking, attributes and all aspects of logic checkingBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.(Internal MS Team use only) Describes an issue with moderate impact on existing code.
Type
Projects
Status
Done