Permalink
Browse files

Disallow spread member and null-safe member operators on method refer…

…ences for M2
  • Loading branch information...
1 parent becd3e9 commit b8a2ad541e0ed798aedcc45721b9d7d6981b6258 @tombentley tombentley committed Mar 15, 2012
Showing with 15 additions and 0 deletions.
  1. +15 −0 src/com/redhat/ceylon/compiler/typechecker/analyzer/ExpressionVisitor.java
View
15 src/com/redhat/ceylon/compiler/typechecker/analyzer/ExpressionVisitor.java
@@ -3239,6 +3239,21 @@ else if (p.isCovariant()) {
if (that.getTypeModel()==null) {
that.setTypeModel( defaultType() );
}
+ if (that instanceof Tree.Expression) {
+ Tree.Expression expr = (Tree.Expression)that;
+ Tree.Term term = expr.getTerm();
+ if (term instanceof Tree.QualifiedMemberOrTypeExpression) {
+ Tree.QualifiedMemberOrTypeExpression qme = (Tree.QualifiedMemberOrTypeExpression)term;
+ if (qme.getMemberOperator() instanceof Tree.SpreadOp
+ && qme.getTypeModel().getDeclaration().getQualifiedNameString().equals("ceylon.language.Callable")) {
+ that.addWarning("spread method references not supported yet");
+ }
+ if (qme.getMemberOperator() instanceof Tree.SafeMemberOp
+ && qme.getTypeModel().getDeclaration().getQualifiedNameString().equals("ceylon.language.Callable")) {
+ that.addWarning("null-safe method references not supported yet");
+ }
+ }
+ }
}
@Override public void visit(Tree.Type that) {

0 comments on commit b8a2ad5

Please sign in to comment.