summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2007-08-21 14:04:16 +0000
committerMartin Odersky <odersky@gmail.com>2007-08-21 14:04:16 +0000
commit93e7d7fe4d11f4cf474b31e9950ab4eb6457743d (patch)
tree051a0a985e35e22298ac315fce1d43cba94618d2 /src/compiler/scala/tools/nsc/typechecker
parentecbe1cdd177b903796a65e29c6a2104197c54654 (diff)
downloadscala-93e7d7fe4d11f4cf474b31e9950ab4eb6457743d.tar.gz
scala-93e7d7fe4d11f4cf474b31e9950ab4eb6457743d.tar.bz2
scala-93e7d7fe4d11f4cf474b31e9950ab4eb6457743d.zip
some fix for bug1279
applied Koltsov patch
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala6
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala2
2 files changed, 7 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala b/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala
index 02ccd6322e..1cdcf6210a 100644
--- a/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala
@@ -80,7 +80,11 @@ trait EtaExpansion { self: Analyzer =>
ValDef(Modifiers(SYNTHETIC | PARAM), freshName(), TypeTree()
.setType(formal), EmptyTree))
val args = params map (param => Ident(param.name))
- atPos(tree.pos)(Function(params, expand(Apply(tree, args), restpe)))
+ val applyArgs =
+ if (isVarArgs(formals)) args.init ::: Typed(args.last, Ident(nme.WILDCARD_STAR.toTypeName)) :: Nil
+ else args
+ atPos(tree.pos)(Function(params, expand(Apply(tree, applyArgs), restpe)))
+ //atPos(tree.pos)(Function(params, expand(Apply(tree, args), restpe)))
case _ =>
tree
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 6794c9d58b..c0052ccc10 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -291,10 +291,12 @@ trait Typers { self: Analyzer =>
def checkParamsConvertible(pos: Position, tpe: Type) {
tpe match {
case MethodType(formals, restpe) =>
+ /*
if (formals.exists(_.typeSymbol == ByNameParamClass) && formals.length != 1)
error(pos, "methods with `=>'-parameter can be converted to function values only if they take no other parameters")
if (formals exists (_.typeSymbol == RepeatedParamClass))
error(pos, "methods with `*'-parameters cannot be converted to function values");
+ */
if (restpe.isDependent)
error(pos, "method with dependent type "+tpe+" cannot be converted to function value");
checkParamsConvertible(pos, restpe)