Skip to content

Extensions methods not workingΒ #936

Open
@andrelfpinto

Description

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)

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions