use of org.eclipse.xtend.core.xtend.XtendFile in project xtext-xtend by eclipse.
the class ValidationBug435020Test method test_04.
@Test
public void test_04() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class Foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("def void foo() {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("new Object {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("static def bar() {");
_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 c = this.parser.parse(_builder);
this.helper.assertError(c, XtendPackage.Literals.XTEND_FUNCTION, IssueCodes.ANONYMOUS_CLASS_STATIC_METHOD);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtend.core.xtend.XtendFile in project xtext-xtend by eclipse.
the class ValidationBug437678Test method test_09.
@Test
public void test_09() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class A {");
_builder.newLine();
_builder.append("\t");
_builder.append("def methodA(B b) {");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("class B {}");
_builder.newLine();
_builder.append("class C {");
_builder.newLine();
_builder.append("\t");
_builder.append("extension A");
_builder.newLine();
_builder.append("\t");
_builder.append("def static void m(B b) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("b.methodA");
_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.XMEMBER_FEATURE_CALL, IssueCodes.STATIC_ACCESS_TO_INSTANCE_MEMBER, "Cannot make an implicit static reference to the non-static extension methodA");
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtend.core.xtend.XtendFile in project xtext-xtend by eclipse.
the class ValidationBug437678Test method test_12.
@Test
public void test_12() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class C {");
_builder.newLine();
_builder.append("\t");
_builder.append("def static void m() {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("m2");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.append("def static void m2(Object o) {}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final XtendFile file = this.parser.parse(_builder);
this.helper.assertError(file, XbasePackage.Literals.XFEATURE_CALL, IssueCodes.STATIC_ACCESS_TO_INSTANCE_MEMBER, "Cannot make an implicit reference to this from a static context");
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtend.core.xtend.XtendFile in project xtext-xtend by eclipse.
the class ValidationBug437678Test method test_08.
@Test
public void test_08() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class A {");
_builder.newLine();
_builder.append("\t");
_builder.append("def methodA(B b) {");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("class B {}");
_builder.newLine();
_builder.append("class C {");
_builder.newLine();
_builder.append("\t");
_builder.append("static extension A");
_builder.newLine();
_builder.append("\t");
_builder.append("def static void m(B b) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("b.methodA");
_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 ValidationBug437678Test method test_04.
@Test
public void test_04() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class A {");
_builder.newLine();
_builder.append("\t");
_builder.append("def methodA() {");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("class C {");
_builder.newLine();
_builder.append("\t");
_builder.append("static extension A");
_builder.newLine();
_builder.append("\t");
_builder.append("def static void m() {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("methodA");
_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);
}
}
Aggregations