summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorBurak Emir <emir@epfl.ch>2007-01-05 15:12:49 +0000
committerBurak Emir <emir@epfl.ch>2007-01-05 15:12:49 +0000
commit735573067a9f827534aa6cf28d0f4e845466540a (patch)
treecdb7546469eb6633a3de4132df8ca9fc2a136d82 /src/compiler
parent3f748a40b1a499bf50e9d6194bd7210769267ec0 (diff)
downloadscala-735573067a9f827534aa6cf28d0f4e845466540a.tar.gz
scala-735573067a9f827534aa6cf28d0f4e845466540a.tar.bz2
scala-735573067a9f827534aa6cf28d0f4e845466540a.zip
cleanup Iterable
better types for Product:elements implementation in case classes
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
index b9f31edec7..809ab4a5c2 100644
--- a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
@@ -78,7 +78,8 @@ trait SyntheticMethods requires Analyzer {
}
def productElementMethod(accs: List[Symbol]): Tree = {
- val method = syntheticMethod(nme.element, FINAL, MethodType(List(IntClass.tpe), AnyClass.tpe))
+ val retTpe = lub(accs map (.tpe.resultType))
+ val method = syntheticMethod(nme.element, FINAL, MethodType(List(IntClass.tpe), retTpe))
typed(DefDef(method, vparamss => Match(Ident(vparamss.head.head), {
(for(val Pair(sym,i) <- accs.zipWithIndex) yield {
CaseDef(Literal(Constant(i)),EmptyTree, Ident(sym))