Fix regression #23969: Add ensureApplied to the quotes reflect API#24160
Fix regression #23969: Add ensureApplied to the quotes reflect API#24160hamzaremmal merged 3 commits intoscala:mainfrom
Conversation
5a6580c to
2f0d636
Compare
| def a1 = () | ||
| def a2() = () |
There was a problem hiding this comment.
I'm curious about what will happen if we do this?
| def a1 = () | |
| def a2() = () | |
| def a1[T] = () | |
| def a2[T]() = () |
At least, we should include them in the test.
| Select.unique('{TestMethods}.asTerm, "a3").ensureApplied match | ||
| case Select(_, _) => | ||
| case other => assert(false) | ||
| Select.unique('{TestMethods}.asTerm, "a4").ensureApplied match |
There was a problem hiding this comment.
Mmmh, this is a legitimate question, but if we have a transparent inline method, it is subject to type inference, why shouldn't we wrap then in an Apply and let type inference do it's thing?
There was a problem hiding this comment.
This will result in:
-- Error: tests/pos-macros/i23969/Main.scala:1:19 ------------------------------
1 |@main def Test() = runMacro()
| ^^^^^^^^^^
| method a4 in object TestMethods does not take parameterserror, thrown from tpd.Apply. Even if we were to change that, we would have to deal with the TreeChecker run right after the macro expansion. In general, I believe we have to return fully typed trees and I am not aware of any additional type inference done to inlined code after inlining it (so it will be done for quoted code before the macro is expanded, or for non-macro inline method contents, but not changed after inlining, even for non-macro transparent inline methods, more info here: #8739).
Also apologies for weird response times! And thank you for looking at this @hamzaremmal
Fixes #23969
The regression would not appear on main (only after release on the nightly version of the compiler, as explained here), so I've adjusted the test to be more general.