Skip to content

Proper way to do type checking #706

Answered by msujew
ymc9 asked this question in Q&A
Sep 29, 2022 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

Hey @ymc9,

I believe I should do type-checking at linking time. In the same pass as linking or maybe another pass after that. Just wondering if it's appropriate.

Yeah, we do the same. It kind of depends on what your type system looks like, but I assume it contains something like interfaces/classes/structured types. In that case the linking step already requires a working type system, as you need it to resolve to fields/methods of classes for example.

How can I extend the generated AstNode types to carry typing information? Right now, I'm just adding an extra field by casting "any" back and forth. Is there a good way to achieve this?

We usually just store a map for AstNode -> type rela…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@ymc9
Comment options

@msujew
Comment options

@ymc9
Comment options

Answer selected by ymc9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants