Skip to content

Conversation

@paulk-asert
Copy link
Contributor

No description provided.

@eric-milles
Copy link
Member

eric-milles commented Jun 29, 2020

Does this change accommodate checking instanceof under a ternary expression or as part of a larger boolean expression?

int m(o) { (o instanceof List || o instanceof Map ? o.size() : 1) } // or def x = (o instanceof List || o instanceof Map) && o.isEmpty()

#1269 is not specific to if/else, but as you noted is more restrictive.

Does this change fix the runtime cast exception of your Deque vs. Stack example under static compilation?

@paulk-asert
Copy link
Contributor Author

@eric-milles No, those cases aren't covered but the if case is. The Stack/Deque case is one of the test cases. The full solution I think will require us to push through Union and Intersection types (though I don't like those names) throughout. I started doing that but never finished. There are lots of hidden assumptions about the current approach throughout the codebase and will take some time. I see this as fixing up a common case while we work longer on the more complete solution. With the if in place, I believe we could have workarounds for the other cases. We could target them as special cases too but it makes the codebase messier the more of these hacks we have.

@daniellansun
Copy link
Contributor

PR #1269 or PR #1293 ?

@daniellansun
Copy link
Contributor

daniellansun commented Jul 4, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants