Implement Typed IR - #504
Conversation
This will be replaced with `Symbol.erasedType`.
`Call`, `Lambda`, `Select`, and `DynSelect` is left for a future commit.
LPTK
left a comment
There was a problem hiding this comment.
Some possible next immediate steps:
- Update printer to show the erased types at variable and member declaration/definition sites.
- Update
Loweringso it generates erased types from parameter type annotations, to be used to annotate the correspondingVarSymbol. - Make sure we are never overriding an existing erased type in a given symbol by using
softAssert, as a sanity check.
A subtlety we should get right: the erasure of annotated class parameter types should successfully propagate to their defining fields. Param has a ``fldSym` which can be used for this.
| new Rewriter(instId).applyBlock(ogBody), | ||
| mkReturnCall(restFunSym, restFunArgs)) | ||
| val refreshedFvSymbols = dtorBranchFnFvs(branchId._1).map(s => s -> new VarSymbol(Tree.Ident(s"fv_${s.nme}"))) | ||
| val refreshedFvSymbols = dtorBranchFnFvs(branchId._1).map(s => s -> new VarSymbol(Tree.Ident(s"fv_${s.nme}"), erasedType = N)) |
There was a problem hiding this comment.
It seems many cases like this one should carry over the previous erasedType somehow.
|
The current task list (work items created by me, organized by AI):
|
What does that mean?
This should be moved to phase B. In fact, it's the first thing yoiu should do, just so you can actually see what you're doing! |
Good point, I have updated to task list. |
Refinement of types during Lowering is implemented later.
|
The core logic is mostly implemented - I will review the entire patchset's changes before marking it as ready. There are also several issues that needs to be clarified/fixed, namely:
|
Incorrect. The actual problem is that I think we have many places that use
No idea what you mena. Is this a WASM thing?
Just check who uses this |
Just to clarify, does
Yes, one example can be found in Note that while the function is typed to return The "unreachable type propagation" I was referring to will allow Wasm instructions and control flow structures to be
Right, I see. I can fix this first by copy-propagating the entire There was another idea that I was considering - Adding an Let me know what you think about this. |
WASM has to have explicit casts, so they will always be "checked" anyway. But perhaps when The easiest approach is probably to just have a backend-generic pass that adds these manual checks to the IR when
What is meant by "propagation", here? I'm worried to you start reintroducing some crazy type-inference-like process. Maybe the simpler approach would be for Lowering to insert Unreachable nodes whenever a unit value is found but something else is expected. (The type system will catch mistakes separately.)
Yeah, I don't think it makes much sense. Let's just (1) not propagated casted values; and (2) later implement an IR pass that removes unnecessary casts. That should be enough. Of course |
No description provided.