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
% scala --version
Scala code runner version 2.13.3 -- Copyright 2002-2020, LAMP/EPFL and Lightbend, Inc.
macOS, scala installed via brew install scala.
scala>typeMonadLike[A] = {
|defmap[B](f: A=>B):MonadLike[B]
| }
java.lang.StackOverflowError
at scala.reflect.internal.Types$TypeRef.mapOver(Types.scala:2361)
at scala.reflect.internal.tpe.TypeMaps$SubstMap.apply(TypeMaps.scala:728)
at scala.reflect.internal.tpe.TypeMaps$SubstMap.apply(TypeMaps.scala:666)
at scala.reflect.internal.Types$TypeRef.mapOver(Types.scala:2370)
at scala.reflect.internal.tpe.TypeMaps$SubstMap.apply(TypeMaps.scala:728)
at scala.reflect.internal.tpe.TypeMaps$TypeMap.applyToSymbolInfo(TypeMaps.scala:123)
at scala.reflect.internal.tpe.TypeMaps$TypeMap.loop$1(TypeMaps.scala:117)
at scala.reflect.internal.tpe.TypeMaps$TypeMap.firstChangedSymbol(TypeMaps.scala:121)
at scala.reflect.internal.tpe.TypeMaps$TypeMap.mapOver(TypeMaps.scala:135)
at scala.reflect.internal.Types$MethodType.mapOver(Types.scala:2925)
at scala.reflect.internal.tpe.TypeMaps$SubstMap.apply(TypeMaps.scala:728)
at scala.reflect.internal.Types$PolyType.mapOver(Types.scala:3029)
problem
A proper error should be displayed instead of SOE.
The text was updated successfully, but these errors were encountered:
class C {
type M[A] = scala.AnyRef {
def m[B](f: _root_.scala.Function1[A, B]): M[B]
}
}
And the doti says:
-- [E117] Syntax Error: t12151.scala:4:8 ---------------------------------------
4 | def m[B](f: _root_.scala.Function1[A, B]): M[B]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|Polymorphic refinement method m without matching type in parent type AnyRef is no longer allowed
Explanation
===========
Polymorphic method m is not allowed in the structural refinement of type AnyRef because
method m does not override any method in type AnyRef. Structural refinement does not allow for
polymorphic methods.
-- [E140] Cyclic Error: t12151.scala:3:7 ---------------------------------------
3 | type M[A] = scala.AnyRef {
| ^
|illegal cyclic type reference: alias ... of type M refers back to the type itself
2 errors found
som-snytt
changed the title
Scala console stack overflows when a structured typed definition is entered
Stack overflows on a structural type definition
Sep 12, 2020
reproduction steps
macOS, scala installed via
brew install scala
.problem
A proper error should be displayed instead of SOE.
The text was updated successfully, but these errors were encountered: