diff options
author | Stephan Herrmann | 2019-03-21 14:13:29 +0000 |
---|---|---|
committer | Stephan Herrmann | 2019-03-21 14:13:29 +0000 |
commit | 7e648ad52d39e497ae67fdba898f57e273551ccf (patch) | |
tree | 9cada24f77e7083a4964cd95bf8a67a93079b134 /org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintExpressionFormula.java | |
parent | e02c8a79289b0ab7391ddde247434f604b181e74 (diff) | |
download | org.eclipse.objectteams-7e648ad52d39e497ae67fdba898f57e273551ccf.tar.gz org.eclipse.objectteams-7e648ad52d39e497ae67fdba898f57e273551ccf.tar.xz org.eclipse.objectteams-7e648ad52d39e497ae67fdba898f57e273551ccf.zip |
update jdt.core to I20190321-0435 (first build with Java 12 support)
- initial rough merge
Diffstat (limited to 'org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintExpressionFormula.java')
-rw-r--r-- | org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintExpressionFormula.java | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintExpressionFormula.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintExpressionFormula.java index 75717b193..0ae478095 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintExpressionFormula.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintExpressionFormula.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013, 2017 GK Software AG. + * Copyright (c) 2013, 2019 GK Software AG. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -30,6 +30,7 @@ import org.eclipse.jdt.internal.compiler.ast.Invocation; import org.eclipse.jdt.internal.compiler.ast.LambdaExpression; import org.eclipse.jdt.internal.compiler.ast.MessageSend; import org.eclipse.jdt.internal.compiler.ast.ReferenceExpression; +import org.eclipse.jdt.internal.compiler.ast.SwitchExpression; import org.eclipse.jdt.internal.compiler.ast.Wildcard; import org.eclipse.jdt.internal.compiler.lookup.InferenceContext18.SuspendedInferenceRecord; @@ -144,6 +145,14 @@ class ConstraintExpressionFormula extends ConstraintFormula { new ConstraintExpressionFormula(conditional.valueIfTrue, this.right, this.relation, this.isSoft), new ConstraintExpressionFormula(conditional.valueIfFalse, this.right, this.relation, this.isSoft) }; + } else if (this.left instanceof SwitchExpression) { + SwitchExpression se = (SwitchExpression) this.left; + ConstraintFormula[] cfs = new ConstraintFormula[se.resultExpressions.size()]; + int i = 0; + for (Expression re : se.resultExpressions) { + cfs[i++] = new ConstraintExpressionFormula(re, this.right, this.relation, this.isSoft); + } + return cfs; } else if (this.left instanceof LambdaExpression) { LambdaExpression lambda = (LambdaExpression) this.left; BlockScope scope = lambda.enclosingScope; @@ -522,6 +531,13 @@ class ConstraintExpressionFormula extends ConstraintFormula { variables.addAll(new ConstraintExpressionFormula(expr.valueIfTrue, this.right, COMPATIBLE).inputVariables(context)); variables.addAll(new ConstraintExpressionFormula(expr.valueIfFalse, this.right, COMPATIBLE).inputVariables(context)); return variables; + } else if (this.left instanceof SwitchExpression && this.left.isPolyExpression()) { + SwitchExpression expr = (SwitchExpression) this.left; + Set<InferenceVariable> variables = new HashSet<>(); + for (Expression re : expr.resultExpressions) { + variables.addAll(new ConstraintExpressionFormula(re, this.right, COMPATIBLE).inputVariables(context)); + } + return variables; } return EMPTY_VARIABLE_LIST; } |