Search in sources :

Example 1 with Bound

use of com.github.javaparser.symbolsolver.resolution.typeinference.Bound in project javaparser by javaparser.

the class SameAsBoundTest method recognizeInstantiation.

@Test
public void recognizeInstantiation() {
    // { α = String } contains a single bound, instantiating α as String.
    InferenceVariable inferenceVariable = new InferenceVariable("α", null);
    Bound bound1 = new SameAsBound(inferenceVariable, stringType);
    Bound bound2 = new SameAsBound(stringType, inferenceVariable);
    assertEquals(Optional.of(new Instantiation(inferenceVariable, stringType)), bound1.isAnInstantiation());
    assertEquals(Optional.of(new Instantiation(inferenceVariable, stringType)), bound2.isAnInstantiation());
}
Also used : InferenceVariable(com.github.javaparser.symbolsolver.resolution.typeinference.InferenceVariable) Bound(com.github.javaparser.symbolsolver.resolution.typeinference.Bound) Instantiation(com.github.javaparser.symbolsolver.resolution.typeinference.Instantiation) Test(org.junit.Test)

Aggregations

Bound (com.github.javaparser.symbolsolver.resolution.typeinference.Bound)1 InferenceVariable (com.github.javaparser.symbolsolver.resolution.typeinference.InferenceVariable)1 Instantiation (com.github.javaparser.symbolsolver.resolution.typeinference.Instantiation)1 Test (org.junit.Test)1