-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Union type found when inferring Array.empty
#1907
New issue
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
Comments
By just doing: object Test {
val x: Option[Array[Int]] = ???
x.getOrElse(Array.empty)
} You can see that something goes terribly wrong in typer: package <empty> {
final lazy module val Test: Test$ = new Test$()
final module class Test$() extends Object() { this: Test.type =>
val x: Option[Array[Int]] = ???
Test.x.getOrElse[
(Array[Int] |
Array[Array[Array[Array[Array[Array[Array[Nothing]^]^]^]^]^]^]
)^
](
Array.empty[Array[Array[Array[Array[Array[Array[Nothing]^]^]^]^]^]^](
arrayTag[Array[Array[Array[Array[Array[Nothing]^]^]^]^]^](
arrayTag[Array[Array[Array[Array[Nothing]^]^]^]^](
arrayTag[Array[Array[Array[Nothing]^]^]^](
arrayTag[Array[Array[Nothing]^]^](
arrayTag[Array[Nothing]^](
arrayTag[Nothing^](
scala.reflect.ClassTag.apply[Nothing^](
classOf[class Nothing]
)
)
)
)
)
)
)
)
)
}
} |
After analyzing this a bit, I found that there are several things that go wrong, and they all have to do with implicit search. We need to do an implicit search for the What happens next is that implicit search will first consider
Summarizing, we get several things which are problematic
|
Uh oh!
There was an error while loading. Please reload this page.
Error message:
The text was updated successfully, but these errors were encountered: