Search in sources :

Example 11 with BoundOrConstraint

use of net.sourceforge.pmd.lang.java.typeresolution.typeinference.BoundOrConstraint in project pmd by pmd.

the class TypeInferenceTest method testSubtypeReduceVariableVsAny.

@Test
public void testSubtypeReduceVariableVsAny() {
    // Otherwise, if S is an inference variable, α, the constraint reduces to the bound α <: T.
    List<BoundOrConstraint> result = new Constraint(alpha, integer, SUBTYPE).reduce();
    assertEquals(1, result.size());
    testBoundOrConstraint(result.get(0), alpha, integer, SUBTYPE, Bound.class);
}
Also used : BoundOrConstraint(net.sourceforge.pmd.lang.java.typeresolution.typeinference.BoundOrConstraint) BoundOrConstraint(net.sourceforge.pmd.lang.java.typeresolution.typeinference.BoundOrConstraint) Constraint(net.sourceforge.pmd.lang.java.typeresolution.typeinference.Constraint) Test(org.junit.Test)

Example 12 with BoundOrConstraint

use of net.sourceforge.pmd.lang.java.typeresolution.typeinference.BoundOrConstraint in project pmd by pmd.

the class TypeInferenceTest method testEqualityReduceVariableVsNotPrimitive.

@Test
public void testEqualityReduceVariableVsNotPrimitive() {
    // Otherwise, if S is an inference variable, α, and T is not a primitive type, the constraint reduces to
    // the bound α = T.
    List<BoundOrConstraint> result = new Constraint(alpha, number, EQUALITY).reduce();
    assertEquals(1, result.size());
    testBoundOrConstraint(result.get(0), alpha, number, EQUALITY, Bound.class);
}
Also used : BoundOrConstraint(net.sourceforge.pmd.lang.java.typeresolution.typeinference.BoundOrConstraint) BoundOrConstraint(net.sourceforge.pmd.lang.java.typeresolution.typeinference.BoundOrConstraint) Constraint(net.sourceforge.pmd.lang.java.typeresolution.typeinference.Constraint) Test(org.junit.Test)

Aggregations

BoundOrConstraint (net.sourceforge.pmd.lang.java.typeresolution.typeinference.BoundOrConstraint)12 Constraint (net.sourceforge.pmd.lang.java.typeresolution.typeinference.Constraint)12 Test (org.junit.Test)12