List spread type checking
This commit is contained in:
parent
bc5027ddc1
commit
1a65db6aac
1 changed files with 5 additions and 1 deletions
|
|
@ -252,7 +252,11 @@ function check(expr: AST, expected: TypeAST, env: TypeEnv, subst: Subst): string
|
||||||
if (expr.kind === 'list' && exp.kind === 'type-apply' && exp.constructor.kind === 'type-name' && exp.constructor.name === 'List') {
|
if (expr.kind === 'list' && exp.kind === 'type-apply' && exp.constructor.kind === 'type-name' && exp.constructor.name === 'List') {
|
||||||
const elemType = exp.args[0];
|
const elemType = exp.args[0];
|
||||||
for (const elem of expr.elements) {
|
for (const elem of expr.elements) {
|
||||||
if (elem.kind === 'list-spread') continue;
|
if (elem.kind === 'list-spread') {
|
||||||
|
const err = check(elem.spread, exp, env, subst);
|
||||||
|
if (err) return err;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const err = check(elem, elemType, env, subst);
|
const err = check(elem, elemType, env, subst);
|
||||||
if (err) return err;
|
if (err) return err;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue