- Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
area:default-parametersarea:reportingError reporting including formatting, implicit suggestions, etcError reporting including formatting, implicit suggestions, etcitype:enhancement
Description
Compiler version
Scala compiler version 3.3.0-RC1-bin-SNAPSHOT-git-a1729b0 -- Copyright 2002-2022, LAMP/EPFL
Minimized code
➜ dotty git:(test/current) ./bin/scalac -d /tmp ./tests/untried/neg/t4727.scala -- [E007] Type Mismatch Error: ./tests/untried/neg/t4727.scala:5:8 ----------------------------------------------------- 5 | new C[Int] | ^^^^^^ | Found: Null | Required: Int | Note that implicit conversions were not tried because the result of an implicit conversion | must be more specific than Int | | longer explanation available when compiling with `-explain` 1 error found
That is
➜ dotty git:(test/current) cat ./tests/untried/neg/t4727.scala class C[T](x : T = null) object Test { def main(args: Array[String]): Unit = { new C[Int] } }
Output
Scala 2 tweaks the message with a hint that default args are involved.
t4727.scala:5: error: an expression of type Null is ineligible for implicit conversion Error occurred in an application involving default arguments. new C[Int] ^ 1 error
Expectation
It's a small thing, but maybe when default args are re-engineered or tweaked, a hint could be added along these lines.
Metadata
Metadata
Assignees
Labels
area:default-parametersarea:reportingError reporting including formatting, implicit suggestions, etcError reporting including formatting, implicit suggestions, etcitype:enhancement