Skip to content

Conversation

liufengyun
Copy link
Contributor

@liufengyun liufengyun commented Apr 15, 2019

Fix #4863: Add tests

@LPTK
Copy link
Contributor

LPTK commented Apr 15, 2019

Will it be possible to compose the message at compile-time using inline methods with constant folding or staging?

Also, an additional compileTimeError method would be useful, to avoid the roundabout @compileTimeOnly("...") val res = ???; res pattern.

@liufengyun
Copy link
Contributor Author

Clarify the relation to erased.

case S(m) => m
case Z =>
@compileTimeOnly("n cannot be Z") val res = ???
res
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scala.compiletime.error("n cannot be Z") does the job.

@liufengyun
Copy link
Contributor Author

@LPTK Const folding will work for scala.compiletime.error in macros, if the parameter is inline -- for just inline methods, currently the compiler does not do that.

@liufengyun liufengyun changed the title Fix #4863: support @compileTimeOnly Fix #4863: Add tests Apr 15, 2019
@liufengyun liufengyun merged commit defe9ab into scala:master Apr 15, 2019
@liufengyun liufengyun deleted the fix-4863 branch April 15, 2019 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prevent Pattern Match Exhaustivity Warning for transparent
3 participants