Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.3.0-beta-2
-
None
Description
The following test case fails:
import groovy.transform.ASTTest import static org.codehaus.groovy.transform.stc.StaticTypesMarker.* import static org.codehaus.groovy.ast.ClassHelper.* interface Converter<F, T> { T convertC(F from) } class Holder<T> { T thing Holder(T thing) { this.thing = thing } def <R> Holder<R> convertH(Converter<? super T, ? extends R> func1) { new Holder(func1.convertC(thing)) } } class IntToFloatConverter implements Converter<Integer,Float> { public Float convertC(Integer from) { from.floatValue() } } @groovy.transform.TypeChecked void foo() { @ASTTest(phase=INSTRUCTION_SELECTION,value={ def holderType = node.getNodeMetaData(INFERRED_TYPE) assert holderType.genericsTypes[0].type == Float_TYPE }) def h1 = new Holder<Integer>(2).convertH(new IntToFloatConverter()) } foo()
The important part is that when inference is done, it should map the placeholders from Converter<F,T> to the concrete implementations of IntToFloatConverter, that is to say Integer and Double.