91 lines
2.0 KiB
JSON
91 lines
2.0 KiB
JSON
{
|
|
"schema": "ailang/v0",
|
|
"name": "test_22c_user_class_e2e",
|
|
"imports": [],
|
|
"defs": [
|
|
{
|
|
"kind": "type",
|
|
"name": "IntBox",
|
|
"ctors": [
|
|
{ "name": "MkIntBox", "fields": [{ "k": "con", "name": "Int" }] }
|
|
]
|
|
},
|
|
{
|
|
"kind": "class",
|
|
"name": "Foo",
|
|
"param": "a",
|
|
"methods": [
|
|
{
|
|
"name": "foo",
|
|
"type": {
|
|
"k": "fn",
|
|
"params": [{ "k": "var", "name": "a" }],
|
|
"param_modes": ["borrow"],
|
|
"ret": { "k": "con", "name": "Int" },
|
|
"effects": []
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"kind": "instance",
|
|
"class": "Foo",
|
|
"type": { "k": "con", "name": "IntBox" },
|
|
"methods": [
|
|
{
|
|
"name": "foo",
|
|
"body": {
|
|
"t": "lam",
|
|
"params": ["b"],
|
|
"paramTypes": [{ "k": "var", "name": "a" }],
|
|
"retType": { "k": "con", "name": "Int" },
|
|
"body": {
|
|
"t": "match",
|
|
"scrutinee": { "t": "var", "name": "b" },
|
|
"arms": [
|
|
{
|
|
"pat": {
|
|
"p": "ctor",
|
|
"ctor": "MkIntBox",
|
|
"fields": [{ "p": "var", "name": "v" }]
|
|
},
|
|
"body": { "t": "var", "name": "v" }
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"kind": "fn",
|
|
"name": "main",
|
|
"type": {
|
|
"k": "fn",
|
|
"params": [],
|
|
"ret": { "k": "con", "name": "Unit" },
|
|
"effects": ["IO"]
|
|
},
|
|
"params": [],
|
|
"body": {
|
|
"t": "do",
|
|
"op": "io/print_int",
|
|
"args": [
|
|
{
|
|
"t": "app",
|
|
"fn": { "t": "var", "name": "foo" },
|
|
"args": [
|
|
{
|
|
"t": "ctor",
|
|
"type": "IntBox",
|
|
"ctor": "MkIntBox",
|
|
"args": [{ "t": "lit", "lit": { "kind": "int", "value": 42 } }]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|