From d30429fe78476705425238b4a15d94729290dc43 Mon Sep 17 00:00:00 2001
From: "Paolo G. Giarrusso"
Date: Sat, 25 Aug 2018 18:44:04 +0200
Subject: [PATCH 01/13] Fix #5008: forbid enums extending enums
Check if we inherit from scala.Enum both directly (as a result of the
desugaring) and indirectly.
---
compiler/src/dotty/tools/dotc/typer/Typer.scala | 16 ++++++++++++++++
tests/neg/i5008.scala | 5 +++++
tests/pending/neg/i5008 | 2 --
3 files changed, 21 insertions(+), 2 deletions(-)
create mode 100644 tests/neg/i5008.scala
delete mode 100644 tests/pending/neg/i5008
diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala
index 240999864503..2ca277335a51 100644
--- a/compiler/src/dotty/tools/dotc/typer/Typer.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala
@@ -1517,6 +1517,11 @@ class Typer extends Namer
val seenParents = mutable.Set[Symbol]()
+ var parentIsEnumClass = false
+ // Since enums are classes and Namer checks that classes don't extend multiple classes, we can only have one
+ // violation.
+ var enumParentOpt: Option[Symbol] = None
+
def typedParent(tree: untpd.Tree): Tree = {
var result = if (tree.isType) typedType(tree)(superCtx) else typedExpr(tree)(superCtx)
val psym = result.tpe.dealias.typeSymbol
@@ -1530,6 +1535,11 @@ class Typer extends Namer
else checkParentCall(result, cls)
checkTraitInheritance(psym, cls, tree.pos)
if (cls is Case) checkCaseInheritance(psym, cls, tree.pos)
+ if (psym == defn.EnumClass)
+ parentIsEnumClass = true
+ else if (psym.derivesFrom(defn.EnumClass))
+ enumParentOpt = Some(psym)
+
result
}
@@ -1576,6 +1586,12 @@ class Typer extends Namer
if (!cls.is(AbstractOrTrait) && !ctx.isAfterTyper)
checkRealizableBounds(cls, cdef.namePos)
if (cls.is(Case) && cls.derivesFrom(defn.EnumClass)) checkEnum(cdef, cls)
+ if (parentIsEnumClass) {
+ for (enumParent <- enumParentOpt)
+ //Tricky to phrase; language taken from "case-to-case inheritance is prohibited".
+ ctx.error(s"Enum ${cls.name} has enum ancestor ${enumParent.name}, but enum-to-enum inheritance is prohibited", cdef.pos)
+ }
+
val cdef1 = assignType(cpy.TypeDef(cdef)(name, impl1), cls)
if (ctx.phase.isTyper && cdef1.tpe.derivesFrom(defn.DynamicClass) && !ctx.dynamicsEnabled) {
val isRequired = parents1.exists(_.tpe.isRef(defn.DynamicClass))
diff --git a/tests/neg/i5008.scala b/tests/neg/i5008.scala
new file mode 100644
index 000000000000..2c856a07c334
--- /dev/null
+++ b/tests/neg/i5008.scala
@@ -0,0 +1,5 @@
+enum Foo { case A }
+enum Bar { case A }
+enum Baz extends Foo { case Z } // error
+
+enum Quux extends Foo with Bar { case Z } // error
diff --git a/tests/pending/neg/i5008 b/tests/pending/neg/i5008
deleted file mode 100644
index 2dc75e6b199c..000000000000
--- a/tests/pending/neg/i5008
+++ /dev/null
@@ -1,2 +0,0 @@
-enum Foo {}
-enum Bar extends Foo {} // error
From ca4481a98c9ea3b5022fb7cb6b5bc8a2845f70dd Mon Sep 17 00:00:00 2001
From: "Paolo G. Giarrusso"
Date: Sat, 25 Aug 2018 21:00:09 +0200
Subject: [PATCH 02/13] Fix #5010: check type parents have type arguments
---
compiler/src/dotty/tools/dotc/typer/Typer.scala | 1 +
tests/neg/i5010.scala | 1 +
2 files changed, 2 insertions(+)
create mode 100644 tests/neg/i5010.scala
diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala
index 2ca277335a51..c70d37fa8a49 100644
--- a/compiler/src/dotty/tools/dotc/typer/Typer.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala
@@ -1529,6 +1529,7 @@ class Typer extends Namer
ctx.error(i"$psym is extended twice", tree.pos)
seenParents += psym
if (tree.isType) {
+ checkSimpleKinded(result) // Not needed for constructor calls, as type arguments will be inferred.
if (psym.is(Trait) && !cls.is(Trait) && !cls.superClass.isSubClass(psym))
result = maybeCall(result, psym, psym.primaryConstructor.info)
}
diff --git a/tests/neg/i5010.scala b/tests/neg/i5010.scala
new file mode 100644
index 000000000000..7cdf67c8135b
--- /dev/null
+++ b/tests/neg/i5010.scala
@@ -0,0 +1 @@
+class i0 extends Function0 // error
From dce826f46aee86c4f35432243193caa618fd9fe7 Mon Sep 17 00:00:00 2001
From: "Paolo G. Giarrusso"
Date: Sat, 25 Aug 2018 21:11:25 +0200
Subject: [PATCH 03/13] Simplify fix for #5008
---
.../src/dotty/tools/dotc/typer/Typer.scala | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala
index c70d37fa8a49..6e281c131ba6 100644
--- a/compiler/src/dotty/tools/dotc/typer/Typer.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala
@@ -1517,11 +1517,6 @@ class Typer extends Namer
val seenParents = mutable.Set[Symbol]()
- var parentIsEnumClass = false
- // Since enums are classes and Namer checks that classes don't extend multiple classes, we can only have one
- // violation.
- var enumParentOpt: Option[Symbol] = None
-
def typedParent(tree: untpd.Tree): Tree = {
var result = if (tree.isType) typedType(tree)(superCtx) else typedExpr(tree)(superCtx)
val psym = result.tpe.dealias.typeSymbol
@@ -1536,11 +1531,6 @@ class Typer extends Namer
else checkParentCall(result, cls)
checkTraitInheritance(psym, cls, tree.pos)
if (cls is Case) checkCaseInheritance(psym, cls, tree.pos)
- if (psym == defn.EnumClass)
- parentIsEnumClass = true
- else if (psym.derivesFrom(defn.EnumClass))
- enumParentOpt = Some(psym)
-
result
}
@@ -1587,10 +1577,13 @@ class Typer extends Namer
if (!cls.is(AbstractOrTrait) && !ctx.isAfterTyper)
checkRealizableBounds(cls, cdef.namePos)
if (cls.is(Case) && cls.derivesFrom(defn.EnumClass)) checkEnum(cdef, cls)
- if (parentIsEnumClass) {
- for (enumParent <- enumParentOpt)
+ if (seenParents.contains(defn.EnumClass)) {
+ // Since enums are classes and Namer checks that classes don't extend multiple classes, we only check the class
+ // parent.
+ val firstParent = parents1.head.tpe.dealias.typeSymbol
+ if (firstParent.derivesFrom(defn.EnumClass))
//Tricky to phrase; language taken from "case-to-case inheritance is prohibited".
- ctx.error(s"Enum ${cls.name} has enum ancestor ${enumParent.name}, but enum-to-enum inheritance is prohibited", cdef.pos)
+ ctx.error(s"Enum ${cls.name} has enum ancestor ${firstParent.name}, but enum-to-enum inheritance is prohibited", cdef.pos)
}
val cdef1 = assignType(cpy.TypeDef(cdef)(name, impl1), cls)
From 4c92bf1c1c4a8c527507545f2637b4583c6d0db2 Mon Sep 17 00:00:00 2001
From: "Paolo G. Giarrusso"
Date: Sat, 25 Aug 2018 22:05:50 +0200
Subject: [PATCH 04/13] Update error markers
---
tests/neg/i1643.scala | 2 +-
tests/neg/parser-stability-16.scala | 2 +-
tests/neg/parser-stability-7.scala | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/neg/i1643.scala b/tests/neg/i1643.scala
index 889233b3a0ca..1e3affa7f1c9 100644
--- a/tests/neg/i1643.scala
+++ b/tests/neg/i1643.scala
@@ -1,4 +1,4 @@
-trait T extends Array { // error
+trait T extends Array { // error // error
def t1(as: String*): Array[String] = { varargs1(as: _*) } // error
def t2(as: String*): Array[String] = { super.varargs1(as: _*) } // error
}
diff --git a/tests/neg/parser-stability-16.scala b/tests/neg/parser-stability-16.scala
index f6f6f19aa890..25fb38374c45 100644
--- a/tests/neg/parser-stability-16.scala
+++ b/tests/neg/parser-stability-16.scala
@@ -1,5 +1,5 @@
class x0[x0] {
val x1 : x0
}
-trait x3 extends x0 {
+trait x3 extends x0 { // error
x1 = 0 object // error // error
diff --git a/tests/neg/parser-stability-7.scala b/tests/neg/parser-stability-7.scala
index 98ed2cb009a1..27d391ed9396 100644
--- a/tests/neg/parser-stability-7.scala
+++ b/tests/neg/parser-stability-7.scala
@@ -1,7 +1,7 @@
class x0[x1] {
def x2: x1
}
-trait x3 extends x0 {
+trait x3 extends x0 { // error
class x2
var x2 = 0 // error
var x4 = x5 x2 // error
From 1fe1232c9e3d2647dbda634f8d39db5bf7c5e10f Mon Sep 17 00:00:00 2001
From: "Paolo G. Giarrusso"
Date: Sat, 25 Aug 2018 22:05:57 +0200
Subject: [PATCH 05/13] Reallow ill-kinded but JavaDefined parents (#5010)
To allow again t3613 to compile I need this exception. But the testcase is so
old I'm not sure if we should do this, even tho it's still supported by Scalac.
---
compiler/src/dotty/tools/dotc/typer/Typer.scala | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala
index 6e281c131ba6..f4a152352275 100644
--- a/compiler/src/dotty/tools/dotc/typer/Typer.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala
@@ -1524,7 +1524,8 @@ class Typer extends Namer
ctx.error(i"$psym is extended twice", tree.pos)
seenParents += psym
if (tree.isType) {
- checkSimpleKinded(result) // Not needed for constructor calls, as type arguments will be inferred.
+ if (!psym.is(JavaDefined))
+ checkSimpleKinded(result) // Not needed for constructor calls, as type arguments will be inferred.
if (psym.is(Trait) && !cls.is(Trait) && !cls.superClass.isSubClass(psym))
result = maybeCall(result, psym, psym.primaryConstructor.info)
}
From 40c329b7a054c1c28f8dd6aba3cf1794b52d4bbd Mon Sep 17 00:00:00 2001
From: "Paolo G. Giarrusso"
Date: Sun, 26 Aug 2018 03:21:56 +0200
Subject: [PATCH 06/13] Revert "Reallow ill-kinded but JavaDefined parents
(#5010)"
This reverts commit 1fe1232c9e3d2647dbda634f8d39db5bf7c5e10f as it was an
incorrect diagnosis.
The only existing testcase was written when AbstractListModel had no parameter,
so change the testcase instead.
We could alternatively infer type arguments (see scala/bug#11111), but that
seems typically unhelpful.
---
compiler/src/dotty/tools/dotc/typer/Typer.scala | 3 +--
tests/run/t3613.scala | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala
index f4a152352275..6e281c131ba6 100644
--- a/compiler/src/dotty/tools/dotc/typer/Typer.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala
@@ -1524,8 +1524,7 @@ class Typer extends Namer
ctx.error(i"$psym is extended twice", tree.pos)
seenParents += psym
if (tree.isType) {
- if (!psym.is(JavaDefined))
- checkSimpleKinded(result) // Not needed for constructor calls, as type arguments will be inferred.
+ checkSimpleKinded(result) // Not needed for constructor calls, as type arguments will be inferred.
if (psym.is(Trait) && !cls.is(Trait) && !cls.superClass.isSubClass(psym))
result = maybeCall(result, psym, psym.primaryConstructor.info)
}
diff --git a/tests/run/t3613.scala b/tests/run/t3613.scala
index 1293f62c0fd4..199ed2ee1933 100644
--- a/tests/run/t3613.scala
+++ b/tests/run/t3613.scala
@@ -2,7 +2,7 @@ class Boopy {
private val s = new Schnuck
def observer : PartialFunction[ Any, Unit ] = s.observer
- private class Schnuck extends javax.swing.AbstractListModel {
+ private class Schnuck extends javax.swing.AbstractListModel[Nothing] {
model =>
val observer : PartialFunction[ Any, Unit ] = {
case "Boopy" => fireIntervalAdded( model, 0, 1 )
From e1dd71edb3610c7002be5a11deace6c1934610e1 Mon Sep 17 00:00:00 2001
From: "Paolo G. Giarrusso"
Date: Sun, 26 Aug 2018 03:21:13 +0200
Subject: [PATCH 07/13] Fix #5007 (aka scala/bug#5063)
Based on scala/scala@bed3304bf86 and Nicolas' suggestion.
---
compiler/src/dotty/tools/dotc/typer/Implicits.scala | 1 +
tests/neg/t5063.scala | 3 +++
tests/untried/neg/t5063.check | 4 ----
tests/untried/neg/t5063.scala | 3 ---
4 files changed, 4 insertions(+), 7 deletions(-)
create mode 100644 tests/neg/t5063.scala
delete mode 100644 tests/untried/neg/t5063.check
delete mode 100644 tests/untried/neg/t5063.scala
diff --git a/compiler/src/dotty/tools/dotc/typer/Implicits.scala b/compiler/src/dotty/tools/dotc/typer/Implicits.scala
index feb6bc391a55..546cce74aaf7 100644
--- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala
@@ -552,6 +552,7 @@ trait Implicits { self: Typer =>
|| (from.tpe isRef defn.NothingClass)
|| (from.tpe isRef defn.NullClass)
|| !(ctx.mode is Mode.ImplicitsEnabled)
+ || from.isInstanceOf[Super]
|| (from.tpe eq NoPrefix)) NoMatchingImplicitsFailure
else {
def adjust(to: Type) = to.stripTypeVar.widenExpr match {
diff --git a/tests/neg/t5063.scala b/tests/neg/t5063.scala
new file mode 100644
index 000000000000..0566e90798f5
--- /dev/null
+++ b/tests/neg/t5063.scala
@@ -0,0 +1,3 @@
+class A {
+ super.+("") // error
+}
diff --git a/tests/untried/neg/t5063.check b/tests/untried/neg/t5063.check
deleted file mode 100644
index c6e553c1b5f6..000000000000
--- a/tests/untried/neg/t5063.check
+++ /dev/null
@@ -1,4 +0,0 @@
-t5063.scala:2: error: value + is not a member of AnyRef
- super.+("")
- ^
-one error found
diff --git a/tests/untried/neg/t5063.scala b/tests/untried/neg/t5063.scala
deleted file mode 100644
index 5b34b53fb7fc..000000000000
--- a/tests/untried/neg/t5063.scala
+++ /dev/null
@@ -1,3 +0,0 @@
-class A {
- super.+("")
-}
From 8f613a081d320b0d2d173aa2e5ba434d53e254a3 Mon Sep 17 00:00:00 2001
From: "Paolo G. Giarrusso"
Date: Sun, 26 Aug 2018 18:32:16 +0200
Subject: [PATCH 08/13] Improve robustness of Namer for #5004
But this isn't a full fix and might be a bad idea.
---
compiler/src/dotty/tools/dotc/typer/Namer.scala | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala
index f8d83964e82b..0d116a5ea47c 100644
--- a/compiler/src/dotty/tools/dotc/typer/Namer.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala
@@ -1158,8 +1158,9 @@ class Namer { typer: Typer =>
/** The type signature of a DefDef with given symbol */
def defDefSig(ddef: DefDef, sym: Symbol)(implicit ctx: Context) = {
- val DefDef(name, tparams, vparamss, _, _) = ddef
- val isConstructor = name == nme.CONSTRUCTOR
+ // Beware: ddef.name need not match sym.name if sym was freshened!
+ val DefDef(_, tparams, vparamss, _, _) = ddef
+ val isConstructor = sym.name == nme.CONSTRUCTOR
// The following 3 lines replace what was previously just completeParams(tparams).
// But that can cause bad bounds being computed, as witnessed by
From 6cc105cd9159c3a1578001abf56ec6bbaaa5f028 Mon Sep 17 00:00:00 2001
From: "Paolo G. Giarrusso"
Date: Sun, 26 Aug 2018 21:52:35 +0200
Subject: [PATCH 09/13] Fix #5006
---
.../dotty/tools/dotc/transform/TypeTestsCasts.scala | 10 +++++++++-
tests/neg/i5006.scala | 7 +++++++
2 files changed, 16 insertions(+), 1 deletion(-)
create mode 100644 tests/neg/i5006.scala
diff --git a/compiler/src/dotty/tools/dotc/transform/TypeTestsCasts.scala b/compiler/src/dotty/tools/dotc/transform/TypeTestsCasts.scala
index 1bffe1372586..5c8af165788d 100644
--- a/compiler/src/dotty/tools/dotc/transform/TypeTestsCasts.scala
+++ b/compiler/src/dotty/tools/dotc/transform/TypeTestsCasts.scala
@@ -140,7 +140,15 @@ object TypeTestsCasts {
}
def interceptTypeApply(tree: TypeApply)(implicit ctx: Context): Tree = trace(s"transforming ${tree.show}", show = true) {
- tree.fun match {
+ interceptTypeApply1(tree, tree.fun match {
+ case i: Ident =>
+ desugarIdent(i).withPos(tree.fun)
+ case t => t
+ })
+ }
+
+ private def interceptTypeApply1(tree: TypeApply, treeFun: Tree)(implicit ctx: Context): Tree = {
+ treeFun match {
case fun @ Select(expr, selector) =>
val sym = tree.symbol
diff --git a/tests/neg/i5006.scala b/tests/neg/i5006.scala
new file mode 100644
index 000000000000..94169286322e
--- /dev/null
+++ b/tests/neg/i5006.scala
@@ -0,0 +1,7 @@
+object i0 {
+ // Adding anything in front of asInstanceOf,
+ // i0 or this, makes the error go away.
+ def i1: Int = asInstanceOf[Int].toInt
+
+ val i2 = asInstanceOf[Int]
+}
From b0db5445e8f0c408f3af41ad4aa16753b85074f4 Mon Sep 17 00:00:00 2001
From: "Paolo G. Giarrusso"
Date: Sun, 26 Aug 2018 21:53:49 +0200
Subject: [PATCH 10/13] Delete dead code
---
compiler/src/dotty/tools/dotc/ast/TreeInfo.scala | 13 -------------
.../tools/dotc/core/quoted/PickledQuotes.scala | 6 ------
2 files changed, 19 deletions(-)
diff --git a/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala b/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala
index 2e1b674b895e..9cde7305300f 100644
--- a/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala
+++ b/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala
@@ -542,19 +542,6 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
case _ => false
}
- /** Strips layers of `.asInstanceOf[T]` / `_.$asInstanceOf[T]()` from an expression */
- def stripCast(tree: Tree)(implicit ctx: Context): Tree = {
- def isCast(sel: Tree) = sel.symbol == defn.Any_asInstanceOf
- unsplice(tree) match {
- case TypeApply(sel @ Select(inner, _), _) if isCast(sel) =>
- stripCast(inner)
- case Apply(TypeApply(sel @ Select(inner, _), _), Nil) if isCast(sel) =>
- stripCast(inner)
- case t =>
- t
- }
- }
-
/** Decompose a call fn[targs](vargs_1)...(vargs_n)
* into its constituents (fn, targs, vargss).
*
diff --git a/compiler/src/dotty/tools/dotc/core/quoted/PickledQuotes.scala b/compiler/src/dotty/tools/dotc/core/quoted/PickledQuotes.scala
index bedcd8c05724..eaa3684d03c8 100644
--- a/compiler/src/dotty/tools/dotc/core/quoted/PickledQuotes.scala
+++ b/compiler/src/dotty/tools/dotc/core/quoted/PickledQuotes.scala
@@ -22,12 +22,6 @@ import scala.reflect.ClassTag
object PickledQuotes {
import tpd._
- /** Pickle the tree of the quoted.Expr */
- def pickleExpr(tree: Tree)(implicit ctx: Context): scala.quoted.Expr[Any] = {
- val pickled = pickleQuote(tree)
- scala.runtime.quoted.Unpickler.unpickleExpr(pickled, Nil)
- }
-
/** Pickle the tree of the quote into strings */
def pickleQuote(tree: Tree)(implicit ctx: Context): scala.runtime.quoted.Unpickler.Pickled = {
if (ctx.reporter.hasErrors) Nil
From 591ccc02e304812ec9b70da1f76fbefce749f6bb Mon Sep 17 00:00:00 2001
From: "Paolo G. Giarrusso"
Date: Sun, 26 Aug 2018 21:54:20 +0200
Subject: [PATCH 11/13] Cleanup
---
compiler/src/dotty/tools/dotc/typer/Typer.scala | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala
index 6e281c131ba6..b0dc2532f816 100644
--- a/compiler/src/dotty/tools/dotc/typer/Typer.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala
@@ -1803,7 +1803,7 @@ class Typer extends Namer
case none =>
def typedNamed(tree: untpd.NameTree, pt: Type)(implicit ctx: Context): Tree = {
- val sym = retrieveSym(xtree)
+ val sym = retrieveSym(tree)
tree match {
case tree: untpd.Ident => typedIdent(tree, pt)
case tree: untpd.Select => typedSelect(tree, pt)
From 7ea018de44b28a975389c741b724aa4d44cba16b Mon Sep 17 00:00:00 2001
From: "Paolo G. Giarrusso"
Date: Mon, 27 Aug 2018 23:56:19 +0200
Subject: [PATCH 12/13] Clarify "not found" error
Give
```
trait Foo
scala> val v = Foo
1 |val v = Foo
| ^^^
| not found: Foo
```
which is misleading because `Foo` exists, just as a type and not as a
value (we should maybe say "term" but Scala 2 uses "value").
---
compiler/src/dotty/tools/dotc/typer/Typer.scala | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala
index b0dc2532f816..d5eb642d4336 100644
--- a/compiler/src/dotty/tools/dotc/typer/Typer.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala
@@ -355,7 +355,7 @@ class Typer extends Namer
}
// begin typedIdent
- def kind = if (name.isTermName) "" else "type "
+ def kind = if (name.isTermName) "value " else "type "
typr.println(s"typed ident $kind$name in ${ctx.owner}")
if (ctx.mode is Mode.Pattern) {
if (name == nme.WILDCARD)
From 998ece955f886ebec3d57e2f686dd3dc0ee070fe Mon Sep 17 00:00:00 2001
From: "Paolo G. Giarrusso"
Date: Tue, 28 Aug 2018 23:54:44 +0200
Subject: [PATCH 13/13] Remove redundant code
`-Ycheck:all` is already handled by `containsPhase`.
---
compiler/src/dotty/tools/dotc/core/Phases.scala | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/compiler/src/dotty/tools/dotc/core/Phases.scala b/compiler/src/dotty/tools/dotc/core/Phases.scala
index 0269c6f536ee..33c5808a0000 100644
--- a/compiler/src/dotty/tools/dotc/core/Phases.scala
+++ b/compiler/src/dotty/tools/dotc/core/Phases.scala
@@ -84,7 +84,6 @@ object Phases {
phasesToSkip: List[String], stopBeforePhases: List[String], stopAfterPhases: List[String], YCheckAfter: List[String]): List[Phase] = {
val squashedPhases = ListBuffer[Phase]()
var prevPhases: Set[String] = Set.empty
- val YCheckAll = YCheckAfter.contains("all")
var stop = false
val filteredPhases = phasess.map(_.filter { p =>
@@ -120,7 +119,7 @@ object Phases {
phase
}
squashedPhases += phaseToAdd
- val shouldAddYCheck = YCheckAfter.containsPhase(phaseToAdd) || YCheckAll
+ val shouldAddYCheck = YCheckAfter.containsPhase(phaseToAdd)
if (shouldAddYCheck) {
val checker = new TreeChecker
squashedPhases += checker