-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededir
Description
Currently, the ModuleBuilder::declare_function method updates the existing function declaration when a function with the same name is declared again. This behavior can unintentionally overwrite previous declarations, potentially leading to inconsistencies or unexpected behaviors in the module.
We propose changing this behavior so that declare_function returns a Result. If a function with the same name is already registered and its signature differs from the new declaration, the method should return an error instead of updating the existing declaration.
Proposed Changes:
-
Add
BuilderErrortype -
Modify Return Type:
- Change the return type of
ModuleBuilder::declare_functionto return aResult<Function, BuilderError>
- Change the return type of
-
Conflict Detection:
- Implement a check to determine if a function with the same name already exists.
- If it exists and the signature matches, return the existing function.
- If it exists and the signature differs, return an error indicating a conflicting declaration.
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededir