|
50 | 50 | import static org.graalvm.polyglot.tck.TypeDescriptor.NUMBER;
|
51 | 51 | import static org.graalvm.polyglot.tck.TypeDescriptor.OBJECT;
|
52 | 52 | import static org.graalvm.polyglot.tck.TypeDescriptor.STRING;
|
| 53 | +import static org.graalvm.polyglot.tck.TypeDescriptor.INSTANTIABLE; |
53 | 54 | import static org.graalvm.polyglot.tck.TypeDescriptor.array;
|
54 | 55 | import static org.graalvm.polyglot.tck.TypeDescriptor.executable;
|
55 | 56 | import static org.graalvm.polyglot.tck.TypeDescriptor.intersection;
|
@@ -81,6 +82,9 @@ public class PythonProvider implements LanguageProvider {
|
81 | 82 | private static final TypeDescriptor NUMBER_OBJECT = TypeDescriptor.union(NUMBER, BOOLEAN, OBJECT, array(ANY));
|
82 | 83 | private static final TypeDescriptor PSEQUENCE_OBJECT = TypeDescriptor.union(array(ANY), STRING);
|
83 | 84 |
|
| 85 | + // Python types are just objects |
| 86 | + private static final TypeDescriptor PYTHON_TYPE = TypeDescriptor.union(OBJECT, INSTANTIABLE); |
| 87 | + |
84 | 88 | public String getId() {
|
85 | 89 | return ID;
|
86 | 90 | }
|
@@ -268,7 +272,7 @@ public Collection<? extends Snippet> createStatements(Context context) {
|
268 | 272 | addStatementSnippet(context, snippets, "class", "class Custom0:\n" +
|
269 | 273 | " def __init__(self, val):\n" +
|
270 | 274 | " self.val = val\n" +
|
271 |
| - "Custom0", OBJECT, ANY); |
| 275 | + "Custom0", PYTHON_TYPE, ANY); |
272 | 276 | addStatementSnippet(context, snippets, "class", "class Custom1:\n" +
|
273 | 277 | " def __call__(self, val):\n" +
|
274 | 278 | " return val\n" +
|
|
0 commit comments