You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/cross-build.md
+14-13Lines changed: 14 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,7 @@ implicit val locationWrites: Writes[Location] = (
54
54
55
55
### Unreducible application of higher-kinded type to wildcard arguments
56
56
57
-
This warning happens when you apply the “wildcard” type to a higher-kinded type.
57
+
This error happens when you apply the “wildcard” type to a higher-kinded type.
58
58
59
59
Consider the following example:
60
60
@@ -63,27 +63,28 @@ trait Example {
63
63
64
64
typeFoo[A]
65
65
66
-
deff(foo: Foo[_]):Unit//Warning with Scala 3
66
+
deff(foo: Foo[_]):Unit//Error with Scala 3
67
67
68
-
defg(foos: Seq[Foo[_]]):Unit//Warning with Scala 3
68
+
defg(foos: Seq[Foo[_]]):Unit//Error with Scala 3
69
69
70
70
}
71
71
~~~
72
72
73
-
It compiles with Scala 2, but Scala 3 produces the following warnings:
73
+
It compiles with Scala 2, but Scala 3 produces the following errors:
74
74
75
75
~~~
76
-
[warn] -- Migration Warning:
77
-
[warn] 132 | def f(foo: Foo[_]): Unit
78
-
[warn] | ^^^^^^
79
-
[warn] |unreducible application of higher-kinded type Example.this.Foo to wildcard arguments
80
-
[warn] -- Migration Warning:
81
-
[warn] 134 | def g(foos: Seq[Foo[_]]): Unit
82
-
[warn] | ^^^^^^
83
-
[warn] |unreducible application of higher-kinded type Example.this.Foo to wildcard arguments
84
-
[warn] two warnings found
76
+
[error] -- [E043] Type Error:
77
+
[error] 5 | def f(foo: Foo[_]): Unit // Warning with Scala 3
78
+
[error] | ^^^^^^
79
+
[error] |unreducible application of higher-kinded type Example.this.Foo to wildcard arguments
80
+
[error] -- [E043] Type Error:
81
+
[error] 6 | def g(foos: Seq[Foo[_]]): Unit // Warning with Scala 3
82
+
[error] | ^^^^^^
83
+
[error] |unreducible application of higher-kinded type Example.this.Foo to wildcard arguments
85
84
~~~
86
85
86
+
The reason for this error is that the type `Foo[_]` involves existential type quantification and this feature [has been removed from Scala 3](https://dotty.epfl.ch/docs/reference/dropped-features/existential-types.html).
87
+
87
88
Two solutions can be considered for cross-compiling.
88
89
89
90
In the case of the function `f`, we can change its signature to take a type parameter:
0 commit comments