-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Milestone
Description
Compiler version
3.0.2-RC2
Minimized code
public class Constants {
public static final int A = 0;
public static final int B = 2;
public static final int C = 3;
}
class broken {
sealed trait Foo
case object A extends Foo
case object B extends Foo
case object C extends Foo
case object D extends Foo
inline def foo(inline f: Foo) = inline f match {
case _: A.type => "the letter a"
case _: B.type => "the letter b"
case _: C.type => "the letter c"
case _: D.type => "the letter d"
}
inline def thingy(
depthClampEnable: Boolean = false,
rasterizerDiscardEnable: Boolean = false,
polygonMode: Int = 0,
cullMode: Int = 0,
frontFace: Int = 0,
depthBiasEnable: Boolean = false,
depthBiasConstantFactor: Float = 0,
depthBiasClamp: Float = 0,
depthBiasSlopeFactor: Float = 0,
lineWidth: Float = 0,
inline f: Foo = A,
) = {
foo(f)
}
thingy(polygonMode = Constants.A, cullMode = Constants.B, frontFace = Constants.C, lineWidth = 1.0f)
}
Output
cannot reduce inline match with
scrutinee: f$1 : (f$1 : broken.this.Foo @uncheckedVariance)
patterns : case this.A:this.A.type
case this.B:this.B.type
case this.C:this.C.type
case this.D:this.D.type
Expectation
It should compile fine, as it did in prior versions
Note
To replicate this bug, several conditions have to be met (I couldn't reproduce it otherwise):
- the outer method has to have default parameters unspecified when called (if you specify them all then it works)
- at least one of the specified parameters must come from a java defined symbol. If you define the constants in scala or inline the values, then it works.