diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Definitions.scala | 4 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 7 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala index 8bffa1e8f5..fe7c4d5cf5 100644 --- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala +++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala @@ -124,7 +124,9 @@ trait Definitions requires SymbolTable { false } def productType(elems: List[Type]) = - if (elems.length <= MaxProductArity) { + if (elems.isEmpty) + UnitClass.tpe + else if (elems.length <= MaxProductArity) { val sym = ProductClass(elems.length) typeRef(sym.typeConstructor.prefix, sym, elems) } else NoType diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 7a2b6b9b03..3bc35b2067 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -580,7 +580,9 @@ trait Typers requires Analyzer { obj } if (definitions.unapplyMember(consp.tpe).exists) - atPos(tree.pos) {Ident(consp).setType(consp.tpe)} + atPos(tree.pos) { + gen.mkAttributedRef(consp.tpe.prefix,consp) + } // needs member type, but member of what? ^^^ // see test/pending/pos/unapplyNeedsMemberType.scala else errorTree(tree, "" + clazz + " is not a case class, nor does it have unapply/unapplySeq method") @@ -1425,7 +1427,8 @@ trait Typers requires Analyzer { val funPt = appliedType(OptionClass.typeConstructor, List(prod)) val fun0 = Ident(fun.symbol) setPos fun.pos setType otpe // would this change when patterns are terms??? - val fun1 = typed(atPos(fun.pos) { Apply(Select(Ident(fun.symbol), unapp), List(arg)) }, EXPRmode, funPt) + val fun1 = typed(atPos(fun.pos) { Apply(Select( + gen.mkAttributedRef(fun.tpe.prefix,fun.symbol), unapp), List(arg)) }, EXPRmode, funPt) if (fun1.tpe.isErroneous) setError(tree) else { val formals0 = if(unapp.name == nme.unapply) optionOfProductElems(fun1.tpe) |