You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to see what kind of error message would come up if I tried compiling0a instead of 0 and stumbled upon a compiler crash.
Compiler version
scala 3.3.1
Minimized code
traitMonoid[A]:defcombine(a1: A, a2: A):Adefempty:AobjectMonoid:lazyvalintAddition:Monoid[Int] =new:defcombine(x: Int, y: Int) = x + y
valempty= 0a
endMonoid
Output (click arrow to expand)
romaincomeau@phoenix fpinscala2 % scala-cli compile --server=false src/main/scala/fpinscala/exercises/monoids/Minimized.scala
-- [E018] SyntaxError:/Users/romaincomeau/dev/git/fpinscala2/src/main/scala/fpinscala/exercises/monoids/Minimized.scala:8:188|valempty= 0a
|^| expression expected but unindent found
|| longer explanation available when compiling with`-explain`
error while checking {
defcombine(x: Int, y: Int) = x + y
valempty=0 a null
}
error while checking new {
defcombine(x: Int, y: Int) = x + y
valempty=0 a null
}
error while checking lazyvalintAddition:Monoid[Int] =new {
defcombine(x: Int, y: Int) = x + y
valempty=0 a null
}
error while checking {
lazyvalintAddition:Monoid[Int] =new {
defcombine(x: Int, y: Int) = x + y
valempty=0 a null
}
}
error while checking module objectMonoid {
lazyvalintAddition:Monoid[Int] =new {
defcombine(x: Int, y: Int) = x + y
valempty=0 a null
}
}
error while checking package<empty> {
traitMonoid[A] {
defcombine(a1: A, a2: A):Adefempty:A
}
module objectMonoid {
lazyvalintAddition:Monoid[Int] =new {
defcombine(x: Int, y: Int) = x + y
valempty=0 a null
}
}
}
exception occurred while parser /Users/romaincomeau/dev/git/fpinscala2/src/main/scala/fpinscala/exercises/monoids/Minimized.scala
exception occurred while compiling List(/Users/romaincomeau/dev/git/fpinscala2/src/main/scala/fpinscala/exercises/monoids/Minimized.scala)
An unhandled exception was thrown in the compiler.
Please file a crash report here:
https://github.com/lampepfl/dotty/issues/new/choose
whilecompiling: <no file>
during phase: <no phase>
mode: Mode(ImplicitsEnabled)
library version: version 2.13.10
compiler version: version 3.3.1settings: -classpath /Users/romaincomeau/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.3.1/scala3-library_3-3.3.1.jar:/Users/romaincomeau/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.10/scala-library-2.13.10.jar -d /Users/romaincomeau/dev/git/fpinscala2/src/main/scala/fpinscala/exercises/monoids/.scala-build/monoids_103be31561-73523f4214/classes/main -java-output-version 17-sourceroot /Users/romaincomeau/dev/git/fpinscala2/src/main/scala/fpinscala/exercises/monoids
tree: EmptyTree
tree position: :<unknown>
tree type: <notype>
symbol: val<none>
call site: package<root>inmoduleclass<root>==Source file context for tree position ==Exception in thread "main" java.lang.AssertionError: assertion failed: position error, parent span does not contain child span
parent = {
defcombine(x: Int, y: Int) = x + y
valempty=0 a null
} #-1,
parent span = <117..180>,
child =valempty=0 a null#-1,
child span = [166..170..181]
at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
at dotty.tools.dotc.ast.Positioned.check$1(Positioned.scala:175)
at dotty.tools.dotc.ast.Positioned.check$1$$anonfun$3(Positioned.scala:205)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.immutable.List.foreach(List.scala:333)
at dotty.tools.dotc.ast.Positioned.check$1(Positioned.scala:205)
at dotty.tools.dotc.ast.Positioned.checkPos(Positioned.scala:226)
at dotty.tools.dotc.ast.Positioned.check$1(Positioned.scala:200)
at dotty.tools.dotc.ast.Positioned.checkPos(Positioned.scala:226)
at dotty.tools.dotc.ast.Positioned.check$1(Positioned.scala:200)
at dotty.tools.dotc.ast.Positioned.checkPos(Positioned.scala:226)
at dotty.tools.dotc.ast.Positioned.check$1(Positioned.scala:200)
at dotty.tools.dotc.ast.Positioned.check$1$$anonfun$3(Positioned.scala:205)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.immutable.List.foreach(List.scala:333)
at dotty.tools.dotc.ast.Positioned.check$1(Positioned.scala:205)
at dotty.tools.dotc.ast.Positioned.checkPos(Positioned.scala:226)
at dotty.tools.dotc.ast.Positioned.check$1(Positioned.scala:200)
at dotty.tools.dotc.ast.Positioned.checkPos(Positioned.scala:226)
at dotty.tools.dotc.ast.Positioned.check$1(Positioned.scala:200)
at dotty.tools.dotc.ast.Positioned.check$1$$anonfun$3(Positioned.scala:205)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.immutable.List.foreach(List.scala:333)
at dotty.tools.dotc.ast.Positioned.check$1(Positioned.scala:205)
at dotty.tools.dotc.ast.Positioned.checkPos(Positioned.scala:226)
at dotty.tools.dotc.parsing.Parser.parse$$anonfun$1(ParserPhase.scala:38)
at dotty.tools.dotc.parsing.Parser.parse$$anonfun$adapted$1(ParserPhase.scala:39)
at scala.Function0.apply$mcV$sp(Function0.scala:42)
at dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:440)
at dotty.tools.dotc.parsing.Parser.parse(ParserPhase.scala:39)
at dotty.tools.dotc.parsing.Parser.runOn$$anonfun$1(ParserPhase.scala:48)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.immutable.List.foreach(List.scala:333)
at dotty.tools.dotc.parsing.Parser.runOn(ParserPhase.scala:48)
at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:246)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1321)
at dotty.tools.dotc.Run.runPhases$1(Run.scala:262)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:270)
at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:279)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
at dotty.tools.dotc.Run.compileUnits(Run.scala:279)
at dotty.tools.dotc.Run.compileSources(Run.scala:194)
at dotty.tools.dotc.Run.compile(Run.scala:179)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
at dotty.tools.dotc.Driver.process(Driver.scala:197)
at dotty.tools.dotc.Driver.process(Driver.scala:165)
at dotty.tools.dotc.Driver.process(Driver.scala:177)
at dotty.tools.dotc.Driver.main(Driver.scala:207)
at dotty.tools.dotc.Main.main(Main.scala)
Compilation failed
The text was updated successfully, but these errors were encountered:
I was trying to see what kind of error message would come up if I tried compiling
0a
instead of0
and stumbled upon a compiler crash.Compiler version
scala 3.3.1
Minimized code
Output (click arrow to expand)
The text was updated successfully, but these errors were encountered: