Skip to content

StackOverflow in TypeAssigner with @inline & type alias #1891

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

Closed
OlivierBlanvillain opened this issue Jan 9, 2017 · 0 comments
Closed

StackOverflow in TypeAssigner with @inline & type alias #1891

OlivierBlanvillain opened this issue Jan 9, 2017 · 0 comments
Assignees

Comments

@OlivierBlanvillain
Copy link
Contributor

object Test {
  case class CC2[A, B](a: A, b: B)

  type T2[A, B] = CC2[A, B]

  class ArrowAssoc[A](val self: A) {
    @inline def f[B](y: B): CC2[A, B] = CC2(self, y)
  }

  def foo = (new ArrowAssoc(1)).f(2)
}
Exception in thread "main" java.lang.StackOverflowError
        at dotty.tools.dotc.ast.tpd$.localSyms(tpd.scala:20)
        at dotty.tools.dotc.typer.TypeAssigner$$anonfun$avoidingType$1.apply(TypeAssigner.scala:133)
        at dotty.tools.dotc.typer.TypeAssigner$$anonfun$avoidingType$1.apply(TypeAssigner.scala:133)
        at dotty.tools.dotc.typer.TypeAssigner$$anon$2.forbidden$lzycompute(TypeAssigner.scala:54)
        at dotty.tools.dotc.typer.TypeAssigner$$anon$2.forbidden(TypeAssigner.scala:54)
        at dotty.tools.dotc.typer.TypeAssigner$$anon$2$$anonfun$toAvoid$1.apply(TypeAssigner.scala:59)
        at dotty.tools.dotc.typer.TypeAssigner$$anon$2$$anonfun$toAvoid$1.apply(TypeAssigner.scala:58)
        at dotty.tools.dotc.core.Types$ExistsAccumulator.apply(Types.scala:3735)
        at dotty.tools.dotc.core.Types$Type.existsPart(Types.scala:236)
        at dotty.tools.dotc.typer.TypeAssigner$$anon$2.toAvoid(TypeAssigner.scala:58)
        at dotty.tools.dotc.typer.TypeAssigner$$anon$2.apply(TypeAssigner.scala:69)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:3479)
        at dotty.tools.dotc.typer.TypeAssigner$$anon$2.apply(TypeAssigner.scala:126)
        at dotty.tools.dotc.typer.TypeAssigner$class.avoid(TypeAssigner.scala:129)
        at dotty.tools.dotc.typer.Typer.avoid(Typer.scala:64)
        at dotty.tools.dotc.typer.TypeAssigner$$anon$2.apply(TypeAssigner.scala:123)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:3479)
        at dotty.tools.dotc.typer.TypeAssigner$$anon$2.apply(TypeAssigner.scala:126)
        ...
odersky added a commit to dotty-staging/dotty that referenced this issue Jan 10, 2017
Before adding a constraint, make sure there is no way
the two types are already in a subtype relation.

Adding redundant constraints is problematic because we
might introduce cycles. See i1891.scala for a test.
@odersky odersky self-assigned this Jan 10, 2017
odersky added a commit that referenced this issue Jan 11, 2017
Fix #1891: Don't add redundant constraint
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

2 participants