iter 22b.2.6: method-name-collision diagnostic

This commit is contained in:
2026-05-09 18:07:52 +02:00
parent 1f6d2322c3
commit a9aa248910
4 changed files with 186 additions and 0 deletions
@@ -0,0 +1,27 @@
{
"schema": "ailang/v0",
"name": "test_22b2_method_name_collision_class_class",
"imports": [],
"defs": [
{
"kind": "class", "name": "A", "param": "a",
"methods": [{
"name": "foo",
"type": {
"k": "fn", "params": [{ "k": "var", "name": "a" }],
"ret": { "k": "con", "name": "Unit" }, "effects": []
}
}]
},
{
"kind": "class", "name": "B", "param": "b",
"methods": [{
"name": "foo",
"type": {
"k": "fn", "params": [{ "k": "var", "name": "b" }],
"ret": { "k": "con", "name": "Unit" }, "effects": []
}
}]
}
]
}
@@ -0,0 +1,26 @@
{
"schema": "ailang/v0",
"name": "test_22b2_method_name_collision_class_fn",
"imports": [],
"defs": [
{
"kind": "class", "name": "Greet", "param": "a",
"methods": [{
"name": "greet",
"type": {
"k": "fn", "params": [{ "k": "var", "name": "a" }],
"ret": { "k": "con", "name": "Str" }, "effects": []
}
}]
},
{
"kind": "fn", "name": "greet",
"type": {
"k": "fn", "params": [{ "k": "con", "name": "Int" }],
"ret": { "k": "con", "name": "Str" }, "effects": []
},
"params": ["x"],
"body": { "t": "lit", "lit": { "kind": "str", "value": "hi" } }
}
]
}