Skip to content

dotty.tools.dotc.core.Types$MissingType: cannot resolve reference to type #2390

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
olafurpg opened this issue May 8, 2017 · 3 comments
Closed

Comments

@olafurpg
Copy link
Contributor

olafurpg commented May 8, 2017

While upgrading the community build dotty-staging/scalatest fork to the latest dotty (0.1.1-bin-20170507-1014af3-NIGHTLY) and sbt-dotty 0.1.0-RC4 I hit an a MissingType error
https://travis-ci.org/dotty-staging/scalatest/builds/229925482#L2104
during type erasure https://github.com/lampepfl/dotty/blob/5093126421e333b2329399736e6d7ad327e3bdfa/compiler/src/dotty/tools/dotc/core/TypeErasure.scala#L496

I made some unsuccessful attempts to minimize the error, it seems to boil down to something like this

package foo
trait TestSuite {
  protected trait NoArgTest extends (() => Int)
}
trait CancelAfterFailure { self: TestSuite => }

To reproduce the error:

git clone https://github.com/dotty-staging/scalatest.git
cd scalatest
git checkout 1b2ea9013e4f71306f6dfc5f4e1ae0db85a46629
sbt scalatest/compile "last scalatest/compile:compileIncremental"
@olafurpg
Copy link
Contributor Author

olafurpg commented May 9, 2017

Any tips/tricks on how to minimize the error? I have tried -Ycheck:all.

@olafurpg
Copy link
Contributor Author

I am still able to reproduce this error with 20170511, see stacktrace https://travis-ci.org/dotty-staging/scalatest/builds/231553300#L1942 I have updated the steps to reproduce in the description.

The error is thrown while transforming this file here: https://github.com/dotty-staging/scalatest/blob/1b2ea9013e4f71306f6dfc5f4e1ae0db85a46629/scalatest/src/main/scala/org/scalatest/CancelAfterFailure.scala

@smarter
Copy link
Member

smarter commented May 19, 2017

I've minimized it to:

trait TestSuite {
  trait NoArgTest
}

trait TestSuiteMixin { self: TestSuite =>
  def foo(test: self.NoArgTest) = {}
}

trait CancelAfterFailure extends TestSuiteMixin { self: TestSuite =>
  override def foo(test: self.NoArgTest) = {}
}

This is caused by ef6922c which intentionally changed RefChecks to not look at the full self-type but only the class type when checking for overrides.

@odersky It seems that the only logical way forward is to completely disallow self types from appearing in non-private signatures, since the self-type is an implementation detail of the class, but this is likely to break a lot of things, like Scalatest here. What do you think?

odersky added a commit that referenced this issue May 29, 2017
Fix #2390: Use normal thisType as base for override checking
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants