use of org.eclipse.ceylon.model.typechecker.model.Interface in project ceylon by eclipse.
the class DeclarationVisitor method visit.
@Override
public void visit(Tree.InterfaceDefinition that) {
Interface i = new Interface();
i.setDynamic(that.getDynamic());
defaultExtendedToObject(i);
that.setDeclarationModel(i);
super.visit(that);
if (i.isNativeImplementation()) {
addMissingHeaderMembers(i);
}
if (i.isDynamic()) {
i.makeMembersDynamic();
}
// Required by IDE to be omitted: https://github.com/ceylon/ceylon-compiler/issues/2326
// if (that.getDynamic()) {
// checkDynamic(that);
// }
}
use of org.eclipse.ceylon.model.typechecker.model.Interface in project ceylon by eclipse.
the class ExpressionVisitor method isJavaNullableMutator.
public boolean isJavaNullableMutator(Type pt, Interface cd) {
boolean nullable = false;
Type cst = pt.getSupertype(cd);
if (cst == null) {
Interface ld = unit.getJavaListDeclaration();
cst = pt.getSupertype(ld);
if (cst != null) {
nullable = true;
}
}
if (cst == null) {
Interface md = unit.getJavaMapDeclaration();
cst = pt.getSupertype(md);
if (cst != null) {
nullable = true;
}
}
if (cst == null) {
boolean objectArray = unit.isJavaObjectArrayType(pt);
nullable = objectArray;
}
return nullable;
}
use of org.eclipse.ceylon.model.typechecker.model.Interface in project ceylon by eclipse.
the class ExpressionVisitor method visitMeasureOperator.
private void visitMeasureOperator(Tree.SegmentOp that) {
Type lhst = leftType(that);
Type rhst = rightType(that);
Interface ed = unit.getEnumerableDeclaration();
Type ot = checkSupertype(lhst, ed, that.getLeftTerm(), "left operand must be of enumerable type");
if (!isTypeUnknown(rhst)) {
checkAssignable(rhst, unit.getIntegerType(), that.getRightTerm(), "right operand must be an integer");
}
if (ot != null) {
Type ta = ot.getTypeArgumentList().get(0);
that.setTypeModel(unit.getMeasureType(ta));
}
}
use of org.eclipse.ceylon.model.typechecker.model.Interface in project ceylon by eclipse.
the class TypeVisitor method visit.
@Override
public void visit(Tree.FunctionType that) {
super.visit(that);
Tree.StaticType rt = that.getReturnType();
if (rt != null) {
List<Tree.Type> argumentTypes = that.getArgumentTypes();
Type tt = getTupleType(argumentTypes, unit);
Interface cd = unit.getCallableDeclaration();
Type pt = appliedType(cd, rt.getTypeModel(), tt);
that.setTypeModel(pt);
}
}
use of org.eclipse.ceylon.model.typechecker.model.Interface in project ceylon by eclipse.
the class TypeVisitor method visit.
@Override
public void visit(Tree.ExtendedType that) {
inExtendsOrClassAlias = that.getInvocationExpression() != null;
super.visit(that);
inExtendsOrClassAlias = false;
inheritedType(that.getType());
checkExtendedTypeExpression(that.getType());
TypeDeclaration td = (TypeDeclaration) that.getScope();
if (!td.isAlias()) {
Tree.SimpleType et = that.getType();
if (et != null) {
Type type = et.getTypeModel();
if (type != null) {
TypeDeclaration etd = et.getDeclarationModel();
if (etd != null && !(etd instanceof UnknownType)) {
if (etd instanceof Constructor) {
type = type.getExtendedType();
etd = etd.getExtendedType().getDeclaration();
}
if (etd == td) {
// unnecessary, handled by SupertypeVisitor
// et.addError("directly extends itself: '" +
// td.getName() + "'");
} else if (etd instanceof TypeParameter) {
et.addError("directly extends a type parameter: '" + type.getDeclaration().getName(unit) + "'");
} else if (etd instanceof Interface) {
et.addError("extends an interface: '" + type.getDeclaration().getName(unit) + "'");
} else if (etd instanceof TypeAlias) {
et.addError("extends a type alias: '" + type.getDeclaration().getName(unit) + "'");
} else if (etd instanceof NothingType) {
et.addError("extends the bottom type 'Nothing'");
} else {
td.setExtendedType(type);
}
}
}
}
}
}
Aggregations