use of org.eclipse.xtext.xbase.typesystem.IResolvedTypes in project xtext-xtend by eclipse.
the class ErrorTest method testErrorModel_003.
@Test
public void testErrorModel_003() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class TestXtend {");
_builder.newLine();
_builder.append("\t");
_builder.append("val static int a = 4");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("@Click(#[ a, a ])");
_builder.newLine();
_builder.append("\t");
_builder.append("d");
_builder.newLine();
final XtendFile file = this.processWithoutException(_builder);
XtendTypeDeclaration _head = IterableExtensions.<XtendTypeDeclaration>head(file.getXtendTypes());
final XtendClass clazz = ((XtendClass) _head);
final XtendMember lastMember = IterableExtensions.<XtendMember>last(clazz.getMembers());
final EList<XAnnotation> annotations = lastMember.getAnnotations();
final IResolvedTypes resolvedTypes = this.typeResolver.resolveTypes(IterableExtensions.<XAnnotation>head(annotations));
Assert.assertNotNull(resolvedTypes.getActualType(IterableExtensions.<XAnnotation>head(annotations)));
}
use of org.eclipse.xtext.xbase.typesystem.IResolvedTypes in project xtext-xtend by eclipse.
the class ErrorTest method testErrorModel_009.
@Test
public void testErrorModel_009() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class X {");
_builder.newLine();
_builder.append("\t");
_builder.append("@Property val S");
_builder.newLine();
final XtendFile file = this.processWithoutException(_builder);
final XtendTypeDeclaration typeDeclaration = IterableExtensions.<XtendTypeDeclaration>last(file.getXtendTypes());
final EList<XAnnotation> annotations = IterableExtensions.<XtendMember>last(typeDeclaration.getMembers()).getAnnotations();
final IResolvedTypes resolvedTypes = this.typeResolver.resolveTypes(IterableExtensions.<XAnnotation>head(annotations));
Assert.assertNotNull(resolvedTypes.getActualType(IterableExtensions.<XAnnotation>head(annotations)));
}
use of org.eclipse.xtext.xbase.typesystem.IResolvedTypes in project xtext-xtend by eclipse.
the class ErrorTest method testErrorModel_014.
@Test
public void testErrorModel_014() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class B extends {");
_builder.newLine();
_builder.append("\t");
_builder.append("override foo(String x, String...args) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("return x");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("abstract class A {");
_builder.newLine();
_builder.append("\t");
_builder.append("def String foo(String x, String...args)");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final XtendFile file = this.processWithoutException(_builder);
final XtendTypeDeclaration headerAccess = IterableExtensions.<XtendTypeDeclaration>last(file.getXtendTypes());
XtendMember _head = IterableExtensions.<XtendMember>head(headerAccess.getMembers());
final XtendFunction function = ((XtendFunction) _head);
EObject _head_1 = IterableExtensions.<EObject>head(this.associations.getJvmElements(function));
final JvmOperation operation = ((JvmOperation) _head_1);
final IResolvedTypes resolvedTypes = this.typeResolver.resolveTypes(operation);
Assert.assertNotNull(resolvedTypes.getActualType(operation));
}
use of org.eclipse.xtext.xbase.typesystem.IResolvedTypes in project xtext-xtend by eclipse.
the class ErrorTest method testErrorModel_076.
@Test
public void testErrorModel_076() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class C {");
_builder.newLine();
_builder.append("\t");
_builder.append("def String m(boolean b) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("switch \'a\' {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("case \'b\': \'a\'");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("case \'c\': {");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("if ");
_builder.newLine();
_builder.append("\t\t\t\t\t");
_builder.append("return \'b\'");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("else");
_builder.newLine();
_builder.append("\t\t\t\t\t");
_builder.append("return \'c\'");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t\t");
_builder.append("}");
_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 XIfExpression ifExpression = IteratorExtensions.<XIfExpression>head(Iterators.<XIfExpression>filter(file.eAllContents(), XIfExpression.class));
Assert.assertNull(ifExpression.getThen());
Assert.assertNull(ifExpression.getElse());
Assert.assertNotNull(resolvedTypes.getActualType(ifExpression));
}
use of org.eclipse.xtext.xbase.typesystem.IResolvedTypes in project xtext-xtend by eclipse.
the class ErrorTest method testErrorModel_019.
@Test
public void testErrorModel_019() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package x");
_builder.newLine();
_builder.append("import bug396879.*");
_builder.newLine();
_builder.append("class Z {");
_builder.newLine();
_builder.append(" \t");
_builder.append("def addListeners(BooleanProperty prop) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("val ChangeListenerBoolean> listener = [ p, oldValue, newValue | ]\t\tprop.addListener(listener)");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final XtendFile file = this.processWithoutException(_builder);
final XtendTypeDeclaration z = IterableExtensions.<XtendTypeDeclaration>head(file.getXtendTypes());
XtendMember _get = z.getMembers().get(1);
final XtendField field = ((XtendField) _get);
XExpression _initialValue = field.getInitialValue();
final XClosure closure = ((XClosure) _initialValue);
final JvmFormalParameter param = IterableExtensions.<JvmFormalParameter>head(closure.getDeclaredFormalParameters());
final IResolvedTypes resolvedTypes = this.typeResolver.resolveTypes(param);
Assert.assertNotNull(resolvedTypes.getActualType(param));
}
Aggregations