aboutsummaryrefslogtreecommitdiff
path: root/src/dotty
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-01-03 12:56:11 +0100
committerMartin Odersky <odersky@gmail.com>2014-01-03 12:56:11 +0100
commit2d500b7746a38647c7a97db99207ca4972cd49eb (patch)
tree42cb547bbb037b04636dff12904330ab58f01daa /src/dotty
parent9955a2fd64af1ff7b9992fa12662a85e07d82fc7 (diff)
downloaddotty-2d500b7746a38647c7a97db99207ca4972cd49eb.tar.gz
dotty-2d500b7746a38647c7a97db99207ca4972cd49eb.tar.bz2
dotty-2d500b7746a38647c7a97db99207ca4972cd49eb.zip
safeUnderlyingTypeParams now forces uncompleted symbols.
When removing logging, it turned out that Coder no longer compiled. The problem was tracked to safeUnderlyingTypeParams which did not force enough.
Diffstat (limited to 'src/dotty')
-rw-r--r--src/dotty/tools/dotc/core/TypeApplications.scala12
-rw-r--r--src/dotty/tools/dotc/reporting/Reporter.scala4
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala8
3 files changed, 11 insertions, 13 deletions
diff --git a/src/dotty/tools/dotc/core/TypeApplications.scala b/src/dotty/tools/dotc/core/TypeApplications.scala
index 4080d74dc..9e5c3d5a5 100644
--- a/src/dotty/tools/dotc/core/TypeApplications.scala
+++ b/src/dotty/tools/dotc/core/TypeApplications.scala
@@ -51,23 +51,21 @@ class TypeApplications(val self: Type) extends AnyVal {
}
}
/** The type parameters of the underlying class.
- * This is like `typeParams`, except for 4 differences.
+ * This is like `typeParams`, except for 3 differences.
* First, it does not adjust type parameters in refined types. I.e. type arguments
* do not remove corresponding type parameters.
- * Second, it will return Nil instead of forcing a symbol, in order to rule
- * out CyclicReference exceptions.
- * Third, it will return Nil for BoundTypes because we might get a NullPointer exception
+ * Second, it will return Nil for BoundTypes because we might get a NullPointer exception
* on PolyParam#underlying otherwise (demonstrated by showClass test).
- * Fourth, it won't return higher-kinded type parameters.
+ * Third, it won't return higher-kinded type parameters.
*/
final def safeUnderlyingTypeParams(implicit ctx: Context): List[TypeSymbol] = {
def ifCompleted(sym: Symbol): Symbol = if (sym.isCompleted) sym else NoSymbol
self match {
case tp: ClassInfo =>
- if (tp.cls.isCompleted) tp.cls.typeParams else Nil
+ tp.cls.typeParams
case tp: TypeRef =>
val tsym = tp.typeSymbol
- if (tsym.isClass && tsym.isCompleted) tsym.typeParams
+ if (tsym.isClass) tsym.typeParams
else if (tsym.isAliasType) tp.underlying.safeUnderlyingTypeParams
else Nil
case tp: BoundType =>
diff --git a/src/dotty/tools/dotc/reporting/Reporter.scala b/src/dotty/tools/dotc/reporting/Reporter.scala
index 6e7a79306..961c19c9e 100644
--- a/src/dotty/tools/dotc/reporting/Reporter.scala
+++ b/src/dotty/tools/dotc/reporting/Reporter.scala
@@ -128,8 +128,8 @@ trait Reporting { this: Context =>
def debugwarn(msg: => String, pos: SourcePosition = NoSourcePosition): Unit =
if (this.settings.debug.value) warning(msg, pos)
- def debugTraceIndented[T](question: => String)(op: => T): T =
- conditionalTraceIndented(this.settings.debugTrace.value, question)(op)
+ def debugTraceIndented[T](question: => String, show: Boolean = false)(op: => T): T =
+ conditionalTraceIndented(this.settings.debugTrace.value, question, show)(op)
def conditionalTraceIndented[T](cond: Boolean, question: => String, show: Boolean = false)(op: => T): T =
if (cond) traceIndented(question, show)(op)
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index c6c39f3e2..3cdd26b1a 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -324,7 +324,7 @@ class Typer extends Namer with Applications with Implicits {
// begin typedIdent
def kind = if (name.isTermName) "" else "type "
- println(s"typed ident $kind$name in ${ctx.owner}") // !!! DEBUG
+ // println(s"typed ident $kind$name in ${ctx.owner}") // !!! DEBUG
if (ctx.mode is Mode.Pattern) {
if (name == nme.WILDCARD)
return tree.withType(pt)
@@ -743,7 +743,7 @@ class Typer extends Namer with Applications with Implicits {
val TypeDef(_, _, Template(_, _, _, refinements1)) = typed(refineClsDef)
assert(tree.refinements.length == refinements1.length, s"${tree.refinements} != $refinements1")
def addRefinement(parent: Type, refinement: Tree): Type = {
- println(s"adding refinement $refinement")
+ // println(s"adding refinement $refinement") !!!DEBUG
foreachSubTreeOf(refinement) {
case tree: RefTree =>
if (tree.symbol.owner == refineCls && tree.pos.start <= tree.symbol.pos.end)
@@ -1090,7 +1090,7 @@ class Typer extends Namer with Applications with Implicits {
def adaptOverloaded(ref: TermRef) = {
val altDenots = ref.denot.alternatives
- println(i"adapt overloaded $ref with alternatives ${altDenots map (_.info)}%, %")
+ // println(i"adapt overloaded $ref with alternatives ${altDenots map (_.info)}%, %") !!! DEBUG
val alts = altDenots map (alt =>
TermRef.withSig(ref.prefix, ref.name, alt.info.signature, alt))
def expectedStr = err.expectedTypeStr(pt)
@@ -1168,7 +1168,7 @@ class Typer extends Namer with Applications with Implicits {
if (tree.tpe <:< pt) tree
else if (ctx.mode is Mode.Pattern) tree // no subtype check for pattern
else {
- println(s"adapt to subtype ${tree.tpe} !<:< $pt") // !!!DEBUG
+ // println(s"adapt to subtype ${tree.tpe} !<:< $pt") // !!!DEBUG
// println(TypeComparer.explained(implicit ctx => tree.tpe <:< pt)) // !!!DEBUG
adaptToSubType(wtp)
}