scala3
scala3 copied to clipboard
Invalid warning about unused parameter to type lambda in local function
Compiler version
3.3.1
Minimized example
trait L[T]:
type E
def foo() =
type Warn1 = [T] => (l: L[T]) => T => l.E
type Warn2 = [T] => L[T] => T
type Warn3 = [T] => T => T
def use(x: (Warn1, Warn2, Warn3)) = x
use
type NoWarning1 = [T] => (l: L[T]) => T => l.E
type NoWarning2 = [T] => L[T] => T
type NoWarning3 = [T] => T => T
Output Error/Warning message
[warn] type Ast = [T] => (l: Lang[T]) => l.Expr
[warn] ^
[warn] /Users/jr/Documents/Development/modular-lang-proto/external/temp/modlang/src/main/scala/me/modlang/tfi/symbols.scala:68:17: unused local definition
[warn] type Warn1 = [T] => (l: L[T]) => T => l.E
[warn] ^
[warn] /Users/jr/Documents/Development/modular-lang-proto/external/temp/modlang/src/main/scala/me/modlang/tfi/symbols.scala:69:17: unused local definition
[warn] type Warn2 = [T] => L[T] => T
[warn] ^
[warn] /Users/jr/Documents/Development/modular-lang-proto/external/temp/modlang/src/main/scala/me/modlang/tfi/symbols.scala:70:17: unused local definition
[warn] type Warn3 = [T] => T => T
[warn] ^
Why this Error/Warning was not helpful
This warning is not helpful because it is wrong. The type parameter is used in every of the example types. It also seems to not happen when the definition is at the top level.
This does not warn in the 3.4.X branch.