iter 22b.2.10: fix — positive green-path test, drop dead let _ = ws
Adds the missing positive counterpart to the no-instance test: `show 42` with `instance Show Int` PRESENT must typecheck green. This guards against registry-keying or threading bugs that would otherwise sneak past the negative-only test (an empty registry at typecheck time, or a key shape mismatch, would silently fire no-instance even when the instance exists). Also drops the dead `let _ = ws;` and its stale comment in `check_in_workspace` — the line above already consumes `ws.registry`, so the explicit drop is redundant. The remaining comment is folded into the registry-threading comment so the "registry is the only thing threaded" rationale is preserved.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"schema": "ailang/v0",
|
||||
"name": "test_22b2_instance_present",
|
||||
"imports": [],
|
||||
"defs": [
|
||||
{
|
||||
"kind": "class", "name": "Show", "param": "a",
|
||||
"methods": [{
|
||||
"name": "show",
|
||||
"type": {
|
||||
"k": "fn", "params": [{ "k": "var", "name": "a" }],
|
||||
"ret": { "k": "con", "name": "Str" }, "effects": []
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
"kind": "instance",
|
||||
"class": "Show",
|
||||
"type": { "k": "con", "name": "Int" },
|
||||
"methods": [{
|
||||
"name": "show",
|
||||
"body": { "t": "lit", "lit": { "kind": "str", "value": "n" } }
|
||||
}]
|
||||
},
|
||||
{
|
||||
"kind": "fn",
|
||||
"name": "main",
|
||||
"type": {
|
||||
"k": "fn", "params": [], "ret": { "k": "con", "name": "Str" },
|
||||
"effects": []
|
||||
},
|
||||
"params": [],
|
||||
"body": {
|
||||
"t": "app",
|
||||
"fn": { "t": "var", "name": "show" },
|
||||
"args": [{ "t": "lit", "lit": { "kind": "int", "value": 42 } }]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user