You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Thodoris Sotiropoulos (Jira)" <ji...@apache.org> on 2021/11/12 09:33:00 UTC
[jira] [Created] (GROOVY-10363) STC produces compile-time error on
encoutering bounded type parameter with conditional
Thodoris Sotiropoulos created GROOVY-10363:
----------------------------------------------
Summary: STC produces compile-time error on encoutering bounded type parameter with conditional
Key: GROOVY-10363
URL: https://issues.apache.org/jira/browse/GROOVY-10363
Project: Groovy
Issue Type: Bug
Components: Static Type Checker
Reporter: Thodoris Sotiropoulos
I have the following program:
{code:groovy}
import java.util.function.Supplier;
class A {
static final <X extends Supplier<Number>> X m(X x, X y) {
X z = (true) ? x : y
z
}
}
{code}
h3. Actual behavior
{code}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
test.groovy: 10: [Static type checking] - Incompatible generic argument types. Cannot assign java.util.function.Supplier<java.lang.Object> to: X
@ line 10, column 5.
z
^
1 error
{code}
h3. Compile successfully
NOTE: The bug is triggered only when the type parameter is named other than `T`.
Tested against master
--
This message was sent by Atlassian Jira
(v8.20.1#820001)