aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorodersky <odersky@gmail.com>2016-08-26 18:39:41 +0300
committerGitHub <noreply@github.com>2016-08-26 18:39:41 +0300
commit959ea0cad3a2ffe441b5e406d26cddbd6cc431ee (patch)
tree7470c7a2f049cb2722d662a983389cbd91825611
parentfb19d0bd248c01f29c9e217170e20f46d84e3028 (diff)
parente61ff6f4cfb632b11b7e54e2904706d382634eda (diff)
downloaddotty-959ea0cad3a2ffe441b5e406d26cddbd6cc431ee.tar.gz
dotty-959ea0cad3a2ffe441b5e406d26cddbd6cc431ee.tar.bz2
dotty-959ea0cad3a2ffe441b5e406d26cddbd6cc431ee.zip
Merge pull request #1461 from dotty-staging/fixes-gadts
Fixes of GADTs and test recategorization.
-rw-r--r--src/dotty/tools/dotc/ast/Desugar.scala16
-rw-r--r--src/dotty/tools/dotc/core/TypeComparer.scala27
-rw-r--r--src/dotty/tools/dotc/transform/TreeChecker.scala2
-rw-r--r--src/dotty/tools/dotc/typer/Applications.scala5
-rw-r--r--src/dotty/tools/dotc/typer/Namer.scala27
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala26
-rw-r--r--test/dotc/tests.scala1
-rw-r--r--tests/disabled/not-representable/pos/t3999b.scala (renamed from tests/pending/pos/t3999b.scala)0
-rw-r--r--tests/disabled/not-representable/pos/t5544/Api_1.scala (renamed from tests/run/t5544/Api_1.scala)1
-rw-r--r--tests/disabled/not-representable/pos/t5544/Test_2.scala (renamed from tests/run/t5544/Test_2.scala)0
-rw-r--r--tests/disabled/not-representable/pos/t7035.scala (renamed from tests/pending/pos/t7035.scala)2
-rw-r--r--tests/disabled/not-representable/pos/t7228.scala (renamed from tests/pending/pos/t7228.scala)1
-rw-r--r--tests/disabled/not-representable/pos/t8111.scala (renamed from tests/pending/pos/t8111.scala)1
-rw-r--r--tests/disabled/not-testable/t5604b/T_1.scala (renamed from tests/pending/pos/t5604b/T_1.scala)0
-rw-r--r--tests/disabled/not-testable/t5604b/T_2.scala (renamed from tests/pending/pos/t5604b/T_2.scala)0
-rw-r--r--tests/disabled/not-testable/t5604b/Test_1.scala (renamed from tests/pending/pos/t5604b/Test_1.scala)0
-rw-r--r--tests/disabled/not-testable/t5604b/Test_2.scala (renamed from tests/pending/pos/t5604b/Test_2.scala)0
-rw-r--r--tests/disabled/not-testable/t5604b/pack_1.scala (renamed from tests/pending/pos/t5604b/pack_1.scala)0
-rw-r--r--tests/disabled/not-testable/t5954a/A_1.scala (renamed from tests/pending/pos/t5954a/A_1.scala)0
-rw-r--r--tests/disabled/not-testable/t5954a/B_2.scala (renamed from tests/pending/pos/t5954a/B_2.scala)0
-rw-r--r--tests/disabled/not-testable/t5954b/A_1.scala (renamed from tests/pending/pos/t5954b/A_1.scala)0
-rw-r--r--tests/disabled/not-testable/t5954b/B_2.scala (renamed from tests/pending/pos/t5954b/B_2.scala)0
-rw-r--r--tests/disabled/not-testable/t5954c/A_1.scala (renamed from tests/pending/pos/t5954c/A_1.scala)0
-rw-r--r--tests/disabled/not-testable/t5954c/B_2.scala (renamed from tests/pending/pos/t5954c/B_2.scala)0
-rw-r--r--tests/disabled/not-testable/t5954d/A_1.scala (renamed from tests/pending/pos/t5954d/A_1.scala)0
-rw-r--r--tests/disabled/not-testable/t5954d/B_2.scala (renamed from tests/pending/pos/t5954d/B_2.scala)0
-rw-r--r--tests/disabled/not-testable/t8134/A_1.scala (renamed from tests/pending/pos/t8134/A_1.scala)0
-rw-r--r--tests/disabled/not-testable/t8134/B_2.scala (renamed from tests/pending/pos/t8134/B_2.scala)0
-rw-r--r--tests/disabled/structural-type/pos/depmet_implicit_oopsla_zipwith.scala (renamed from tests/pending/pos/depmet_implicit_oopsla_zipwith.scala)0
-rw-r--r--tests/disabled/typetags/pos/t8237b.scala (renamed from tests/pending/pos/t8237b.scala)0
-rw-r--r--tests/neg/t7239.scala (renamed from tests/pending/pos/t7239.scala)10
-rw-r--r--tests/neg/t8002-nested-scope.scala (renamed from tests/pending/pos/t8002-nested-scope.scala)2
-rw-r--r--tests/pending/neg/i533/Compat.scala7
-rw-r--r--tests/pending/neg/i533/JA.java5
-rw-r--r--tests/pending/pos/contraImplicits.scala18
-rw-r--r--tests/pending/pos/depmet_implicit_norm_ret.scala9
-rw-r--r--tests/pending/pos/depsel.scala14
-rw-r--r--tests/pending/pos/exponential-spec.scala4
-rw-r--r--tests/pending/pos/generic-sigs.flags1
-rw-r--r--tests/pending/pos/infersingle.flags1
-rw-r--r--tests/pending/pos/setter-not-implicit.scala3
-rw-r--r--tests/pending/pos/stable.scala11
-rw-r--r--tests/pending/pos/t3631.scala1
-rw-r--r--tests/pending/pos/t3960.flags1
-rw-r--r--tests/pending/pos/t4188.scala1
-rw-r--r--tests/pending/pos/t4579.flags1
-rw-r--r--tests/pending/pos/t4911.flags1
-rw-r--r--tests/pending/pos/t5029.flags1
-rw-r--r--tests/pending/pos/t5899.flags1
-rw-r--r--tests/pending/pos/t5932.flags1
-rw-r--r--tests/pending/pos/t6123-explaintypes-implicits.flags1
-rw-r--r--tests/pending/pos/t6994.flags1
-rw-r--r--tests/pending/pos/t7011.flags1
-rw-r--r--tests/pending/pos/t7285a.flags1
-rw-r--r--tests/pending/pos/t7296.scala1
-rw-r--r--tests/pending/pos/t762.scala2
-rw-r--r--tests/pending/pos/t8187.check0
-rw-r--r--tests/pending/pos/t8364.check0
-rw-r--r--tests/pending/pos/t8369a.check0
-rw-r--r--tests/pending/pos/trait-force-info.flags1
-rw-r--r--tests/pending/pos/virtpatmat_alts_subst.flags1
-rw-r--r--tests/pending/pos/virtpatmat_exist1.flags1
-rw-r--r--tests/pending/pos/virtpatmat_exist3.flags1
-rw-r--r--tests/pos-scala2/t7688.scala (renamed from tests/pending/pos/t7688.scala)0
-rw-r--r--tests/pos-special/t8146a.scala (renamed from tests/pending/pos/t8146a.scala)0
-rw-r--r--tests/pos/apply-equiv.scala (renamed from tests/pending/pos/apply-equiv.scala)0
-rw-r--r--tests/pos/dependent-implicits.scala7
-rw-r--r--tests/pos/extractor-types.scala (renamed from tests/pending/pos/extractor-types.scala)0
-rw-r--r--tests/pos/for-filter.scala12
-rw-r--r--tests/pos/gadts2.scala (renamed from tests/pending/pos/gadts2.scala)2
-rw-r--r--tests/pos/hk-infer.scala (renamed from tests/pending/pos/hk-infer.scala)0
-rw-r--r--tests/pos/i743.scala (renamed from tests/pending/pos/i743.scala)0
-rw-r--r--tests/pos/infersingle.scala (renamed from tests/pending/pos/infersingle.scala)0
-rw-r--r--tests/pos/lazyvals.scala (renamed from tests/pending/pos/lazyvals.scala)0
-rw-r--r--tests/pos/matthias4.scala (renamed from tests/pending/pos/matthias4.scala)0
-rw-r--r--tests/pos/mixins.scala (renamed from tests/pending/pos/mixins.scala)0
-rw-r--r--tests/pos/return_thistype.scala (renamed from tests/pending/pos/return_thistype.scala)0
-rw-r--r--tests/pos/t3494.scala (renamed from tests/pending/pos/t3494.scala)0
-rw-r--r--tests/pos/t3800.scala (renamed from tests/pending/pos/t3800.scala)0
-rw-r--r--tests/pos/t3862.scala (renamed from tests/pending/pos/t3862.scala)0
-rw-r--r--tests/pos/t3880.scala (renamed from tests/pending/pos/t3880.scala)0
-rw-r--r--tests/pos/t3999/a_1.scala (renamed from tests/pending/pos/t3999/a_1.scala)2
-rw-r--r--tests/pos/t3999/b_2.scala (renamed from tests/pending/pos/t3999/b_2.scala)0
-rw-r--r--tests/pos/t4269.scala (renamed from tests/pending/pos/t4269.scala)0
-rw-r--r--tests/pos/t5070.scala15
-rw-r--r--tests/pos/t5330.scala (renamed from tests/pending/pos/t5330.scala)0
-rw-r--r--tests/pos/t5604/ReplConfig.scala (renamed from tests/pending/pos/t5604/ReplConfig.scala)0
-rw-r--r--tests/pos/t5604/ReplReporter.scala (renamed from tests/pending/pos/t5604/ReplReporter.scala)0
-rw-r--r--tests/pos/t5726.scala (renamed from tests/pending/pos/t5726.scala)0
-rw-r--r--tests/pos/t5769.scala (renamed from tests/pending/pos/t5769.scala)0
-rw-r--r--tests/pos/t578.scala (renamed from tests/pending/pos/t578.scala)0
-rw-r--r--tests/pos/t5899.scala (renamed from tests/pending/pos/t5899.scala)0
-rw-r--r--tests/pos/t6084.scala (renamed from tests/pending/pos/t6084.scala)0
-rw-r--r--tests/pos/t6722.scala (renamed from tests/pending/pos/t6722.scala)0
-rw-r--r--tests/pos/t6815_import.scala (renamed from tests/pending/pos/t6815_import.scala)0
-rw-r--r--tests/pos/t6948.scala (renamed from tests/pending/pos/t6948.scala)0
-rw-r--r--tests/pos/t7294.scala (renamed from tests/pending/pos/t7294.scala)0
-rw-r--r--tests/pos/t7426.scala (renamed from tests/pending/pos/t7426.scala)0
-rw-r--r--tests/pos/t7517.scala (renamed from tests/pending/pos/t7517.scala)0
-rw-r--r--tests/pos/t762.scala4
-rw-r--r--tests/pos/t7668.scala (renamed from tests/pending/pos/t7668.scala)2
-rw-r--r--tests/pos/t7902.scala (renamed from tests/pending/pos/t7902.scala)0
-rw-r--r--tests/pos/t8046c.scala (renamed from tests/pending/pos/t8046c.scala)0
-rw-r--r--tests/pos/t807.scala (renamed from tests/pending/pos/t807.scala)0
-rw-r--r--tests/pos/t8300-patmat-a.scala (renamed from tests/pending/pos/t8300-patmat-a.scala)0
-rw-r--r--tests/pos/t8300-patmat-b.scala (renamed from tests/pending/pos/t8300-patmat-b.scala)0
-rw-r--r--tests/pos/t8301b.scala (renamed from tests/pending/pos/t8301b.scala)0
-rw-r--r--tests/pos/t8364.scala (renamed from tests/pending/pos/t8364.scala)0
-rw-r--r--tests/pos/trait-force-info.scala (renamed from tests/pending/pos/trait-force-info.scala)0
109 files changed, 155 insertions, 102 deletions
diff --git a/src/dotty/tools/dotc/ast/Desugar.scala b/src/dotty/tools/dotc/ast/Desugar.scala
index 346af42b8..500b28233 100644
--- a/src/dotty/tools/dotc/ast/Desugar.scala
+++ b/src/dotty/tools/dotc/ast/Desugar.scala
@@ -8,6 +8,7 @@ import SymDenotations._, Symbols._, StdNames._, Annotations._, Trees._
import Decorators._
import language.higherKinds
import collection.mutable.ListBuffer
+import util.Attachment
import config.Printers._
object desugar {
@@ -17,6 +18,11 @@ object desugar {
import untpd._
+ /** Tags a .withFilter call generated by desugaring a for expression.
+ * Such calls can alternatively be rewritten to use filter.
+ */
+ val MaybeFilter = new Attachment.Key[Unit]
+
/** Info of a variable in a pattern: The named tree and its type */
private type VarInfo = (NameTree, Tree)
@@ -773,6 +779,12 @@ object desugar {
(Bind(name, pat), Ident(name))
}
+ /** Add MaybeFilter attachment */
+ def orFilter(tree: Tree): tree.type = {
+ tree.putAttachment(MaybeFilter, ())
+ tree
+ }
+
/** Make a pattern filter:
* rhs.withFilter { case pat => true case _ => false }
*
@@ -803,7 +815,7 @@ object desugar {
val cases = List(
CaseDef(pat, EmptyTree, Literal(Constant(true))),
CaseDef(Ident(nme.WILDCARD), EmptyTree, Literal(Constant(false))))
- Apply(Select(rhs, nme.withFilter), makeCaseLambda(cases))
+ Apply(orFilter(Select(rhs, nme.withFilter)), makeCaseLambda(cases))
}
/** Is pattern `pat` irrefutable when matched against `rhs`?
@@ -858,7 +870,7 @@ object desugar {
val vfrom1 = new IrrefutableGenFrom(makeTuple(allpats), rhs1)
makeFor(mapName, flatMapName, vfrom1 :: rest1, body)
case (gen: GenFrom) :: test :: rest =>
- val filtered = Apply(rhsSelect(gen, nme.withFilter), makeLambda(gen.pat, test))
+ val filtered = Apply(orFilter(rhsSelect(gen, nme.withFilter)), makeLambda(gen.pat, test))
val genFrom =
if (isIrrefutableGenFrom(gen)) new IrrefutableGenFrom(gen.pat, filtered)
else GenFrom(gen.pat, filtered)
diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala
index 8d7e9d164..538a74198 100644
--- a/src/dotty/tools/dotc/core/TypeComparer.scala
+++ b/src/dotty/tools/dotc/core/TypeComparer.scala
@@ -76,6 +76,19 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
myNothingType
}
+ /** Indicates whether a previous subtype check used GADT bounds */
+ var GADTused = false
+
+ /** Record that GADT bounds of `sym` were used in a subtype check.
+ * But exclude constructor type parameters, as these are aliased
+ * to the corresponding class parameters, which does not constitute
+ * a true usage of a GADT symbol.
+ */
+ private def GADTusage(sym: Symbol) = {
+ if (!sym.owner.isConstructor) GADTused = true
+ true
+ }
+
// Subtype testing `<:<`
def topLevelSubType(tp1: Type, tp2: Type): Boolean = {
@@ -325,7 +338,8 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
val gbounds2 = ctx.gadt.bounds(tp2.symbol)
(gbounds2 != null) &&
(isSubTypeWhenFrozen(tp1, gbounds2.lo) ||
- narrowGADTBounds(tp2, tp1, isUpper = false))
+ narrowGADTBounds(tp2, tp1, isUpper = false)) &&
+ GADTusage(tp2.symbol)
}
((frozenConstraint || !isCappable(tp1)) && isSubType(tp1, lo2) ||
compareGADT ||
@@ -507,7 +521,8 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
val gbounds1 = ctx.gadt.bounds(tp1.symbol)
(gbounds1 != null) &&
(isSubTypeWhenFrozen(gbounds1.hi, tp2) ||
- narrowGADTBounds(tp1, tp2, isUpper = true))
+ narrowGADTBounds(tp1, tp2, isUpper = true)) &&
+ GADTusage(tp1.symbol)
}
isSubType(hi1, tp2) || compareGADT
case _ =>
@@ -846,11 +861,13 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
// special case for situations like:
// class C { type T }
// val foo: C
- // foo.type <: C { type T = foo.T }
+ // foo.type <: C { type T {= , <: , >:} foo.T }
def selfReferentialMatch = tp1.isInstanceOf[SingletonType] && {
rinfo2 match {
- case rinfo2: TypeAlias =>
- !defn.isBottomType(tp1.widen) && (tp1 select name) =:= rinfo2.alias
+ case rinfo2: TypeBounds =>
+ val mbr1 = tp1.select(name)
+ !defn.isBottomType(tp1.widen) &&
+ (mbr1 =:= rinfo2.hi || (rinfo2.hi ne rinfo2.lo) && mbr1 =:= rinfo2.lo)
case _ => false
}
}
diff --git a/src/dotty/tools/dotc/transform/TreeChecker.scala b/src/dotty/tools/dotc/transform/TreeChecker.scala
index ce160d7b0..18e3a6c8a 100644
--- a/src/dotty/tools/dotc/transform/TreeChecker.scala
+++ b/src/dotty/tools/dotc/transform/TreeChecker.scala
@@ -258,7 +258,7 @@ class TreeChecker extends Phase with SymTransformer {
}
override def typed(tree: untpd.Tree, pt: Type = WildcardType)(implicit ctx: Context): tpd.Tree = {
- val tpdTree = super.typed(tree)
+ val tpdTree = super.typed(tree, pt)
checkIdentNotJavaClass(tpdTree)
tpdTree
}
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala
index 45ed4d938..099105de3 100644
--- a/src/dotty/tools/dotc/typer/Applications.scala
+++ b/src/dotty/tools/dotc/typer/Applications.scala
@@ -775,14 +775,13 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
* The generalizations of a type T are the smallest set G such that
*
* - T is in G
- * - If a typeref R in G represents a trait, R's superclass is in G.
+ * - If a typeref R in G represents a class or trait, R's superclass is in G.
* - If a type proxy P is not a reference to a class, P's supertype is in G
*/
def isSubTypeOfParent(subtp: Type, tp: Type)(implicit ctx: Context): Boolean =
if (subtp <:< tp) true
else tp match {
- case tp: TypeRef if tp.symbol.isClass =>
- tp.symbol.is(Trait) && isSubTypeOfParent(subtp, tp.firstParent)
+ case tp: TypeRef if tp.symbol.isClass => isSubTypeOfParent(subtp, tp.firstParent)
case tp: TypeProxy => isSubTypeOfParent(subtp, tp.superType)
case _ => false
}
diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala
index 3c0a45e94..d90f37860 100644
--- a/src/dotty/tools/dotc/typer/Namer.scala
+++ b/src/dotty/tools/dotc/typer/Namer.scala
@@ -726,7 +726,7 @@ class Namer { typer: Typer =>
// the parent types are elaborated.
index(constr)
symbolOfTree(constr).ensureCompleted()
-
+
index(rest)(inClassContext(selfInfo))
val tparamAccessors = decls.filter(_ is TypeParamAccessor).toList
@@ -807,20 +807,27 @@ class Namer { typer: Typer =>
lazy val schema = paramFn(WildcardType)
val site = sym.owner.thisType
((NoType: Type) /: sym.owner.info.baseClasses.tail) { (tp, cls) =>
- val iRawInfo =
- cls.info.nonPrivateDecl(sym.name).matchingDenotation(site, schema).info
- val iInstInfo = iRawInfo match {
- case iRawInfo: PolyType =>
- if (iRawInfo.paramNames.length == typeParams.length)
- iRawInfo.instantiate(typeParams map (_.typeRef))
+ def instantiatedResType(info: Type, tparams: List[Symbol], paramss: List[List[Symbol]]): Type = info match {
+ case info: PolyType =>
+ if (info.paramNames.length == typeParams.length)
+ instantiatedResType(info.instantiate(tparams.map(_.typeRef)), Nil, paramss)
else NoType
+ case info: MethodType =>
+ paramss match {
+ case params :: paramss1 if info.paramNames.length == params.length =>
+ instantiatedResType(info.instantiate(params.map(_.termRef)), tparams, paramss1)
+ case _ =>
+ NoType
+ }
case _ =>
- if (typeParams.isEmpty) iRawInfo
+ if (tparams.isEmpty && paramss.isEmpty) info.widenExpr
else NoType
}
- val iResType = iInstInfo.finalResultType.asSeenFrom(site, cls)
+ val iRawInfo =
+ cls.info.nonPrivateDecl(sym.name).matchingDenotation(site, schema).info
+ val iResType = instantiatedResType(iRawInfo, typeParams, paramss).asSeenFrom(site, cls)
if (iResType.exists)
- typr.println(i"using inherited type for ${mdef.name}; raw: $iRawInfo, inst: $iInstInfo, inherited: $iResType")
+ typr.println(i"using inherited type for ${mdef.name}; raw: $iRawInfo, inherited: $iResType")
tp & iResType
}
}
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index 7eb022b51..f0086b0ab 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -346,11 +346,17 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
}
}
- if (ctx.compilationUnit.isJava && tree.name.isTypeName) {
+ def selectWithFallback(fallBack: => Tree) =
+ tryEither(tryCtx => asSelect(tryCtx))((_, _) => fallBack)
+
+ if (ctx.compilationUnit.isJava && tree.name.isTypeName)
// SI-3120 Java uses the same syntax, A.B, to express selection from the
// value A and from the type A. We have to try both.
- tryEither(tryCtx => asSelect(tryCtx))((_, _) => asJavaSelectFromTypeTree(ctx))
- } else asSelect(ctx)
+ selectWithFallback(asJavaSelectFromTypeTree(ctx))
+ else if (tree.name == nme.withFilter && tree.getAttachment(desugar.MaybeFilter).isDefined)
+ selectWithFallback(typedSelect(untpd.cpy.Select(tree)(tree.qualifier, nme.filter), pt))
+ else
+ asSelect(ctx)
}
def typedSelectFromTypeTree(tree: untpd.SelectFromTypeTree, pt: Type)(implicit ctx: Context): Tree = track("typedSelectFromTypeTree") {
@@ -1066,8 +1072,9 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
def completeAnnotations(mdef: untpd.MemberDef, sym: Symbol)(implicit ctx: Context): Unit = {
// necessary to force annotation trees to be computed.
sym.annotations.foreach(_.tree)
+ val annotCtx = ctx.outersIterator.dropWhile(_.owner == sym).next
// necessary in order to mark the typed ahead annotations as definitely typed:
- untpd.modsDeco(mdef).mods.annotations.foreach(typedAnnotation)
+ untpd.modsDeco(mdef).mods.annotations.foreach(typedAnnotation(_)(annotCtx))
}
def typedAnnotation(annot: untpd.Tree)(implicit ctx: Context): Tree = track("typedAnnotation") {
@@ -1715,6 +1722,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
else
missingArgs
case _ =>
+ ctx.typeComparer.GADTused = false
if (ctx.mode is Mode.Pattern) {
tree match {
case _: RefTree | _: Literal if !isVarPattern(tree) =>
@@ -1723,7 +1731,15 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
}
tree
}
- else if (tree.tpe <:< pt) tree
+ else if (tree.tpe <:< pt)
+ if (ctx.typeComparer.GADTused && pt.isValueType)
+ // Insert an explicit cast, so that -Ycheck in later phases succeeds.
+ // I suspect, but am not 100% sure that this might affect inferred types,
+ // if the expected type is a supertype of the GADT bound. It would be good to come
+ // up with a test case for this.
+ tree.asInstance(pt)
+ else
+ tree
else if (wtp.isInstanceOf[MethodType]) missingArgs
else {
typr.println(i"adapt to subtype ${tree.tpe} !<:< $pt")
diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala
index 31e74fa97..9f95a30c1 100644
--- a/test/dotc/tests.scala
+++ b/test/dotc/tests.scala
@@ -110,6 +110,7 @@ class tests extends CompilerTest {
@Test def rewrites = compileFile(posScala2Dir, "rewrites", "-rewrite" :: scala2mode)
@Test def pos_859 = compileFile(posSpecialDir, "i859", scala2mode)(allowDeepSubtypes)
+ @Test def pos_t8146a = compileFile(posSpecialDir, "t8146a")(allowDeepSubtypes)
@Test def pos_t5545 = {
// compile by hand in two batches, since junit lacks the infrastructure to
diff --git a/tests/pending/pos/t3999b.scala b/tests/disabled/not-representable/pos/t3999b.scala
index 0f3f7d642..0f3f7d642 100644
--- a/tests/pending/pos/t3999b.scala
+++ b/tests/disabled/not-representable/pos/t3999b.scala
diff --git a/tests/run/t5544/Api_1.scala b/tests/disabled/not-representable/pos/t5544/Api_1.scala
index b4c92864d..30994fa07 100644
--- a/tests/run/t5544/Api_1.scala
+++ b/tests/disabled/not-representable/pos/t5544/Api_1.scala
@@ -1,3 +1,4 @@
+// Uses structural types; therefore not expressible in dotty
import scala.annotation.StaticAnnotation
class ann(val bar: Any) extends StaticAnnotation
diff --git a/tests/run/t5544/Test_2.scala b/tests/disabled/not-representable/pos/t5544/Test_2.scala
index ea9232221..ea9232221 100644
--- a/tests/run/t5544/Test_2.scala
+++ b/tests/disabled/not-representable/pos/t5544/Test_2.scala
diff --git a/tests/pending/pos/t7035.scala b/tests/disabled/not-representable/pos/t7035.scala
index f45bd0a87..b1ce66cc6 100644
--- a/tests/pending/pos/t7035.scala
+++ b/tests/disabled/not-representable/pos/t7035.scala
@@ -1,3 +1,5 @@
+// no longer works because dotty uses name-nased pattern matching for case classes
+
case class Y(final var x: Int, final private var y: String, final val z1: Boolean, final private val z2: Any) {
import Test.{y => someY}
diff --git a/tests/pending/pos/t7228.scala b/tests/disabled/not-representable/pos/t7228.scala
index 5d936f652..525327857 100644
--- a/tests/pending/pos/t7228.scala
+++ b/tests/disabled/not-representable/pos/t7228.scala
@@ -1,3 +1,4 @@
+// no longer works because dotty does not have a concept of weak conformance
object AdaptWithWeaklyConformantType {
implicit class D(d: Double) { def double = d*2 }
diff --git a/tests/pending/pos/t8111.scala b/tests/disabled/not-representable/pos/t8111.scala
index 3f0e766ce..04a8e20de 100644
--- a/tests/pending/pos/t8111.scala
+++ b/tests/disabled/not-representable/pos/t8111.scala
@@ -1,3 +1,4 @@
+// structural types, cannot represent
trait T {
def crashy(ma: Any): Unit = {
diff --git a/tests/pending/pos/t5604b/T_1.scala b/tests/disabled/not-testable/t5604b/T_1.scala
index 179dcb10c..179dcb10c 100644
--- a/tests/pending/pos/t5604b/T_1.scala
+++ b/tests/disabled/not-testable/t5604b/T_1.scala
diff --git a/tests/pending/pos/t5604b/T_2.scala b/tests/disabled/not-testable/t5604b/T_2.scala
index 179dcb10c..179dcb10c 100644
--- a/tests/pending/pos/t5604b/T_2.scala
+++ b/tests/disabled/not-testable/t5604b/T_2.scala
diff --git a/tests/pending/pos/t5604b/Test_1.scala b/tests/disabled/not-testable/t5604b/Test_1.scala
index f7c58ebe8..f7c58ebe8 100644
--- a/tests/pending/pos/t5604b/Test_1.scala
+++ b/tests/disabled/not-testable/t5604b/Test_1.scala
diff --git a/tests/pending/pos/t5604b/Test_2.scala b/tests/disabled/not-testable/t5604b/Test_2.scala
index f7c58ebe8..f7c58ebe8 100644
--- a/tests/pending/pos/t5604b/Test_2.scala
+++ b/tests/disabled/not-testable/t5604b/Test_2.scala
diff --git a/tests/pending/pos/t5604b/pack_1.scala b/tests/disabled/not-testable/t5604b/pack_1.scala
index f50d568bf..f50d568bf 100644
--- a/tests/pending/pos/t5604b/pack_1.scala
+++ b/tests/disabled/not-testable/t5604b/pack_1.scala
diff --git a/tests/pending/pos/t5954a/A_1.scala b/tests/disabled/not-testable/t5954a/A_1.scala
index 10ead0b1c..10ead0b1c 100644
--- a/tests/pending/pos/t5954a/A_1.scala
+++ b/tests/disabled/not-testable/t5954a/A_1.scala
diff --git a/tests/pending/pos/t5954a/B_2.scala b/tests/disabled/not-testable/t5954a/B_2.scala
index 10ead0b1c..10ead0b1c 100644
--- a/tests/pending/pos/t5954a/B_2.scala
+++ b/tests/disabled/not-testable/t5954a/B_2.scala
diff --git a/tests/pending/pos/t5954b/A_1.scala b/tests/disabled/not-testable/t5954b/A_1.scala
index 8465e8f8c..8465e8f8c 100644
--- a/tests/pending/pos/t5954b/A_1.scala
+++ b/tests/disabled/not-testable/t5954b/A_1.scala
diff --git a/tests/pending/pos/t5954b/B_2.scala b/tests/disabled/not-testable/t5954b/B_2.scala
index f7e4704b3..f7e4704b3 100644
--- a/tests/pending/pos/t5954b/B_2.scala
+++ b/tests/disabled/not-testable/t5954b/B_2.scala
diff --git a/tests/pending/pos/t5954c/A_1.scala b/tests/disabled/not-testable/t5954c/A_1.scala
index 29ad9547a..29ad9547a 100644
--- a/tests/pending/pos/t5954c/A_1.scala
+++ b/tests/disabled/not-testable/t5954c/A_1.scala
diff --git a/tests/pending/pos/t5954c/B_2.scala b/tests/disabled/not-testable/t5954c/B_2.scala
index 29ad9547a..29ad9547a 100644
--- a/tests/pending/pos/t5954c/B_2.scala
+++ b/tests/disabled/not-testable/t5954c/B_2.scala
diff --git a/tests/pending/pos/t5954d/A_1.scala b/tests/disabled/not-testable/t5954d/A_1.scala
index 8465e8f8c..8465e8f8c 100644
--- a/tests/pending/pos/t5954d/A_1.scala
+++ b/tests/disabled/not-testable/t5954d/A_1.scala
diff --git a/tests/pending/pos/t5954d/B_2.scala b/tests/disabled/not-testable/t5954d/B_2.scala
index a4aa2eb58..a4aa2eb58 100644
--- a/tests/pending/pos/t5954d/B_2.scala
+++ b/tests/disabled/not-testable/t5954d/B_2.scala
diff --git a/tests/pending/pos/t8134/A_1.scala b/tests/disabled/not-testable/t8134/A_1.scala
index 32bce003f..32bce003f 100644
--- a/tests/pending/pos/t8134/A_1.scala
+++ b/tests/disabled/not-testable/t8134/A_1.scala
diff --git a/tests/pending/pos/t8134/B_2.scala b/tests/disabled/not-testable/t8134/B_2.scala
index 32bce003f..32bce003f 100644
--- a/tests/pending/pos/t8134/B_2.scala
+++ b/tests/disabled/not-testable/t8134/B_2.scala
diff --git a/tests/pending/pos/depmet_implicit_oopsla_zipwith.scala b/tests/disabled/structural-type/pos/depmet_implicit_oopsla_zipwith.scala
index 83171f865..83171f865 100644
--- a/tests/pending/pos/depmet_implicit_oopsla_zipwith.scala
+++ b/tests/disabled/structural-type/pos/depmet_implicit_oopsla_zipwith.scala
diff --git a/tests/pending/pos/t8237b.scala b/tests/disabled/typetags/pos/t8237b.scala
index 52bb310e8..52bb310e8 100644
--- a/tests/pending/pos/t8237b.scala
+++ b/tests/disabled/typetags/pos/t8237b.scala
diff --git a/tests/pending/pos/t7239.scala b/tests/neg/t7239.scala
index 16e9d00f1..f3a379b4e 100644
--- a/tests/pending/pos/t7239.scala
+++ b/tests/neg/t7239.scala
@@ -1,3 +1,5 @@
+// Dotty rewrites only withFilter calls occurring in for expressions to filter calls.
+// So this test does not compile.
object Test {
def BrokenMethod(): HasFilter[(Int, String)] = ???
@@ -15,12 +17,12 @@ object Test {
(implicit F0: NoImplicit): HasWithFilter = ???
}
- BrokenMethod().withFilter(_ => true) // okay
- BrokenMethod().filter(_ => true) // okay
+ BrokenMethod().withFilter(_ => true) // error
+ BrokenMethod().filter(_ => true) // ok
locally {
import addWithFilter._
- BrokenMethod().withFilter((_: (Int, String)) => true) // okay
+ BrokenMethod().withFilter((_: (Int, String)) => true) // error
}
locally {
@@ -33,6 +35,6 @@ object Test {
// `(B => Boolean)`. Only later during pickling does the
// defensive check for erroneous types in the tree pick up
// the problem.
- BrokenMethod().withFilter(x => true) // erroneous or inaccessible type.
+ BrokenMethod().withFilter(x => true) // error
}
}
diff --git a/tests/pending/pos/t8002-nested-scope.scala b/tests/neg/t8002-nested-scope.scala
index a2088bce7..78a03ce66 100644
--- a/tests/pending/pos/t8002-nested-scope.scala
+++ b/tests/neg/t8002-nested-scope.scala
@@ -13,7 +13,7 @@ class C {
{
val a = 0
object C {
- new C().x
+ new C().x // error: cannot be accessed
}
}
}
diff --git a/tests/pending/neg/i533/Compat.scala b/tests/pending/neg/i533/Compat.scala
new file mode 100644
index 000000000..16613cf5b
--- /dev/null
+++ b/tests/pending/neg/i533/Compat.scala
@@ -0,0 +1,7 @@
+object Compat {
+ def main(args: Array[String]): Unit = {
+ val x = new Array[Int](1)
+ x(0) = 10
+ println(JA.get(x))
+ }
+}
diff --git a/tests/pending/neg/i533/JA.java b/tests/pending/neg/i533/JA.java
new file mode 100644
index 000000000..92421e5b1
--- /dev/null
+++ b/tests/pending/neg/i533/JA.java
@@ -0,0 +1,5 @@
+class JA {
+ public static <T> T get(T[] arr) {
+ return arr[0];
+ }
+} \ No newline at end of file
diff --git a/tests/pending/pos/contraImplicits.scala b/tests/pending/pos/contraImplicits.scala
deleted file mode 100644
index c4d659615..000000000
--- a/tests/pending/pos/contraImplicits.scala
+++ /dev/null
@@ -1,18 +0,0 @@
-import scala.reflect._
-// this needs to be fleshed out further
-class Contra[-T]
-
-object Test {
- def getParam[T](c: Contra[T])(implicit ct: ClassTag[T]): Unit = {
- println(ct)
- ct
- }
- def f[T](x: Contra[T]): Contra[T] = x
-
- def main(args: Array[String]): Unit = {
- val x = f(new Contra[Int])
- val y: Contra[Int] = x
- getParam(new Contra[Int])
- }
-}
-
diff --git a/tests/pending/pos/depmet_implicit_norm_ret.scala b/tests/pending/pos/depmet_implicit_norm_ret.scala
index 85be750b4..42bfb9fe1 100644
--- a/tests/pending/pos/depmet_implicit_norm_ret.scala
+++ b/tests/pending/pos/depmet_implicit_norm_ret.scala
@@ -17,6 +17,8 @@ object Test{
}
}
+ import ZipWith._
+
trait ZipWith[S] {
type T
def zipWith : S => T = sys.error("")
@@ -24,6 +26,9 @@ object Test{
// bug: inferred return type = (Stream[A]) => java.lang.Object with Test.ZipWith[B]{type T = Stream[B]}#T
// this seems incompatible with vvvvvvvvvvvvvvvvvvvvvv -- #3731
- def map[A,B](f : A => B) /* : Stream[A] => Stream[B]*/ = ZipWith(f)
- val tst: Stream[Int] = map{x: String => x.length}(Stream("a"))
+ def map1[A,B](f : A => B) = ZipWith(f)(SuccZipWith) // this typechecks but fails in -Ycheck:first
+ val tst1: Stream[Int] = map1[String, Int]{x: String => x.length}.apply(Stream("a"))
+
+ def map2[A,B](f : A => B) = ZipWith(f) // this finds ZeroZipWith where scalac finds SuccZipWith and fails typechecking in the next line.
+ val tst2: Stream[Int] = map2{x: String => x.length}.apply(Stream("a"))
}
diff --git a/tests/pending/pos/depsel.scala b/tests/pending/pos/depsel.scala
deleted file mode 100644
index 2cec4349e..000000000
--- a/tests/pending/pos/depsel.scala
+++ /dev/null
@@ -1,14 +0,0 @@
-// demonstrates selection on non-path types. Needs to be fleshed out to
-// become a real test.
-object Test {
-
- class C {
- type T
- val f: T => T = ???
- }
-
- var x = new C
- val y = x.f
-
-
-}
diff --git a/tests/pending/pos/exponential-spec.scala b/tests/pending/pos/exponential-spec.scala
index 54515c1d2..26c9ab85e 100644
--- a/tests/pending/pos/exponential-spec.scala
+++ b/tests/pending/pos/exponential-spec.scala
@@ -23,7 +23,7 @@ object Test {
compose f[T] // 8s
compose f[T] // 11s
compose f[T] // 17s
- compose f[T] // 29s
+/* compose f[T] // 29s
compose f[T] // 54s
compose f[T]
compose f[T]
@@ -42,6 +42,6 @@ object Test {
compose f[T]
compose f[T]
compose f[T]
- compose f[T]
+ compose f[T]*/
)(exp)
}
diff --git a/tests/pending/pos/generic-sigs.flags b/tests/pending/pos/generic-sigs.flags
deleted file mode 100644
index e8fb65d50..000000000
--- a/tests/pending/pos/generic-sigs.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xfatal-warnings \ No newline at end of file
diff --git a/tests/pending/pos/infersingle.flags b/tests/pending/pos/infersingle.flags
deleted file mode 100644
index e1b37447c..000000000
--- a/tests/pending/pos/infersingle.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xexperimental \ No newline at end of file
diff --git a/tests/pending/pos/setter-not-implicit.scala b/tests/pending/pos/setter-not-implicit.scala
deleted file mode 100644
index 9bfffc2ce..000000000
--- a/tests/pending/pos/setter-not-implicit.scala
+++ /dev/null
@@ -1,3 +0,0 @@
-object O {
- implicit var x: Int = 0
-}
diff --git a/tests/pending/pos/stable.scala b/tests/pending/pos/stable.scala
deleted file mode 100644
index 267a36fe5..000000000
--- a/tests/pending/pos/stable.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-trait Base {
- val x: Int;
- val y: Int;
- var z: Int;
-}
-
-class Sub() extends Base {
- val x: Int = 1;
- val y: Int = 2;
- var z: Int = 3;
-}
diff --git a/tests/pending/pos/t3631.scala b/tests/pending/pos/t3631.scala
index e72374130..207e28cd7 100644
--- a/tests/pending/pos/t3631.scala
+++ b/tests/pending/pos/t3631.scala
@@ -1,3 +1,4 @@
+// fails Ycheck
case class X22(x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int, x10: Int, x11: Int, x12: Int, x13: Int, x14: Int, x15: Int, x16: Int, x17: Int, x18: Int, x19: Int, x20: Int, x21: Int, x22: Int) { }
case class X23(x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, x7: Int, x8: Int, x9: Int, x10: Int, x11: Int, x12: Int, x13: Int, x14: Int, x15: Int, x16: Int, x17: Int, x18: Int, x19: Int, x20: Int, x21: Int, x22: Int, x23: Int) { }
diff --git a/tests/pending/pos/t3960.flags b/tests/pending/pos/t3960.flags
deleted file mode 100644
index 4449dbbdf..000000000
--- a/tests/pending/pos/t3960.flags
+++ /dev/null
@@ -1 +0,0 @@
--Ycheck:typer \ No newline at end of file
diff --git a/tests/pending/pos/t4188.scala b/tests/pending/pos/t4188.scala
index 40e7d4924..104473fc5 100644
--- a/tests/pending/pos/t4188.scala
+++ b/tests/pending/pos/t4188.scala
@@ -1,3 +1,4 @@
+// Fails Ycheck
class A {
object Ding
class B {
diff --git a/tests/pending/pos/t4579.flags b/tests/pending/pos/t4579.flags
deleted file mode 100644
index 1182725e8..000000000
--- a/tests/pending/pos/t4579.flags
+++ /dev/null
@@ -1 +0,0 @@
--optimize \ No newline at end of file
diff --git a/tests/pending/pos/t4911.flags b/tests/pending/pos/t4911.flags
deleted file mode 100644
index 779916d58..000000000
--- a/tests/pending/pos/t4911.flags
+++ /dev/null
@@ -1 +0,0 @@
--unchecked -Xfatal-warnings \ No newline at end of file
diff --git a/tests/pending/pos/t5029.flags b/tests/pending/pos/t5029.flags
deleted file mode 100644
index e8fb65d50..000000000
--- a/tests/pending/pos/t5029.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xfatal-warnings \ No newline at end of file
diff --git a/tests/pending/pos/t5899.flags b/tests/pending/pos/t5899.flags
deleted file mode 100644
index e8fb65d50..000000000
--- a/tests/pending/pos/t5899.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xfatal-warnings \ No newline at end of file
diff --git a/tests/pending/pos/t5932.flags b/tests/pending/pos/t5932.flags
deleted file mode 100644
index e8fb65d50..000000000
--- a/tests/pending/pos/t5932.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xfatal-warnings \ No newline at end of file
diff --git a/tests/pending/pos/t6123-explaintypes-implicits.flags b/tests/pending/pos/t6123-explaintypes-implicits.flags
deleted file mode 100644
index b36707c7c..000000000
--- a/tests/pending/pos/t6123-explaintypes-implicits.flags
+++ /dev/null
@@ -1 +0,0 @@
--explaintypes
diff --git a/tests/pending/pos/t6994.flags b/tests/pending/pos/t6994.flags
deleted file mode 100644
index e8fb65d50..000000000
--- a/tests/pending/pos/t6994.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xfatal-warnings \ No newline at end of file
diff --git a/tests/pending/pos/t7011.flags b/tests/pending/pos/t7011.flags
deleted file mode 100644
index a4c161553..000000000
--- a/tests/pending/pos/t7011.flags
+++ /dev/null
@@ -1 +0,0 @@
--Ydebug -Xfatal-warnings \ No newline at end of file
diff --git a/tests/pending/pos/t7285a.flags b/tests/pending/pos/t7285a.flags
deleted file mode 100644
index e8fb65d50..000000000
--- a/tests/pending/pos/t7285a.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xfatal-warnings \ No newline at end of file
diff --git a/tests/pending/pos/t7296.scala b/tests/pending/pos/t7296.scala
index 0c078d365..fcba17c08 100644
--- a/tests/pending/pos/t7296.scala
+++ b/tests/pending/pos/t7296.scala
@@ -1,3 +1,4 @@
+// Fails Ycheck
object Test {
type A = Int
// Emits the implementation restriction but then proceeds to crash
diff --git a/tests/pending/pos/t762.scala b/tests/pending/pos/t762.scala
deleted file mode 100644
index 76860272e..000000000
--- a/tests/pending/pos/t762.scala
+++ /dev/null
@@ -1,2 +0,0 @@
-trait Foo { type T }
-trait Bar extends Foo { val x : Foo { type T <: Bar.this.T } = this : this.type }
diff --git a/tests/pending/pos/t8187.check b/tests/pending/pos/t8187.check
deleted file mode 100644
index e69de29bb..000000000
--- a/tests/pending/pos/t8187.check
+++ /dev/null
diff --git a/tests/pending/pos/t8364.check b/tests/pending/pos/t8364.check
deleted file mode 100644
index e69de29bb..000000000
--- a/tests/pending/pos/t8364.check
+++ /dev/null
diff --git a/tests/pending/pos/t8369a.check b/tests/pending/pos/t8369a.check
deleted file mode 100644
index e69de29bb..000000000
--- a/tests/pending/pos/t8369a.check
+++ /dev/null
diff --git a/tests/pending/pos/trait-force-info.flags b/tests/pending/pos/trait-force-info.flags
deleted file mode 100644
index eb4d19bcb..000000000
--- a/tests/pending/pos/trait-force-info.flags
+++ /dev/null
@@ -1 +0,0 @@
--optimise \ No newline at end of file
diff --git a/tests/pending/pos/virtpatmat_alts_subst.flags b/tests/pending/pos/virtpatmat_alts_subst.flags
deleted file mode 100644
index 3f5a3100e..000000000
--- a/tests/pending/pos/virtpatmat_alts_subst.flags
+++ /dev/null
@@ -1 +0,0 @@
- -Xexperimental
diff --git a/tests/pending/pos/virtpatmat_exist1.flags b/tests/pending/pos/virtpatmat_exist1.flags
deleted file mode 100644
index 3f5a3100e..000000000
--- a/tests/pending/pos/virtpatmat_exist1.flags
+++ /dev/null
@@ -1 +0,0 @@
- -Xexperimental
diff --git a/tests/pending/pos/virtpatmat_exist3.flags b/tests/pending/pos/virtpatmat_exist3.flags
deleted file mode 100644
index 3f5a3100e..000000000
--- a/tests/pending/pos/virtpatmat_exist3.flags
+++ /dev/null
@@ -1 +0,0 @@
- -Xexperimental
diff --git a/tests/pending/pos/t7688.scala b/tests/pos-scala2/t7688.scala
index 5a846b97e..5a846b97e 100644
--- a/tests/pending/pos/t7688.scala
+++ b/tests/pos-scala2/t7688.scala
diff --git a/tests/pending/pos/t8146a.scala b/tests/pos-special/t8146a.scala
index e4eb8d3fd..e4eb8d3fd 100644
--- a/tests/pending/pos/t8146a.scala
+++ b/tests/pos-special/t8146a.scala
diff --git a/tests/pending/pos/apply-equiv.scala b/tests/pos/apply-equiv.scala
index f53b8b5ab..f53b8b5ab 100644
--- a/tests/pending/pos/apply-equiv.scala
+++ b/tests/pos/apply-equiv.scala
diff --git a/tests/pos/dependent-implicits.scala b/tests/pos/dependent-implicits.scala
new file mode 100644
index 000000000..17a323112
--- /dev/null
+++ b/tests/pos/dependent-implicits.scala
@@ -0,0 +1,7 @@
+object Test {
+ trait T { type X; val x: X }
+ implicit def f(x: T): x.X = x.x
+ val t = new T { type X = String; val x = "" }
+ val x: String = t
+ val uy: String = f(t)
+}
diff --git a/tests/pending/pos/extractor-types.scala b/tests/pos/extractor-types.scala
index 200279be6..200279be6 100644
--- a/tests/pending/pos/extractor-types.scala
+++ b/tests/pos/extractor-types.scala
diff --git a/tests/pos/for-filter.scala b/tests/pos/for-filter.scala
new file mode 100644
index 000000000..3baac4f0c
--- /dev/null
+++ b/tests/pos/for-filter.scala
@@ -0,0 +1,12 @@
+object Test {
+
+ case class C[T](xs: List[T]) {
+ def filter(p: T => Boolean) = new C(xs.filter(p))
+ def map[U](f: T => U) = new C(xs.map(f))
+ }
+
+ def main(args: Array[String]): Unit =
+ println(for (x <- C(List(1, 2, 3)) if x % 2 == 0) yield x)
+ // println(C(List(1, 2, 3)).withFilter(_ % 2 == 0)) // error
+
+}
diff --git a/tests/pending/pos/gadts2.scala b/tests/pos/gadts2.scala
index b67bafb32..bdf1c8e8a 100644
--- a/tests/pending/pos/gadts2.scala
+++ b/tests/pos/gadts2.scala
@@ -8,7 +8,7 @@ object Test {
case class Cell[a](var x: a) extends Term[a]
final case class NumTerm(val n: Number) extends Term[Number]
- def f[a](t: Term[a], c: Cell[a]): Unit = {
+ def f[A](t: Term[A], c: Cell[A]): Unit = {
t match {
case NumTerm(n) => c.x = MyDouble(1.0)
}
diff --git a/tests/pending/pos/hk-infer.scala b/tests/pos/hk-infer.scala
index c23a9d151..c23a9d151 100644
--- a/tests/pending/pos/hk-infer.scala
+++ b/tests/pos/hk-infer.scala
diff --git a/tests/pending/pos/i743.scala b/tests/pos/i743.scala
index 8fe522cee..8fe522cee 100644
--- a/tests/pending/pos/i743.scala
+++ b/tests/pos/i743.scala
diff --git a/tests/pending/pos/infersingle.scala b/tests/pos/infersingle.scala
index 60f4ff07e..60f4ff07e 100644
--- a/tests/pending/pos/infersingle.scala
+++ b/tests/pos/infersingle.scala
diff --git a/tests/pending/pos/lazyvals.scala b/tests/pos/lazyvals.scala
index 93a82cd0c..93a82cd0c 100644
--- a/tests/pending/pos/lazyvals.scala
+++ b/tests/pos/lazyvals.scala
diff --git a/tests/pending/pos/matthias4.scala b/tests/pos/matthias4.scala
index 18599ae71..18599ae71 100644
--- a/tests/pending/pos/matthias4.scala
+++ b/tests/pos/matthias4.scala
diff --git a/tests/pending/pos/mixins.scala b/tests/pos/mixins.scala
index 846d6a41b..846d6a41b 100644
--- a/tests/pending/pos/mixins.scala
+++ b/tests/pos/mixins.scala
diff --git a/tests/pending/pos/return_thistype.scala b/tests/pos/return_thistype.scala
index c0736c0ad..c0736c0ad 100644
--- a/tests/pending/pos/return_thistype.scala
+++ b/tests/pos/return_thistype.scala
diff --git a/tests/pending/pos/t3494.scala b/tests/pos/t3494.scala
index dd54b0f82..dd54b0f82 100644
--- a/tests/pending/pos/t3494.scala
+++ b/tests/pos/t3494.scala
diff --git a/tests/pending/pos/t3800.scala b/tests/pos/t3800.scala
index 096502174..096502174 100644
--- a/tests/pending/pos/t3800.scala
+++ b/tests/pos/t3800.scala
diff --git a/tests/pending/pos/t3862.scala b/tests/pos/t3862.scala
index 0d978caa4..0d978caa4 100644
--- a/tests/pending/pos/t3862.scala
+++ b/tests/pos/t3862.scala
diff --git a/tests/pending/pos/t3880.scala b/tests/pos/t3880.scala
index f778eb71a..f778eb71a 100644
--- a/tests/pending/pos/t3880.scala
+++ b/tests/pos/t3880.scala
diff --git a/tests/pending/pos/t3999/a_1.scala b/tests/pos/t3999/a_1.scala
index be9cc371e..7ef67bba4 100644
--- a/tests/pending/pos/t3999/a_1.scala
+++ b/tests/pos/t3999/a_1.scala
@@ -4,6 +4,6 @@ class Outside
package object bar {
class Val(b: Boolean)
- implicit def boolean2Val(b: Boolean): foo.bar.package.Val = new Val(b)
+ implicit def boolean2Val(b: Boolean): foo.bar.`package`.Val = new Val(b)
implicit def boolean2Outside(b: Boolean): foo.Outside = new Outside
}
diff --git a/tests/pending/pos/t3999/b_2.scala b/tests/pos/t3999/b_2.scala
index 775b839d9..775b839d9 100644
--- a/tests/pending/pos/t3999/b_2.scala
+++ b/tests/pos/t3999/b_2.scala
diff --git a/tests/pending/pos/t4269.scala b/tests/pos/t4269.scala
index fe0c20103..fe0c20103 100644
--- a/tests/pending/pos/t4269.scala
+++ b/tests/pos/t4269.scala
diff --git a/tests/pos/t5070.scala b/tests/pos/t5070.scala
new file mode 100644
index 000000000..410afba14
--- /dev/null
+++ b/tests/pos/t5070.scala
@@ -0,0 +1,15 @@
+trait A {
+ type T
+}
+
+object O {
+ implicit def b(implicit x: A): x.T = error("")
+}
+
+class Test {
+ import O._
+ implicit val a: A = new A {}
+ implicitly[a.T] // works
+
+ implicitly[a.T](b(a)) // works
+}
diff --git a/tests/pending/pos/t5330.scala b/tests/pos/t5330.scala
index 24aab7733..24aab7733 100644
--- a/tests/pending/pos/t5330.scala
+++ b/tests/pos/t5330.scala
diff --git a/tests/pending/pos/t5604/ReplConfig.scala b/tests/pos/t5604/ReplConfig.scala
index 8c589eba6..8c589eba6 100644
--- a/tests/pending/pos/t5604/ReplConfig.scala
+++ b/tests/pos/t5604/ReplConfig.scala
diff --git a/tests/pending/pos/t5604/ReplReporter.scala b/tests/pos/t5604/ReplReporter.scala
index 9423efd8a..9423efd8a 100644
--- a/tests/pending/pos/t5604/ReplReporter.scala
+++ b/tests/pos/t5604/ReplReporter.scala
diff --git a/tests/pending/pos/t5726.scala b/tests/pos/t5726.scala
index 1ef14ac79..1ef14ac79 100644
--- a/tests/pending/pos/t5726.scala
+++ b/tests/pos/t5726.scala
diff --git a/tests/pending/pos/t5769.scala b/tests/pos/t5769.scala
index d7ec23a56..d7ec23a56 100644
--- a/tests/pending/pos/t5769.scala
+++ b/tests/pos/t5769.scala
diff --git a/tests/pending/pos/t578.scala b/tests/pos/t578.scala
index 6f95dd8ce..6f95dd8ce 100644
--- a/tests/pending/pos/t578.scala
+++ b/tests/pos/t578.scala
diff --git a/tests/pending/pos/t5899.scala b/tests/pos/t5899.scala
index 852b4e3e7..852b4e3e7 100644
--- a/tests/pending/pos/t5899.scala
+++ b/tests/pos/t5899.scala
diff --git a/tests/pending/pos/t6084.scala b/tests/pos/t6084.scala
index 1aa1fed39..1aa1fed39 100644
--- a/tests/pending/pos/t6084.scala
+++ b/tests/pos/t6084.scala
diff --git a/tests/pending/pos/t6722.scala b/tests/pos/t6722.scala
index 576746c91..576746c91 100644
--- a/tests/pending/pos/t6722.scala
+++ b/tests/pos/t6722.scala
diff --git a/tests/pending/pos/t6815_import.scala b/tests/pos/t6815_import.scala
index 56f4358d5..56f4358d5 100644
--- a/tests/pending/pos/t6815_import.scala
+++ b/tests/pos/t6815_import.scala
diff --git a/tests/pending/pos/t6948.scala b/tests/pos/t6948.scala
index 12a1d7eaf..12a1d7eaf 100644
--- a/tests/pending/pos/t6948.scala
+++ b/tests/pos/t6948.scala
diff --git a/tests/pending/pos/t7294.scala b/tests/pos/t7294.scala
index ccac2b140..ccac2b140 100644
--- a/tests/pending/pos/t7294.scala
+++ b/tests/pos/t7294.scala
diff --git a/tests/pending/pos/t7426.scala b/tests/pos/t7426.scala
index 8e42ad181..8e42ad181 100644
--- a/tests/pending/pos/t7426.scala
+++ b/tests/pos/t7426.scala
diff --git a/tests/pending/pos/t7517.scala b/tests/pos/t7517.scala
index d0462c48d..d0462c48d 100644
--- a/tests/pending/pos/t7517.scala
+++ b/tests/pos/t7517.scala
diff --git a/tests/pos/t762.scala b/tests/pos/t762.scala
new file mode 100644
index 000000000..c5bf39b0c
--- /dev/null
+++ b/tests/pos/t762.scala
@@ -0,0 +1,4 @@
+trait Foo { type T }
+trait Bar1 extends Foo { val x : Foo { type T <: Bar1.this.T } = this }
+trait Bar2 extends Foo { val x : Foo { type T = Bar2.this.T } = this }
+trait Bar3 extends Foo { val x : Foo { type T >: Bar3.this.T } = this }
diff --git a/tests/pending/pos/t7668.scala b/tests/pos/t7668.scala
index 222a13d03..6657ffab6 100644
--- a/tests/pending/pos/t7668.scala
+++ b/tests/pos/t7668.scala
@@ -8,5 +8,5 @@ trait Extractor {
}
class Sub extends Extractor {
- def extract(s: Space) = s.x
+ def extract(ss: Space) = ss.x
}
diff --git a/tests/pending/pos/t7902.scala b/tests/pos/t7902.scala
index 7793d3723..7793d3723 100644
--- a/tests/pending/pos/t7902.scala
+++ b/tests/pos/t7902.scala
diff --git a/tests/pending/pos/t8046c.scala b/tests/pos/t8046c.scala
index f05b4c15b..f05b4c15b 100644
--- a/tests/pending/pos/t8046c.scala
+++ b/tests/pos/t8046c.scala
diff --git a/tests/pending/pos/t807.scala b/tests/pos/t807.scala
index 0eeb92ea2..0eeb92ea2 100644
--- a/tests/pending/pos/t807.scala
+++ b/tests/pos/t807.scala
diff --git a/tests/pending/pos/t8300-patmat-a.scala b/tests/pos/t8300-patmat-a.scala
index ab3a3c960..ab3a3c960 100644
--- a/tests/pending/pos/t8300-patmat-a.scala
+++ b/tests/pos/t8300-patmat-a.scala
diff --git a/tests/pending/pos/t8300-patmat-b.scala b/tests/pos/t8300-patmat-b.scala
index 0acad4406..0acad4406 100644
--- a/tests/pending/pos/t8300-patmat-b.scala
+++ b/tests/pos/t8300-patmat-b.scala
diff --git a/tests/pending/pos/t8301b.scala b/tests/pos/t8301b.scala
index 4dd39139d..4dd39139d 100644
--- a/tests/pending/pos/t8301b.scala
+++ b/tests/pos/t8301b.scala
diff --git a/tests/pending/pos/t8364.scala b/tests/pos/t8364.scala
index 7a7ea1ff1..7a7ea1ff1 100644
--- a/tests/pending/pos/t8364.scala
+++ b/tests/pos/t8364.scala
diff --git a/tests/pending/pos/trait-force-info.scala b/tests/pos/trait-force-info.scala
index c2b33869c..c2b33869c 100644
--- a/tests/pending/pos/trait-force-info.scala
+++ b/tests/pos/trait-force-info.scala