use of org.eclipse.xtext.xbase.typesystem.references.WildcardTypeReference in project xtext-xtend by eclipse.
the class AbstractAssignabilityTest method testIsAssignable.
public boolean testIsAssignable(final LightweightTypeReference lhs, final LightweightTypeReference rhs) {
Assert.assertTrue(this.doIsAssignable(lhs, lhs));
Assert.assertTrue(this.doIsAssignable(lhs, this.toLightweightTypeReference(lhs.toTypeReference())));
Assert.assertTrue(this.doIsAssignable(rhs, this.toLightweightTypeReference(rhs.toTypeReference())));
final boolean result = this.doIsAssignable(lhs, rhs);
boolean _isPrimitiveVoid = rhs.isPrimitiveVoid();
boolean _not = (!_isPrimitiveVoid);
if (_not) {
final WildcardTypeReference wcRhs = this.getOwner().newWildcardTypeReference();
wcRhs.addUpperBound(rhs.getWrapperTypeIfPrimitive());
Assert.assertEquals(Boolean.valueOf(result), Boolean.valueOf(this.doIsAssignable(lhs, wcRhs)));
final CompoundTypeReference compoundRhs = this.getOwner().newCompoundTypeReference(true);
compoundRhs.addComponent(rhs);
final JvmType object = rhs.getOwner().getServices().getTypeReferences().findDeclaredType(Object.class, rhs.getOwner().getContextResourceSet());
compoundRhs.addComponent(rhs.getOwner().newParameterizedTypeReference(object));
String _plus = (lhs + " := ");
String _string = compoundRhs.toString();
String _plus_1 = (_plus + _string);
Assert.assertEquals(_plus_1, Boolean.valueOf(result), Boolean.valueOf(this.doIsAssignable(lhs, compoundRhs)));
}
return result;
}
use of org.eclipse.xtext.xbase.typesystem.references.WildcardTypeReference in project xtext-xtend by eclipse.
the class AbstractAssignabilityTest method testIsAssignable.
public boolean testIsAssignable(final LightweightTypeReference lhs, final LightweightTypeReference rhs) {
Assert.assertTrue(this.doIsAssignable(lhs, lhs));
Assert.assertTrue(this.doIsAssignable(lhs, this.toLightweightTypeReference(lhs.toTypeReference())));
Assert.assertTrue(this.doIsAssignable(rhs, this.toLightweightTypeReference(rhs.toTypeReference())));
final boolean result = this.doIsAssignable(lhs, rhs);
boolean _isPrimitiveVoid = rhs.isPrimitiveVoid();
boolean _not = (!_isPrimitiveVoid);
if (_not) {
final WildcardTypeReference wcRhs = this.getOwner().newWildcardTypeReference();
wcRhs.addUpperBound(rhs.getWrapperTypeIfPrimitive());
Assert.assertEquals(Boolean.valueOf(result), Boolean.valueOf(this.doIsAssignable(lhs, wcRhs)));
final CompoundTypeReference compoundRhs = this.getOwner().newCompoundTypeReference(true);
compoundRhs.addComponent(rhs);
final JvmType object = rhs.getOwner().getServices().getTypeReferences().findDeclaredType(Object.class, rhs.getOwner().getContextResourceSet());
compoundRhs.addComponent(rhs.getOwner().newParameterizedTypeReference(object));
String _plus = (lhs + " := ");
String _string = compoundRhs.toString();
String _plus_1 = (_plus + _string);
Assert.assertEquals(_plus_1, Boolean.valueOf(result), Boolean.valueOf(this.doIsAssignable(lhs, compoundRhs)));
}
return result;
}
Aggregations