Allow changing the type of a value when the variant is inferred and not all type parameters are used #4085
GearsDatapacks
started this conversation in
Ideas & suggestions
Replies: 1 comment
-
Converted this to a discussion as it's unclear what we would be doing here |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
For example, this code currently does not compile:
Because
result
has typeResult(a, e)
notResult(b, e)
. The compiler can however infer thatresult
must be of variantError
, and sinceError
makes no reference to thea
type parameter, this would not create an invalid value.However, I'm not sure how this would work with phantom types. If we weren't careful, this would entirely defeat the point of phantom types:
Not sure how we would work around that
Beta Was this translation helpful? Give feedback.
All reactions