Switching to ML style type annotations. not separate statement from the expression

This commit is contained in:
Dustin Swan 2026-03-26 16:05:22 -06:00
parent 6acec5641c
commit f3c3a76671
No known key found for this signature in database
GPG key ID: 30D46587E2100467
6 changed files with 35 additions and 36 deletions

View file

@ -325,9 +325,9 @@ export function prettyPrint(ast: AST, indent = 0): string {
case 'definition':
const ann = ast.annotation
? `${ast.name} : ${prettyPrintType(ast.annotation.type)};\n`
? ` : ${prettyPrintType(ast.annotation.type)}`
: '';
return `${ann}${ast.name} = ${prettyPrint(ast.body, indent)};`;
return `${ast.name}${ann} = ${prettyPrint(ast.body, indent)};`;
default:
return `Unknown AST kind: ${i}${(ast as any).kind}`
@ -373,7 +373,7 @@ function prettyPrintPattern(pattern: Pattern): string {
}
}
function prettyPrintType(type: TypeAST): string {
export function prettyPrintType(type: TypeAST): string {
switch (type.kind) {
case 'type-name':
case 'type-var':