IDEA-91263 Incorrect type of result of '|' operator

This commit is contained in:
Max Medvedev
2012-09-10 16:23:47 +04:00
parent dd2c010187
commit 5f14efba1b
2 changed files with 21 additions and 20 deletions
@@ -18,14 +18,12 @@ package standardDsls
import com.intellij.psi.PsiType
import com.intellij.psi.util.PsiUtil
import static standardDsls.Constants.NUMBER
import static standardDsls.Constants.STRING
/**
* @author Maxim.Medvedev
*/
private interface Constants {
String NUMBER = "java.lang.Number"
String STRING = "java.lang.String"
String WILDCARD_PREFIX = "? extends "
}
@@ -61,22 +59,25 @@ contributor(ctype:"groovy.lang.GString") {
delegatesTo(findClass("java.lang.String"))
}
contributor(ctype:NUMBER) {
method name: "plus", type: NUMBER, params:[arg:NUMBER]
method name: "minus", type: NUMBER, params:[arg:NUMBER]
method name: "multiply", type: NUMBER, params:[arg:NUMBER]
method name: "power", type: NUMBER, params:[arg:NUMBER]
method name: "div", type: NUMBER, params:[arg:NUMBER]
method name: "mod", type: NUMBER, params:[arg:NUMBER]
method name: "or", type: NUMBER, params:[arg:NUMBER]
method name: "and", type: NUMBER, params:[arg:NUMBER]
method name: "xor", type: NUMBER, params:[arg:NUMBER]
method name: "next", type: removeWildcard(psiType.canonicalText)
method name: "previous", type: removeWildcard(psiType.canonicalText)
method name: "negative", type: removeWildcard(psiType.canonicalText)
method name: "positive", type: removeWildcard(psiType.canonicalText)
[Integer, Double, Float, Byte, Long, Short, Number].each {
def className = it.canonicalName
contributor(ctype: className) {
method name: "plus", type: className, params: [arg: className]
method name: "minus", type: className, params: [arg: className]
method name: "multiply", type: className, params: [arg: className]
method name: "power", type: className, params: [arg: className]
method name: "div", type: className, params: [arg: className]
method name: "mod", type: className, params: [arg: className]
method name: "or", type: className, params: [arg: className]
method name: "and", type: className, params: [arg: className]
method name: "xor", type: className, params: [arg: className]
method name: "next", type: className
method name: "previous", type: className
method name: "negative", type: className
method name: "positive", type: className
method name: "plus", type: STRING, params:[arg:STRING]
method name: "plus", type: STRING, params: [arg: STRING]
}
}
contributor(ctype: 'groovy.lang.MetaClass') {
@@ -10,13 +10,13 @@ return null;
public void foo(int x) {
final groovy.lang.Reference<java.lang.Integer> i = new groovy.lang.Reference<java.lang.Integer>(x);
org.codehaus.groovy.runtime.DefaultGroovyMethods.each(new java.util.ArrayList<java.lang.Integer>(java.util.Arrays.asList(1, 2, 3)), new groovy.lang.Closure<java.lang.Number>(this, this) {
public java.lang.Number doCall(java.lang.Object it) {
org.codehaus.groovy.runtime.DefaultGroovyMethods.each(new java.util.ArrayList<java.lang.Integer>(java.util.Arrays.asList(1, 2, 3)), new groovy.lang.Closure<java.lang.Integer>(this, this) {
public java.lang.Integer doCall(java.lang.Object it) {
org.codehaus.groovy.runtime.DefaultGroovyMethods.print(this, i.get());
return setGroovyRef(i, i.get() + 1);
}
public java.lang.Number doCall() {
public java.lang.Integer doCall() {
return doCall(null);
}