Skip to content

Commit 6535981

Browse files
authored
Turn warning into error and mention Dotty documentation
It seems that this has become an error in Dotty 0.23 (I was previously testing with 0.22).
1 parent d8033bc commit 6535981

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

docs/cross-build.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ implicit val locationWrites: Writes[Location] = (
5454

5555
### Unreducible application of higher-kinded type to wildcard arguments
5656

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.
5858

5959
Consider the following example:
6060

@@ -63,27 +63,28 @@ trait Example {
6363

6464
type Foo[A]
6565

66-
def f(foo: Foo[_]): Unit // Warning with Scala 3
66+
def f(foo: Foo[_]): Unit // Error with Scala 3
6767

68-
def g(foos: Seq[Foo[_]]): Unit // Warning with Scala 3
68+
def g(foos: Seq[Foo[_]]): Unit // Error with Scala 3
6969

7070
}
7171
~~~
7272

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:
7474

7575
~~~
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
8584
~~~
8685

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+
8788
Two solutions can be considered for cross-compiling.
8889

8990
In the case of the function `f`, we can change its signature to take a type parameter:

0 commit comments

Comments
 (0)