Skip to content

Conversation

@FetBoba
Copy link

@FetBoba FetBoba commented Jan 18, 2026

Wasm backend crashes when classes defined in an outer scope are referenced inside nested functions (field access and class pattern matching). Fix: implemented lazy/on-demand creation/registration of top-level class struct types during lowering so the needed wasm type exists at each use site.

@Derppening
Copy link

Could you please add a description of what this specifically fixes and how you fixed the problem?

@LPTK
Copy link
Contributor

LPTK commented Jan 23, 2026

Please merge with upstream and address @Derppening's comment.

@FetBoba FetBoba closed this Jan 24, 2026
@FetBoba FetBoba reopened this Jan 24, 2026
@FetBoba
Copy link
Author

FetBoba commented Jan 24, 2026

Could you please add a description of what this specifically fixes and how you fixed the problem?

Ok. I added it to description of this pr.

@LPTK
Copy link
Contributor

LPTK commented Jan 24, 2026

Wasm backend crashes when classes defined in an outer scope are referenced inside nested functions (field access and class pattern matching). Fix: implemented lazy/on-demand creation/registration of top-level class struct types during lowering so the needed wasm type exists at each use site.

Why would we need this? It seems to me that you should just make one pass to register all the types of the program, and then a separate pass to generate the code of functions.

@FetBoba
Copy link
Author

FetBoba commented Jan 25, 2026

Why would we need this? It seems to me that you should just make one pass to register all the types of the program, and then a separate pass to generate the code of functions.

I thought that there might be some complications with correct order of registering types.

I will try to implement preregistering of all types. Also, by all types you mean top-level classes? Can you clarify this?

@LPTK
Copy link
Contributor

LPTK commented Jan 26, 2026

Also, by all types you mean top-level classes? Can you clarify this?

Yes. Not sure what else you think I could mean.

@LPTK LPTK requested a review from Derppening January 26, 2026 21:29
Copy link

@Derppening Derppening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the changes look good, please address the following comments.

Please also all brief documentation for new private functions.

@LPTK LPTK merged commit 50ab3df into hkust-taco:hkmc2 Feb 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants