We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3.3.1
package example object Main extends App with Test { load("")() } trait Test { def load[T]( doLoad: T )( description: T => Option[String] = (_: T) => None // <--- compile error here ): Unit = ??? }
(sbt project available here: https://github.com/yurique/scala3-weird)
[error] 12 | description: T => Option[String] = (_: T) => None [error] | ^^^^^^^^^^^^^^ [error] | Found: T => Option[String] [error] | Required: <? >: ("" : String)> => Option[String] [error] | [error] | longer explanation available when compiling with `-explain` [error] one error found
The code should compile.
load
object
trait
Test
Main
edit: smaller example - no custom case classes needed
The text was updated successfully, but these errors were encountered:
def test: Unit = load("")() def load[T](doLoad: T)(description: T => Int = (x: T) => 3): Unit = ???
Sorry, something went wrong.
It works if we swap the order of the definitions. Some constraint might be leaking from load("")() into def load[T]....
load("")()
def load[T]...
Tweak approximation of type variables when computing default types
2aa87f2
Tweak approximation of type variables when computing the expected types of default arguments. Fixes scala#18795
Tweak approximation of type variables when computing default types (#…
7f803ec
…18798) Tweak approximation of type variables when computing the expected types of default arguments. Fixes #18795
odersky
Successfully merging a pull request may close this issue.
Compiler version
Minimized code
(sbt project available here: https://github.com/yurique/scala3-weird)
Output
Expectation
The code should compile.
Notes
load
function is defined in anobject
(no in atrait
)Test
trait below the definition of theMain
objectedit: smaller example - no custom case classes needed
The text was updated successfully, but these errors were encountered: