Skip to content

Proper compilation errors for resource constructor args and type parameters #1670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
May 31, 2025

Conversation

afsalthaj
Copy link
Contributor

@afsalthaj afsalthaj commented May 30, 2025

Fix #1584 and Fix #1583

Resource constructor related (2 issues)

Before

  • zero arguments to resource constructor when it expects an argument resulted in runtime errors (unlike usual function arguments) violating invariants.
image
  • Wrong type of argument to resource constructor compiles - and it fails at compile only at usage sites. Here let r = x.cart(1) is a success which is wrong. Also internal names getting exposed such as [constructor](..) in the error messages
image

After

image

Type Parameters related

Before

  • Wrong type parameters succeeded to later become unuseful (no autocomplete etc)
  • If used with API definition, this can even lead to errors such as function foo doesn't exist in golem:it/api while the actual error is golem:it/api2 doesn't exist
image

After

image

Along with these fixes, the function names(resource constructors, method names etc) in some of the error messages was fully qualified (or raw versions) such as [constructor]cart) and these are being fixed in this PR as well.

@afsalthaj afsalthaj changed the title Earlier mess Get compilation error messages at resource construction site than at the usage site May 30, 2025
@afsalthaj afsalthaj changed the title Get compilation error messages at resource construction site than at the usage site Get compilation error messages at resource construction site than at the resource usage site May 30, 2025
Nanashi-lab pushed a commit to Nanashi-lab/golem that referenced this pull request May 30, 2025
@afsalthaj afsalthaj changed the title Get compilation error messages at resource construction site than at the resource usage site Proper compilation errors for resource constructor args and type parameters May 30, 2025
@afsalthaj afsalthaj marked this pull request as ready for review May 30, 2025 18:30
@afsalthaj afsalthaj merged commit a1d1efd into main May 31, 2025
74 of 89 checks passed
@afsalthaj afsalthaj deleted the fix_1584 branch May 31, 2025 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants