use of org.eclipse.xtend.core.xtend.XtendFile in project xtext-xtend by eclipse.
the class ValidationBug432193Test method test_13.
@Test
public void test_13() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class C {");
_builder.newLine();
_builder.append("\t");
_builder.append("def void n(L<String> list) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("list.addListener [");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("LC<? extends String> c |");
_builder.newLine();
_builder.append("\t\t");
_builder.append("]");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("interface O {");
_builder.newLine();
_builder.append("\t");
_builder.append("def void addListener(IL listener)");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("interface L<E> extends O {");
_builder.newLine();
_builder.append("\t");
_builder.append("def void addListener(LL<? super E> listener)");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("interface LL<E> {");
_builder.newLine();
_builder.append("\t");
_builder.append("def void onChanged(LC<E> c)");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("interface LC<E> {}");
_builder.newLine();
_builder.append("interface IL {");
_builder.newLine();
_builder.append("\t");
_builder.append("def void invalidated(O o)");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final XtendFile file = this.parser.parse(_builder);
this.helper.assertNoErrors(file);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtend.core.xtend.XtendFile in project xtext-xtend by eclipse.
the class ValidationBug432193Test method test_06.
@Test
public void test_06() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class SAM {");
_builder.newLine();
_builder.append("\t");
_builder.append("def foo() {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("val MyInterface<Integer> x2 = [String k|k.substring(0, 1).length]");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("interface MyInterface<T> {");
_builder.newLine();
_builder.append("\t");
_builder.append("def T myAbstract(int u);");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final XtendFile file = this.parser.parse(_builder);
this.helper.assertError(file, XbasePackage.Literals.XCLOSURE, IssueCodes.INCOMPATIBLE_TYPES, "Type mismatch: cannot convert from (String)=>int to MyInterface<Integer>");
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtend.core.xtend.XtendFile in project xtext-xtend by eclipse.
the class ValidationBug432193Test method test_14.
@Test
public void test_14() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class C {");
_builder.newLine();
_builder.append("\t");
_builder.append("def void n(L<String> list) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("list.addListener [");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("LC<? super String> c |");
_builder.newLine();
_builder.append("\t\t");
_builder.append("]");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("interface O {");
_builder.newLine();
_builder.append("\t");
_builder.append("def void addListener(IL listener)");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("interface L<E> extends O {");
_builder.newLine();
_builder.append("\t");
_builder.append("def void addListener(LL<? super E> listener)");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("interface LL<E> {");
_builder.newLine();
_builder.append("\t");
_builder.append("def void onChanged(LC<E> c)");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("interface LC<E> {}");
_builder.newLine();
_builder.append("interface IL {");
_builder.newLine();
_builder.append("\t");
_builder.append("def void invalidated(O o)");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final XtendFile file = this.parser.parse(_builder);
this.helper.assertNoErrors(file);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtend.core.xtend.XtendFile in project xtext-xtend by eclipse.
the class ValidationBug433213Test method test_01.
@Test
public void test_01() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class C {");
_builder.newLine();
_builder.append("\t");
_builder.append("def m() {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("new Object {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("def <T> T m2() {}");
_builder.newLine();
_builder.append("\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final XtendFile file = this.parser.parse(_builder);
final XtendTypeDeclaration c = IterableExtensions.<XtendTypeDeclaration>head(file.getXtendTypes());
XtendMember _head = IterableExtensions.<XtendMember>head(c.getMembers());
final XtendFunction m = ((XtendFunction) _head);
XExpression _expression = m.getExpression();
final XBlockExpression body = ((XBlockExpression) _expression);
XExpression _head_1 = IterableExtensions.<XExpression>head(body.getExpressions());
final AnonymousClass anon = ((AnonymousClass) _head_1);
XtendMember _head_2 = IterableExtensions.<XtendMember>head(anon.getMembers());
final XtendFunction m2 = ((XtendFunction) _head_2);
final JvmTypeReference returnType = m2.getReturnType();
final JvmType t = returnType.getType();
Assert.assertNotNull("notNull", t);
Assert.assertFalse("t.eIsProxy", t.eIsProxy());
this.helper.assertNoErrors(file);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtend.core.xtend.XtendFile in project xtext-xtend by eclipse.
the class ValidationBug433213Test method test_04.
@Test
public void test_04() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class C {");
_builder.newLine();
_builder.append("\t");
_builder.append("def m() {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("new Object {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("def <T> m2() {");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("new Object {");
_builder.newLine();
_builder.append("\t\t\t\t\t");
_builder.append("def T m3() {}");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final XtendFile file = this.parser.parse(_builder);
final XtendTypeDeclaration c = IterableExtensions.<XtendTypeDeclaration>head(file.getXtendTypes());
XtendMember _head = IterableExtensions.<XtendMember>head(c.getMembers());
final XtendFunction m = ((XtendFunction) _head);
XExpression _expression = m.getExpression();
final XBlockExpression body = ((XBlockExpression) _expression);
XExpression _head_1 = IterableExtensions.<XExpression>head(body.getExpressions());
final AnonymousClass anon = ((AnonymousClass) _head_1);
XtendMember _head_2 = IterableExtensions.<XtendMember>head(anon.getMembers());
final XtendFunction m2 = ((XtendFunction) _head_2);
XExpression _expression_1 = m2.getExpression();
final XBlockExpression body2 = ((XBlockExpression) _expression_1);
XExpression _head_3 = IterableExtensions.<XExpression>head(body2.getExpressions());
final AnonymousClass anon2 = ((AnonymousClass) _head_3);
XtendMember _head_4 = IterableExtensions.<XtendMember>head(anon2.getMembers());
final XtendFunction m3 = ((XtendFunction) _head_4);
final JvmTypeReference returnType = m3.getReturnType();
final JvmType t = returnType.getType();
Assert.assertNotNull("notNull", t);
Assert.assertFalse("t.eIsProxy", t.eIsProxy());
this.helper.assertNoErrors(file);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
Aggregations