[SAOC 2025] Separate Semantic Routines from AST Nodes Weekly Update #13

Mohamed El Shorbagy mohrizq895 at gmail.com
Tue Dec 16 03:27:31 UTC 2025


# Summary of Progress (Dec. 08 - Dec. 15)

This week I was trying to break the dependency of AST nodes on 
`Type.nextOf` -- in particular in `func.d`. `nextOf` is 
problematic because it calls semantic to get the member type of 
an enum declaration, and it is used in two places inside 
`func.d`: `genCfunc`, which is trivial to handle (see 
[PR](https://github.com/dlang/dmd/pull/22222)), and the 
`FuncDeclaration` constructor, in which `nextOf` is called on the 
passed type to see whether we need to infer the return type and 
set the `inferRetType` flag (`type.nextOf()` should be the 
function return type). So, my initial solution was basically to 
replace each `.inferRetType` with a function call that first 
checks whether the flag has been set or not -- if not, it calls 
`nextOf` and marks it as computed; otherwise, it returns the 
value. This approach seems OK, but it fails in 4 or 5 tests due 
to an extra `void` in the delegate return type. This issue is 
coming from `hdrgen`, and I am trying to see how to solve it (see 
[PR](https://github.com/dlang/dmd/pull/22223)).


More information about the Digitalmars-d mailing list