diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Infer.scala | 2 | ||||
-rw-r--r-- | test/files/run/t8197.scala | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala index 2d6c94349b..50744f2d72 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala @@ -1328,7 +1328,7 @@ trait Infer extends Checkable { eligible else eligible filter (alt => - !alt.hasDefault && isApplicableBasedOnArity(alt.tpe, argtpes.length, varargsStar, tuplingAllowed = true) + !mexists(alt.info.paramss)(_.hasDefault) && isApplicableBasedOnArity(alt.tpe, argtpes.length, varargsStar, tuplingAllowed = true) ) } diff --git a/test/files/run/t8197.scala b/test/files/run/t8197.scala new file mode 100644 index 0000000000..5ca67088de --- /dev/null +++ b/test/files/run/t8197.scala @@ -0,0 +1,13 @@ +// NOTE: according to SI-4728, this shouldn't even compile... +class A +class B +// default arguments do not participate in overload resolution +class Foo(val x: A = null) { + def this(bla: B*) { + this(new A) + } +} + +object Test extends App { + assert((new Foo).x != null) +} |