Modify rule for nullable union types in generic signatures#24129
Modify rule for nullable union types in generic signatures#24129noti0na1 merged 2 commits intoscala:mainfrom
Conversation
| if tpStripped ne tpWiden then tpStripped else tp | ||
|
|
||
| if ctx.explicitNulls then strip(self) else self | ||
| strip(self) |
There was a problem hiding this comment.
This change seems suspicious. Without ctx.explictNulls, isn't T|Null generally meant to be equivalent to T?
There was a problem hiding this comment.
Yes, I want to make it as a general type operation, and I think it is fine to actually strip at most use places of stripNull. If we really want to be safe and distinguish the explictNulls case, we should add the check before use.
There was a problem hiding this comment.
I double-checked all places of stripNull and OrNull, I think the guards I added should be enough.
| builder.append(')') | ||
| methodResultSig(rte) | ||
|
|
||
| case OrNull(tp1) if !tp1.derivesFrom(defn.AnyValClass) => |
There was a problem hiding this comment.
This looks reasonable but I don't know enough about erasure overall and signature generation to be able to say whether it could break anything. Perhaps @smarter could more confidently comment on this change.
No description provided.