Conversation
This reverts commit b24f09c.
|
There might be a 4th option, we could maybe use We really want to add source locators if at all possible but if we can avoid a hard breakage (without a deprecation step) that would definitely be ideal. |
|
I am curious to hear your thoughts on this @jackkoenig : How hard / how useful would it be to implement source locator propagation through a compiler plugin instead of using macros? |
|
@deprecatedName sounds to be a great idea! |
|
wait are we saying that the change to adding source locators means we can't pass named arguments to RegNext and friends? That seems sad in general... |
|
Yes, it seems that Scala compiler doesn't like this, I have seen two downstreams beaten by this:( |
All compiler plugin stuff is difficult, we'd essentially be reimplementing a subset of what def macros do. It's probably doable, but I'm not actually convinced that named arguments would work if we did it in a plugin. Macros paradise was implemented as a plugin prior to Scala 2.13 and it has never supported named arguments so I suspect there's some fundamental limitation here. |
@mwachs5 - Yes, it is a really annoying limitation but it is why Chisel3 moved to things like |
#2496 introduced a bug which was spotted by my daily CI in
https://github.com/sequencer/playground/runs/6243944547
An MVP should be:
won't compile, and Scala complains:
This was should blame to Scala Compiler in https://github.com/scala/scala/blob/21a56430f9902b5b8b81535fd76371caf23c0d10/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala#L630
which seems to be a limitation to Scala compiler(both 2.12 and 2.13) that the function which used macro cannot use default or named arguments.
Thus #2496 introduced a breaking change to related function calls.
There exists three options to this:
SourceInfoandCompileOptionmacro to Scala Plugin, put it earlier than macro.(refactor a lot but user will be happier)Contributor Checklist
docs/src?Type of Improvement
API Impact
Backend Code Generation Impact
Desired Merge Strategy
Release Notes
Reviewer Checklist (only modified by reviewer)
3.4.x, [small] API extension:3.5.x, API modification or big change:3.6.0)?Please Merge?