Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extensions methods not working #936

Open
andrelfpinto opened this issue Jun 22, 2022 · 2 comments
Open

Extensions methods not working #936

andrelfpinto opened this issue Jun 22, 2022 · 2 comments

Comments

@andrelfpinto
Copy link
Contributor

Hi, after installing the latest release, 0.13.0, with Scala 3 support, I tried to have an extension method in a notebook and it didn't work:

extension (foo: Int)
  def bar: Double = 0.0
scala.MatchError: class dotty.tools.dotc.reporting.Diagnostic at cmd11.sc:[12..21]: Not found: extension (of class dotty.tools.dotc.reporting.Diagnostic)
  dotty.tools.dotc.reporting.MessageRendering.diagnosticLevel(MessageRendering.scala:180)
  dotty.tools.dotc.reporting.MessageRendering.diagnosticLevel$(MessageRendering.scala:18)
  ammonite.compiler.Compiler$$anon$10.diagnosticLevel(Compiler.scala:498)
  ammonite.compiler.internal.CompilerHelper$.messageAndPos(CompilerHelper.scala:15)
  ammonite.compiler.Compiler.formatError$$anonfun$1(Compiler.scala:170)
  dotty.tools.dotc.reporting.NoExplanation.msg(Message.scala:133)
  dotty.tools.dotc.reporting.NoExplanation.toString(Message.scala:137)
  ammonite.compiler.Compiler.compile$$anonfun$3(Compiler.scala:274)
  scala.collection.immutable.List.map(List.scala:246)
  ammonite.compiler.Compiler.compile(Compiler.scala:274)
  ammonite.compiler.CompilerLifecycleManager.compileClass(CompilerLifecycleManager.scala:131)
  ammonite.interp.Interpreter.$anonfun$evaluateLine$2(Interpreter.scala:294)
  ammonite.util.Catching.flatMap(Res.scala:115)
  ammonite.interp.Interpreter.evaluateLine(Interpreter.scala:289)
  ammonite.interp.Interpreter.$anonfun$processLine$6(Interpreter.scala:277)
  ammonite.util.Res$Success.flatMap(Res.scala:62)
  ammonite.interp.Interpreter.$anonfun$processLine$4(Interpreter.scala:260)
  ammonite.util.Res$Success.flatMap(Res.scala:62)
  ammonite.interp.Interpreter.$anonfun$processLine$2(Interpreter.scala:253)
  ammonite.util.Catching.flatMap(Res.scala:115)
  ammonite.interp.Interpreter.processLine(Interpreter.scala:252)
  almond.Execute.ammResult$$anonfun$4$$anonfun$3$$anonfun$2$$anonfun$2$$anonfun$2$$anonfun$2(Execute.scala:249)
  almond.internals.CaptureImpl.apply$$anonfun$2$$anonfun$1(CaptureImpl.scala:53)
  scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
  scala.Console$.withErr(Console.scala:193)
  almond.internals.CaptureImpl.apply$$anonfun$1(CaptureImpl.scala:58)
  scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
  scala.Console$.withOut(Console.scala:164)
  almond.internals.CaptureImpl.apply(CaptureImpl.scala:59)
  almond.Execute.capturingOutput(Execute.scala:166)
  almond.Execute.ammResult$$anonfun$5$$anonfun$4$$anonfun$3$$anonfun$3$$anonfun$3(Execute.scala:301)
  almond.Execute.withClientStdin$$anonfun$1(Execute.scala:146)
  scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
  scala.Console$.withIn(Console.scala:227)
  almond.Execute.withClientStdin(Execute.scala:151)
  almond.Execute.ammResult$$anonfun$6$$anonfun$5$$anonfun$4$$anonfun$4(Execute.scala:302)
  almond.Execute.withInputManager(Execute.scala:134)
  almond.Execute.ammResult$$anonfun$7$$anonfun$6$$anonfun$5(Execute.scala:303)
  almond.Execute.interruptible$$anonfun$2(Execute.scala:183)
  ammonite.repl.Signaller.apply(Signaller.scala:28)
  almond.Execute.interruptible(Execute.scala:184)
  almond.Execute.ammResult$$anonfun$9$$anonfun$8(Execute.scala:304)
  ammonite.util.Res$Success.flatMap(Res.scala:62)
  almond.Execute.ammResult$$anonfun$1(Execute.scala:305)
  almond.Execute.withOutputHandler(Execute.scala:157)
  almond.Execute.ammResult(Execute.scala:306)
  almond.Execute.apply(Execute.scala:322)
  almond.ScalaInterpreter.execute(ScalaInterpreter.scala:129)
  almond.interpreter.InterpreterToIOInterpreter.$anonfun$execute$2(InterpreterToIOInterpreter.scala:69)
  cats.effect.internals.IORunLoop$.cats$effect$internals$IORunLoop$$loop(IORunLoop.scala:104)
  cats.effect.internals.IORunLoop$RestartCallback.signal(IORunLoop.scala:463)
  cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:484)
  cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:422)
  cats.effect.internals.IOShift$Tick.run(IOShift.scala:36)
  java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
  java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
  java.lang.Thread.run(Thread.java:833)
@tanishiking
Copy link
Contributor

tanishiking commented Aug 16, 2022

looks like the root cause is ammonite-repl doesn't support defining extension methods. I opened an issue com-lihaoyi/Ammonite#1281

@alexarchambault
Copy link
Member

alexarchambault commented Aug 22, 2022

FYI, I'm waiting maybe for #956 to be done (if that happens soon enough) to cut the next release, which is going to fix that.

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

No branches or pull requests

3 participants