use of org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference in project xtext-xtend by eclipse.
the class ReorderedVarArgFeatureCallArgumentsTest method testBug457779_02.
@Test
public void testBug457779_02() {
final IFeatureCallArguments arguments = this.toArgumentsWithReceiver("String s, boolean b, int[] i", "[], 1");
final XExpression first = arguments.getArgument(0);
Assert.assertNull(first);
final LightweightTypeReference firstType = arguments.getDeclaredTypeForLambda(0);
Assert.assertNull(firstType);
final XExpression second = arguments.getArgument(1);
Assert.assertTrue((second instanceof XNumberLiteral));
final LightweightTypeReference secondType = arguments.getDeclaredTypeForLambda(1);
Assert.assertEquals("boolean", secondType.getSimpleName());
final XExpression third = arguments.getArgument(2);
Assert.assertTrue((third instanceof XClosure));
XExpression _expression = ((XClosure) third).getExpression();
Assert.assertTrue(((XBlockExpression) _expression).getExpressions().isEmpty());
final LightweightTypeReference thirdType = arguments.getDeclaredTypeForLambda(2);
Assert.assertEquals("String", thirdType.getSimpleName());
try {
arguments.getArgument(3);
Assert.fail("Expected exception");
} catch (final Throwable _t) {
if (_t instanceof IndexOutOfBoundsException) {
} else {
throw Exceptions.sneakyThrow(_t);
}
}
try {
arguments.getDeclaredTypeForLambda(3);
Assert.fail("Expected exception");
} catch (final Throwable _t_1) {
if (_t_1 instanceof IndexOutOfBoundsException) {
} else {
throw Exceptions.sneakyThrow(_t_1);
}
}
}
use of org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference in project xtext-xtend by eclipse.
the class StandardFeatureCallArgumentsTest method testBug457779_03.
@Test
public void testBug457779_03() {
final IFeatureCallArguments arguments = this.toArgumentsWithoutReceiver("String s, int i", "\"\", 1, true");
final XExpression first = arguments.getArgument(0);
Assert.assertTrue((first instanceof XStringLiteral));
final LightweightTypeReference firstType = arguments.getDeclaredTypeForLambda(0);
Assert.assertEquals("String", firstType.getSimpleName());
final XExpression second = arguments.getArgument(1);
Assert.assertTrue((second instanceof XNumberLiteral));
final LightweightTypeReference secondType = arguments.getDeclaredTypeForLambda(1);
Assert.assertEquals("int", secondType.getSimpleName());
final XExpression third = arguments.getArgument(2);
Assert.assertTrue((third instanceof XBooleanLiteral));
final LightweightTypeReference thirdType = arguments.getDeclaredTypeForLambda(2);
Assert.assertNull("int", thirdType);
try {
arguments.getArgument(3);
Assert.fail("Expected exception");
} catch (final Throwable _t) {
if (_t instanceof IndexOutOfBoundsException) {
} else {
throw Exceptions.sneakyThrow(_t);
}
}
try {
arguments.getDeclaredTypeForLambda(3);
Assert.fail("Expected exception");
} catch (final Throwable _t_1) {
if (_t_1 instanceof IndexOutOfBoundsException) {
} else {
throw Exceptions.sneakyThrow(_t_1);
}
}
}
use of org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference in project xtext-xtend by eclipse.
the class VarArgFeatureCallArgumentsTest method testBug457779_03.
@Test
public void testBug457779_03() {
final IFeatureCallArguments arguments = this.toArgumentsWithReceiver("String s, int[] i", "\"\"");
final XExpression first = arguments.getArgument(0);
Assert.assertNull(first);
final LightweightTypeReference firstType = arguments.getDeclaredTypeForLambda(0);
Assert.assertNull(firstType);
final XExpression second = arguments.getArgument(1);
Assert.assertTrue((second instanceof XStringLiteral));
final LightweightTypeReference secondType = arguments.getDeclaredTypeForLambda(1);
Assert.assertEquals("String", secondType.getSimpleName());
try {
arguments.getArgument(2);
Assert.fail("Expected exception");
} catch (final Throwable _t) {
if (_t instanceof IndexOutOfBoundsException) {
} else {
throw Exceptions.sneakyThrow(_t);
}
}
try {
arguments.getDeclaredTypeForLambda(2);
Assert.fail("Expected exception");
} catch (final Throwable _t_1) {
if (_t_1 instanceof IndexOutOfBoundsException) {
} else {
throw Exceptions.sneakyThrow(_t_1);
}
}
}
use of org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference in project xtext-xtend by eclipse.
the class VarArgFeatureCallArgumentsTest method testBug457779_01.
@Test
public void testBug457779_01() {
final IFeatureCallArguments arguments = this.toArgumentsWithReceiver("String s, int[] i", "\"\", 1, true");
final XExpression first = arguments.getArgument(0);
Assert.assertNull(first);
final LightweightTypeReference firstType = arguments.getDeclaredTypeForLambda(0);
Assert.assertNull(firstType);
final XExpression second = arguments.getArgument(1);
Assert.assertTrue((second instanceof XStringLiteral));
final LightweightTypeReference secondType = arguments.getDeclaredTypeForLambda(1);
Assert.assertEquals("String", secondType.getSimpleName());
final XExpression third = arguments.getArgument(2);
Assert.assertTrue((third instanceof XNumberLiteral));
final LightweightTypeReference thirdType = arguments.getDeclaredTypeForLambda(2);
Assert.assertEquals("int", thirdType.getSimpleName());
final XExpression fourth = arguments.getArgument(3);
Assert.assertTrue((fourth instanceof XBooleanLiteral));
final LightweightTypeReference fourthType = arguments.getDeclaredTypeForLambda(3);
Assert.assertEquals("int", fourthType.getSimpleName());
try {
arguments.getArgument(4);
Assert.fail("Expected exception");
} catch (final Throwable _t) {
if (_t instanceof IndexOutOfBoundsException) {
} else {
throw Exceptions.sneakyThrow(_t);
}
}
try {
arguments.getDeclaredTypeForLambda(4);
Assert.fail("Expected exception");
} catch (final Throwable _t_1) {
if (_t_1 instanceof IndexOutOfBoundsException) {
} else {
throw Exceptions.sneakyThrow(_t_1);
}
}
}
use of org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference in project xtext-xtend by eclipse.
the class CommonSuperTypeTest method testCommonSuperType_23.
@Test
public void testCommonSuperType_23() {
try {
this.function("def void m() {}");
ITypeReferenceOwner _owner = this.getOwner();
AnyTypeReference _anyTypeReference = new AnyTypeReference(_owner);
ITypeReferenceOwner _owner_1 = this.getOwner();
AnyTypeReference _anyTypeReference_1 = new AnyTypeReference(_owner_1);
final List<LightweightTypeReference> types = CollectionLiterals.<LightweightTypeReference>newImmutableList(_anyTypeReference, _anyTypeReference_1);
final LightweightTypeReference superType = this.getServices().getTypeConformanceComputer().getCommonSuperType(types, this.getOwner());
Assert.assertEquals("null", superType.getSimpleName());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
Aggregations