We're checking types!!!!

This commit is contained in:
Dustin Swan 2026-03-26 18:32:40 -06:00
parent f3c3a76671
commit f272ffaca2
No known key found for this signature in database
GPG key ID: 30D46587E2100467
6 changed files with 304 additions and 24 deletions

View file

@ -1,5 +1,5 @@
import type { Token } from './lexer'
import type { AST, MatchCase, Pattern, Definition, TypeAST, TypeDefinition, TypeConstructor } from './ast'
import type { AST, MatchCase, Pattern, Definition, TypeAST, TypeDefinition, TypeConstructor, Annotation } from './ast'
import { ParseError } from './error'
export class Parser {
@ -174,6 +174,12 @@ export class Parser {
if (this.current().kind === 'colon') {
this.advance();
annotation = { constraints: [], type: this.parseType() };
// Declaration only
if (this.current().kind === 'semicolon') {
this.advance();
return { kind: 'definition', name, annotation, ...this.getPos(nameToken) };
}
}
this.expect('equals');