Skip to content

Fix #938 #957

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

Merged
merged 5 commits into from
Nov 17, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/dotty/tools/dotc/core/Phases.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import dotty.tools.backend.jvm.{LabelDefs, GenBCode}
import util.DotClass
import DenotTransformers._
import Denotations._
import Decorators._
import config.Printers._
import scala.collection.mutable.{ListBuffer, ArrayBuffer}
import dotty.tools.dotc.transform.TreeTransforms.{TreeTransformer, MiniPhase, TreeTransform}
Expand Down Expand Up @@ -121,10 +122,9 @@ object Phases {
phase
}
squashedPhases += phaseToAdd
val shouldAddYCheck = YCheckAfter.exists(nm => phaseToAdd.phaseName.contains(nm)) || YCheckAll
val shouldAddYCheck = YCheckAfter.containsPhase(phaseToAdd) || YCheckAll
if (shouldAddYCheck) {
val checker = new TreeChecker

squashedPhases += checker
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/dotty/tools/dotc/core/TypeComparer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,9 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
case _ => tp2 isRef ObjectClass
}
compareJavaArray
case tp1: ExprType if ctx.phase.id > ctx.gettersPhase.id =>
// getters might have converted T to => T, need to compensate.
isSubType(tp1.widenExpr, tp2)
case _ =>
false
}
Expand Down
7 changes: 3 additions & 4 deletions src/dotty/tools/dotc/typer/TypeAssigner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ trait TypeAssigner {
// TODO: measure the cost of using `existsPart`, and if necessary replace it
// by a `TypeAccumulator` where we have set `stopAtStatic = true`.
tp existsPart {
case tp: NamedType =>
forbidden contains tp.symbol
case _ =>
false
case tp: NamedType => forbidden contains tp.symbol
case tp: ThisType => forbidden contains tp.cls
case _ => false
}
def apply(tp: Type): Type = tp match {
case tp: TermRef if toAvoid(tp) && variance > 0 =>
Expand Down
2 changes: 1 addition & 1 deletion test/dotc/scala-collections.whitelist
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
./scala-scala/src/library/scala/collection/SortedSetLike.scala
./scala-scala/src/library/scala/collection/Traversable.scala

# https://github.com/lampepfl/dotty/issues/938
# https://github.com/lampepfl/dotty/issues/938 (but relies also on #937 being fixed)
#./scala-scala/src/library/scala/collection/TraversableLike.scala

./scala-scala/src/library/scala/collection/TraversableProxy.scala
Expand Down
21 changes: 21 additions & 0 deletions tests/pos/i938.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
object Test {
import scala.collection._

trait T {
def f() : Unit
}

def view = new T {
def f() = ()
}

trait TLike[+A, RR] { self =>

def repr: RR = ???

def view2 = new TraversableView[A, RR] {
protected lazy val underlying = self.repr
override def foreach[U](f: A => U): Unit = ???
}
}
}