hi! I’ve spent some time thinking about how we can...
# language-proposals
a
hi! I’ve spent some time thinking about how we can improve
is
tests in Kotlin by adding some lightweight type refinement on matching; this is what I came up with https://gist.github.com/serras/ee07f36b38756f076d654496a3d2eb61 I would love to know what the community thinks about it; it seems waaay more simple than what Scala does, but it still unlocks quite some power in the type checker
👀 2
K 1
11
e
The “type” smart casts come up from time to in various type-inference use-cases that we study. Your main use-case is a great summary that demonstrates the core of the problem. Nice writeup! However, those kinds of casts are quite non-trivial to actually implement in the compiler. This whole discussion makes sense only if there is a prototype that demonstrates implementation feasibility. P.S. Please separate out the less controversial part on “type smartcasts” from the new syntax for “existentials” and create a YouTrack issue with your use-case.
a
thanks for the comments! in fact, I wanted to ask what is the best way to go forward? • what should I include in the YouTrack issue? • I’m working on a prototype, where should I link that?
d
• It's ok to copy your description from gist to the issue • Please mention it in the comments in issue
BTW I hope you write your prototype in Frontend IR, not in FE 1.0 (using descriptors and binding context)?
a
will do!