use of org.eclipse.xtend.core.xtend.XtendFile in project xtext-xtend by eclipse.
the class ValidationBug432193Test method test_10.
@Test
public void test_10() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("interface Bar {");
_builder.newLine();
_builder.append("\t");
_builder.append("def void bar(java.util.List<Number> o) ");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("class Foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("public Bar bar = [ Iterable<String> o | ");
_builder.newLine();
_builder.append("\t");
_builder.append("]");
_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 (Iterable<String>)=>void to Bar");
} 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_04.
@Test
public void test_04() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("interface Bar<T extends Number> {");
_builder.newLine();
_builder.append("\t");
_builder.append("def void bar(T o) ");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("class Foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("public Bar<?> bar = [ Integer o | ");
_builder.newLine();
_builder.append("\t");
_builder.append("]");
_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_08.
@Test
public void test_08() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("interface Bar<T extends Number> {");
_builder.newLine();
_builder.append("\t");
_builder.append("def void bar(Iterable<T> o) ");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("class Foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("public Bar<? super Integer> bar = [ Iterable<String> o | ");
_builder.newLine();
_builder.append("\t");
_builder.append("]");
_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 (Iterable<String>)=>void to Bar<? super 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_05.
@Test
public void test_05() {
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 MyAbstract1<Integer> x1 = [String k|k.substring(0, 1).length]");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("abstract class MyAbstract1<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 MyAbstract1<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_01.
@Test
public void test_01() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("interface Bar {");
_builder.newLine();
_builder.append("\t");
_builder.append("def void bar(Object o) ");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("class Foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("Bar bar = [ String o | ");
_builder.newLine();
_builder.append("\t\t");
_builder.append("o.substring(7)");
_builder.newLine();
_builder.append("\t");
_builder.append("]");
_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)=>void to Bar");
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
Aggregations