Ammonite
Ammonite copied to clipboard
Compile error when defining * operator in scala 3 extension methods
Although support for extension methods was added in #1282, it appears there is some kind of parsing or quoting error which occurs when I try to define the * operator (curiously defining ** works fine)
For example running the following as a script:
extension (a: String)
// definition of this operator (*) causes the issue
def *(x: Int): String = "blarg"
// only important to have a method following the one above
def another = "blarg"
@
println("test" * 3)
(or alternatively running the 2 commands separately in a REPL) results in the following compile error
-- Error: /.../test.sc:44:2 -----------------------------
44 | another
| ^^^^^^^
| named imports cannot follow wildcard imports
Compilation Failed
Adding braces does not help.
Running the commands together in a script works.
Tested with 2.5.4-22-4a9e6989, 2.5.4-26-9cd15abe.