Skip to content

Commit

Permalink
generic types
Browse files Browse the repository at this point in the history
  • Loading branch information
michele-nuzzi committed Feb 26, 2025
1 parent e7a373b commit 618e8d4
Show file tree
Hide file tree
Showing 34 changed files with 2,195 additions and 665 deletions.
16 changes: 16 additions & 0 deletions internal_docs/typechecking/AstCompiler.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# `AstCompiler`

Type checking appens while compiling the AST to TIR.

this is litterally the only job of `AstCompiler`.

during compilation from AST to TIR no other magic happens, no desugaring, no optimizations, no nothing.

The resulting TIR, is essentially the same as the original AST,
with the only exception being that in the TIR universe there are:

- NO generic types, only concrete types
- NO generic functions
- NO overloaded functions (overloads are replaced with concrete functions with different signatures)

essentially the TIR, right after AST compilation, is the same as the original AST but with every type explicit, and any ambiguity removed.
1 change: 0 additions & 1 deletion src/ast/nodes/statements/TypeImplementsStmt.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { SourceRange } from "../../Source/SourceRange";
import { Identifier } from "../common/Identifier";
import { HasSourceRange } from "../HasSourceRange";
import { AstNamedTypeExpr } from "../types/AstNamedTypeExpr";
import { AstFuncType } from "../types/AstNativeTypeExpr";
import { AstTypeExpr } from "../types/AstTypeExpr";
import { BlockStmt } from "./BlockStmt";
Expand Down
2 changes: 0 additions & 2 deletions src/ast/nodes/statements/declarations/FuncDecl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import { ArrowKind } from "../../expr/functions/ArrowKind";
import { PebbleExpr } from "../../expr/PebbleExpr";
import { HasSourceRange } from "../../HasSourceRange";
import { BlockStmt } from "../BlockStmt";
import { AstNamedTypeExpr } from "../../types/AstNamedTypeExpr";
import { AstFuncType } from "../../types/AstNativeTypeExpr";
import { AstTypeExpr } from "../../types/AstTypeExpr";

export class FuncDecl
implements HasSourceRange
Expand Down
Loading

0 comments on commit 618e8d4

Please sign in to comment.