diff options
author | Burak Emir <emir@epfl.ch> | 2007-09-04 20:33:11 +0000 |
---|---|---|
committer | Burak Emir <emir@epfl.ch> | 2007-09-04 20:33:11 +0000 |
commit | 24943dad3c75753fec40ca1fa16583b567c520f3 (patch) | |
tree | 6bfe42241a818fed016f1f61e3ecc70519a95248 /src | |
parent | 4d9354ae14d581fb548d1e926fbf3adb7d3bf615 (diff) | |
download | scala-24943dad3c75753fec40ca1fa16583b567c520f3.tar.gz scala-24943dad3c75753fec40ca1fa16583b567c520f3.tar.bz2 scala-24943dad3c75753fec40ca1fa16583b567c520f3.zip |
fixed odd typing bug #44
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 3072810afe..27fc934ef6 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1665,19 +1665,24 @@ trait Typers { self: Analyzer => //todo: replace arg with arg.asInstanceOf[inferTypedPattern(unappFormal, arg.tpe)] instead. argDummy.setInfo(arg.tpe) // bq: this line fixed #1281. w.r.t. comment ^^^, maybe good enough? } - val funPrefix = fun.tpe.prefix match { + val funPrefix = if (fun.symbol.owner.isMethod) NoPrefix else fun.tpe.prefix match { case tt @ ThisType(sym) => - //Console.println(" sym="+sym+" "+" .isPackageClass="+sym.isPackageClass+" .isModuleClass="+sym.isModuleClass); - //Console.println(" funsymown="+fun.symbol.owner+" .isClass+"+fun.symbol.owner.isClass); - //Console.println(" contains?"+sym.tpe.decls.lookup(fun.symbol.name)); - if(sym != fun.symbol.owner && (sym.isPackageClass||sym.isModuleClass) /*(1)*/ ) { // (1) see 'files/pos/unapplyVal.scala' - if(fun.symbol.owner.isClass) { - mkThisType(fun.symbol.owner) - } else { - NoPrefix // see 'files/run/unapplyComplex.scala' - } - } else tt - case st @ SingleType(pre, sym) => st + //Console.println("tt = "+tt+" sym.isModuleClass = "+sym.isModuleClass+" sym.isPackageClass = "+sym.isPackageClass+" isStaticModul="+sym.isStaticModule+" fso = "+fun.symbol.owner+" fso.isClass"+fun.symbol.owner.isClass) + if((sym eq fun.symbol.owner)|| !sym.isPackageClass) { + //Console.println("1 ThisType("+sym+")") + tt + } else { + //Console.println("2 ThisType("+fun.symbol.owner+")") + mkThisType(fun.symbol.owner) // see 'files/pos/unapplyVal.scala' + } + //if (sym.isPackageClass && fun.symbol.owner.isClass) { // (1) + //mkThisType(fun.symbol.owner) + //} else { + // Console.println("NoPrefix") + // NoPrefix // see 'files/run/unapplyComplex.scala' + // } + case st @ SingleType(pre, sym) => + st case xx => xx // cannot happen? } val fun1untyped = atPos(fun.pos) { |