mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fixed type name for bounded generic types
This commit is contained in:
@@ -39,7 +39,7 @@ public class PyGenericType implements PyType {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
return myBound != null ? myName + " (" + myBound.getName() + ")" : myName;
|
||||
return myBound != null ? myName + " <= " + myBound.getName() : myName;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -53,11 +53,11 @@ public class PyUnionType implements PyType {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "one of (" + StringUtil.join(myMembers, new NullableFunction<PyType, String>() {
|
||||
public String fun(PyType pyType) {
|
||||
return pyType == null ? "unknown" : pyType.getName();
|
||||
return StringUtil.join(myMembers, new NullableFunction<PyType, String>() {
|
||||
public String fun(PyType type) {
|
||||
return type != null ? type.getName() : null;
|
||||
}
|
||||
}, ", ") + ")";
|
||||
}, " | ");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
def test():
|
||||
def f(x):
|
||||
"""
|
||||
:type x: T <= int or str
|
||||
:type x: T <= int | str
|
||||
:rtype: T
|
||||
"""
|
||||
pass
|
||||
|
||||
x = f(10)
|
||||
y = f('foo')
|
||||
z = f(<warning descr="Expected type 'T (one of (int, str))', got 'list' instead">[]</warning>)
|
||||
z = f(<warning descr="Expected type 'T <= int | str', got 'list' instead">[]</warning>)
|
||||
return x + <warning descr="Expected type 'one of (int, long, float, complex)', got 'str' instead">y</warning>
|
||||
|
||||
Reference in New Issue
Block a user