Clean up some code and fix all TypeScript type errors
This commit is contained in:
parent
21a05cf62d
commit
31e99fd8ba
1 changed files with 6 additions and 12 deletions
|
@ -1,11 +1,9 @@
|
||||||
import {
|
import {
|
||||||
Declaration,
|
Declaration,
|
||||||
EnumDeclaration,
|
EnumDeclaration,
|
||||||
EnumDeclarationStructElement,
|
|
||||||
Expression,
|
Expression,
|
||||||
LetDeclaration,
|
LetDeclaration,
|
||||||
Pattern,
|
Pattern,
|
||||||
Scope,
|
|
||||||
SourceFile,
|
SourceFile,
|
||||||
StructDeclaration,
|
StructDeclaration,
|
||||||
Symkind,
|
Symkind,
|
||||||
|
@ -366,7 +364,7 @@ export class TNominal extends TypeBase {
|
||||||
public readonly kind = TypeKind.Nominal;
|
public readonly kind = TypeKind.Nominal;
|
||||||
|
|
||||||
public constructor(
|
public constructor(
|
||||||
public decl: Declaration,
|
public decl: StructDeclaration | EnumDeclaration,
|
||||||
public node: Syntax | null = null,
|
public node: Syntax | null = null,
|
||||||
) {
|
) {
|
||||||
super(node);
|
super(node);
|
||||||
|
@ -383,7 +381,7 @@ export class TNominal extends TypeBase {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public substitute(sub: TVSub): Type {
|
public substitute(_sub: TVSub): Type {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1912,11 +1910,11 @@ export class Checker {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (left.kind === TypeKind.Nominal && right.kind === TypeKind.Nominal) {
|
if (left.kind === TypeKind.Nominal && right.kind === TypeKind.Nominal) {
|
||||||
if (left.decl !== right.decl) {
|
if (left.decl === right.decl) {
|
||||||
this.diagnostics.add(new UnificationFailedDiagnostic(left, right, [...constraint.getNodes()]));
|
return true;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
this.diagnostics.add(new UnificationFailedDiagnostic(left, right, [...constraint.getNodes()]));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (left.kind === TypeKind.App && right.kind === TypeKind.App) {
|
if (left.kind === TypeKind.App && right.kind === TypeKind.App) {
|
||||||
|
@ -1925,10 +1923,6 @@ export class Checker {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (left.kind === TypeKind.Record && right.kind === TypeKind.Record) {
|
if (left.kind === TypeKind.Record && right.kind === TypeKind.Record) {
|
||||||
if (left.decl !== right.decl) {
|
|
||||||
this.diagnostics.add(new UnificationFailedDiagnostic(left, right, [...constraint.getNodes()]));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
let success = true;
|
let success = true;
|
||||||
const remaining = new Set(right.fields.keys());
|
const remaining = new Set(right.fields.keys());
|
||||||
for (const [fieldName, fieldType] of left.fields) {
|
for (const [fieldName, fieldType] of left.fields) {
|
||||||
|
|
Loading…
Reference in a new issue