Skip to content

fix: compiler identifying imported functions as being part of a contract#1112

Merged
kevaundray merged 2 commits intomasterfrom
jf/fix-module-scope
Apr 7, 2023
Merged

fix: compiler identifying imported functions as being part of a contract#1112
kevaundray merged 2 commits intomasterfrom
jf/fix-module-scope

Conversation

@jfecher
Copy link
Copy Markdown
Contributor

@jfecher jfecher commented Apr 6, 2023

…the module

Related issue(s)

Resolves #1111

Description

Summary of changes

Separates imported items in a module's scope from those originally defined within the module. Then we can use this separate list of items defined within the module to find all functions that should be part of the contract.

Previously we were using the module's scope which can include imported functions as well. I've separated these two constructs and made ModuleData more of an opaque wrapper to prevent this error in the future.

Dependency additions / changes

None

Test additions / changes

None

Checklist

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt with default settings.
  • I have linked this PR to the issue(s) that it resolves.
  • I have reviewed the changes on GitHub, line by line.
  • I have ensured all changes are covered in the description.

Documentation needs

  • This PR requires documentation updates when merged.

Additional context

Comment thread crates/noirc_frontend/src/hir/def_collector/dc_mod.rs
@kevaundray kevaundray changed the title Fix: compiler identifying imported functions as being part of a contract chore: compiler identifying imported functions as being part of a contract Apr 6, 2023
@kevaundray kevaundray changed the title chore: compiler identifying imported functions as being part of a contract fix: compiler identifying imported functions as being part of a contract Apr 6, 2023
@kevaundray kevaundray enabled auto-merge April 6, 2023 21:45
@kevaundray kevaundray added this pull request to the merge queue Apr 7, 2023
Merged via the queue into master with commit 61c38d2 Apr 7, 2023
@kevaundray kevaundray deleted the jf/fix-module-scope branch April 7, 2023 11:11
TomAFrench added a commit that referenced this pull request Apr 13, 2023
* master:
  feat(nargo)!: define preprocessed artifacts for programs/contracts (#1126)
  feat: import core logic in cli from `nargo` crate (#1142)
  chore: enforce `clippy::semicolon_if_nothing_returned` linting rule (#1139)
  chore: borrow instead of cloning witness vectors in IR gen (#1127)
  fix: compiler identifying imported functions as being part of a contract (#1112)
  feat: Add new `Vec` type to frontend (#1103)
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.

Compiler sees imported functions as being part of the contract

2 participants