use of org.eclipse.xtend.core.xtend.XtendFile in project xtext-xtend by eclipse.
the class ErrorTest method testErrorModel_016.
@Test
public void testErrorModel_016() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class <T> {");
_builder.newLine();
_builder.append("\t");
_builder.append("val String s");
_builder.newLine();
_builder.append(" ");
_builder.append("new(String ^new) {");
_builder.newLine();
_builder.append(" ");
_builder.append("s = ^new");
_builder.newLine();
_builder.append(" ");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final XtendFile file = this.processWithoutException(_builder);
final XtendTypeDeclaration unnamed = IterableExtensions.<XtendTypeDeclaration>head(file.getXtendTypes());
XtendMember _last = IterableExtensions.<XtendMember>last(unnamed.getMembers());
final XtendConstructor constructor = ((XtendConstructor) _last);
XExpression _expression = constructor.getExpression();
final XBlockExpression body = ((XBlockExpression) _expression);
XExpression _head = IterableExtensions.<XExpression>head(body.getExpressions());
final XAssignment assignment = ((XAssignment) _head);
final IResolvedTypes resolvedTypes = this.typeResolver.resolveTypes(assignment);
Assert.assertNotNull(resolvedTypes.getActualType(assignment));
}
use of org.eclipse.xtend.core.xtend.XtendFile in project xtext-xtend by eclipse.
the class ErrorTest method testErrorModel_077.
@Test
public void testErrorModel_077() throws Exception {
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("try return \'literal\' as as Boolean");
_builder.newLine();
_builder.append("\t\t ");
_builder.append("catch(NullPointerException e) return \'second thing is thrown\'\t\t ");
_builder.newLine();
_builder.append("\t\t ");
_builder.append("catch(ClassCastException e) throw new NullPointerException()");
_builder.newLine();
_builder.append(" ");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final XtendFile file = this.processWithoutException(_builder);
final IResolvedTypes resolvedTypes = this.typeResolver.resolveTypes(file);
final XCastedExpression casted = IteratorExtensions.<XCastedExpression>last(Iterators.<XCastedExpression>filter(file.eAllContents(), XCastedExpression.class));
Assert.assertNull(casted.getType());
Assert.assertNotNull(resolvedTypes.getActualType(casted));
}
use of org.eclipse.xtend.core.xtend.XtendFile in project xtext-xtend by eclipse.
the class ErrorTest method testErrorModel_020.
@Test
public void testErrorModel_020() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package x");
_builder.newLine();
_builder.append("class Y {");
_builder.newLine();
_builder.append("\t");
_builder.append("@com.google.inject.Inject extension test.GenericExtensionMethods<String,Integer> x");
_builder.newLine();
_builder.append("\t");
_builder.append("def foo(String arg) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("arg.method");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final XtendFile file = this.processWithoutException(_builder);
final XtendTypeDeclaration y = IterableExtensions.<XtendTypeDeclaration>head(file.getXtendTypes());
XtendMember _last = IterableExtensions.<XtendMember>last(y.getMembers());
final XtendFunction function = ((XtendFunction) _last);
XExpression _expression = function.getExpression();
final XBlockExpression body = ((XBlockExpression) _expression);
XExpression _head = IterableExtensions.<XExpression>head(body.getExpressions());
final XMemberFeatureCall featureCall = ((XMemberFeatureCall) _head);
XExpression _implicitReceiver = featureCall.getImplicitReceiver();
final XMemberFeatureCall implicitReceiver = ((XMemberFeatureCall) _implicitReceiver);
final XExpression this_ = implicitReceiver.getMemberCallTarget();
final IResolvedTypes resolvedTypes = this.typeResolver.resolveTypes(this_);
Assert.assertNotNull(resolvedTypes.getActualType(this_));
}
use of org.eclipse.xtend.core.xtend.XtendFile in project xtext-xtend by eclipse.
the class ErrorTest method testErrorModel_005.
@Test
public void testErrorModel_005() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("@");
_builder.newLine();
final XtendFile file = this.processWithoutException(_builder);
final XtendTypeDeclaration typeDeclaration = IterableExtensions.<XtendTypeDeclaration>head(file.getXtendTypes());
final EList<XAnnotation> annotations = typeDeclaration.getAnnotations();
final IResolvedTypes resolvedTypes = this.typeResolver.resolveTypes(IterableExtensions.<XAnnotation>head(annotations));
Assert.assertNotNull(resolvedTypes.getActualType(IterableExtensions.<XAnnotation>head(annotations)));
}
use of org.eclipse.xtend.core.xtend.XtendFile in project xtext-xtend by eclipse.
the class ErrorTest method testErrorModel_006.
@Test
public void testErrorModel_006() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("@Data class A {}");
_builder.newLine();
_builder.append("@");
_builder.newLine();
final XtendFile file = this.processWithoutException(_builder);
final XtendTypeDeclaration typeDeclaration = IterableExtensions.<XtendTypeDeclaration>last(file.getXtendTypes());
final EList<XAnnotation> annotations = typeDeclaration.getAnnotations();
final IResolvedTypes resolvedTypes = this.typeResolver.resolveTypes(IterableExtensions.<XAnnotation>head(annotations));
Assert.assertNotNull(resolvedTypes.getActualType(IterableExtensions.<XAnnotation>head(annotations)));
}
Aggregations