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

Illegal cyclic reference involving type member of a constructor argument overriding a val #10199

Open
scabug opened this issue Feb 20, 2017 · 1 comment
Labels

Comments

@scabug
Copy link

scabug commented Feb 20, 2017

There are several bugs reported already regarding "illegal cyclic reference", the closest one probably being #7642. What might be special about this one is that it involves a type member of a constructor argument (foo.A below). What seems to confuse the type checker is the fact that the constructor argument also overrides a val.

trait Foo {
  type A
}

trait Bar {
  type B
  val foo: Foo { type A = B }
}

class Bar1(val foo: Foo) extends Bar {
  type B = foo.A // error: illegal cyclic reference involving type B
}

// workaround
class Bar2(val foo0: Foo) extends Bar {
  type B = foo0.A // OK
  val foo = foo0  // OK
}
@scabug
Copy link
Author

scabug commented Feb 20, 2017

Imported From: https://issues.scala-lang.org/browse/SI-10199?orig=1
Reporter: Tomas Mikula (tomas.mikula-at-gmail.com)
Affected Versions: 2.12.1
See #7642

@scabug scabug added the typer label Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant