From 01db9a68e5e68f08c8236c23c905009789d51587 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sat, 14 Dec 2013 17:32:16 +0100 Subject: Fixed several deep problems in handling of types and symbols. 1. We forgot to mark declaration symbols Deferred. 2. Types with NoPrefix and the same name got identified. Fixed by adding a new category WithNoPrefix to named types, and changing the way named types get generated. 3. Self types lacked parameters. (Question: Do we need to also track type members?) 4. Printers caused cyclic reference errors. Now some print operations are more careful with forcing. 5. Namedparts accumulator has to be more careful with ThisTypes. Because self types now contain parameters, which might lead back to this, we only add the class name (or the source module, if it's a module class). 6. toBounds in TypeApplications needs to use Co/Contra aliases for expanded name parameters, not just local ones. --- src/dotty/tools/dotc/typer/Applications.scala | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/dotty/tools/dotc/typer/Applications.scala') diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala index 64f44ee5e..dba95c689 100644 --- a/src/dotty/tools/dotc/typer/Applications.scala +++ b/src/dotty/tools/dotc/typer/Applications.scala @@ -621,10 +621,13 @@ trait Applications extends Compatibility { self: Typer => } println(i"case 2 $unapplyArgType ${ctx.typerState.constraint}") unapplyArgType - } else errorType( - i"Pattern type $unapplyArgType is neither a subtype nor a supertype of selector type $wpt", - tree.pos) - + } else { + // println("Neither sub nor super") + // println(TypeComparer.explained(implicit ctx => unapplyArgType <:< wpt)) + errorType( + i"Pattern type $unapplyArgType is neither a subtype nor a supertype of selector type $wpt", + tree.pos) + } var argTypes = unapplyArgs(mt.resultType) val bunchedArgs = argTypes match { case argType :: Nil if argType.isRepeatedParam => untpd.SeqLiteral(args) :: Nil @@ -666,7 +669,7 @@ trait Applications extends Compatibility { self: Typer => isApplicable(methRef, args, resultType) case _ => val app = tp.member(nme.apply) - app.exists && app.hasAltWith(d => isApplicable(TermRef(tp, nme.apply).withDenot(d), args, resultType)) + app.exists && app.hasAltWith(d => isApplicable(TermRef(tp, nme.apply, d), args, resultType)) } /** In a set of overloaded applicable alternatives, is `alt1` at least as good as -- cgit v1.2.3