Only allow erased parameters in erased definitions#19686
Only allow erased parameters in erased definitions#19686nicolasstucki merged 1 commit intoscala:mainfrom
Conversation
EugeneFlesselle
left a comment
There was a problem hiding this comment.
I don't think the issues regarding the lifting/evaluation of arguments to erased parameters are specific to the case of erased definitions.
We have the same problem here for example:
def bar(erased x: Int) = true
bar:
println("hello")
1which after pruneErasedDefs gives:
def bar(erased x: Int): Boolean = true
Test.bar(scala.compiletime.erasedValue[(1 : Int)])
Not completely. We still need to check the purity of the erased parameter before we prune it. This is just a first step. |
39eba3a to
61b8336
Compare
61b8336 to
d335e93
Compare
So far, we do not have any use case for them. We could enable them in a later version. The current implementation does not handle correctly the non-erased arguments to erased definitions. These should always be evaluated, but in some cases we can dorp them by mistake.
d335e93 to
f4ff6e3
Compare
EugeneFlesselle
left a comment
There was a problem hiding this comment.
We indeed still need to check purity for erased arguments of both kinds of definitions.
But I agree non-erased parameters in erased defs have little use-cases that we know of.
And having more restrictions sounds good to me.
So far, we do not have any use case for them. We could enable them in a later version.
The current implementation does not handle correctly the non-erased arguments to erased definitions. These should always be evaluated, but in some cases we can dorp them by mistake.