Skip to content

add structure/invalid-using-directive-container diagnostic#1847

Open
OmarTawfik wants to merge 1 commit into
mainfrom
OmarTawfik/diagnose-using-directive-location
Open

add structure/invalid-using-directive-container diagnostic#1847
OmarTawfik wants to merge 1 commit into
mainfrom
OmarTawfik/diagnose-using-directive-location

Conversation

@OmarTawfik

Copy link
Copy Markdown
Contributor

Using directives are not allowed inside interfaces since Solidity 0.7.1.

@changeset-bot

changeset-bot Bot commented Jun 9, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 9c31a49

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

BranchOmarTawfik/diagnose-using-directive-location
Testbedci

⚠️ WARNING: Truncated view!

The full continuous benchmarking report exceeds the maximum length allowed on this platform.

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

🐰 View full continuous benchmarking report in Bencher

Using directives are not allowed inside interfaces since Solidity `0.7.1`.
@OmarTawfik OmarTawfik force-pushed the OmarTawfik/diagnose-using-directive-location branch from 23987f0 to 9c31a49 Compare June 9, 2026 11:47
@OmarTawfik OmarTawfik marked this pull request as ready for review June 9, 2026 12:15
@OmarTawfik OmarTawfik requested review from a team as code owners June 9, 2026 12:15

@teofr teofr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! LGTM

Just a sort of unrelated question

self.leave_scope_for_node_id(node.id());
}

fn enter_using_directive(&mut self, node: &ir::UsingDirective) -> bool {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We've sort of discussed about where to place validations in the codebase. Since this one is a free floating one (it could be anywhere), is there any reason to place it here?

Comment on lines +3 to +13
Parse errors:
Error: Using directives are only allowed at the file level, or inside contracts and libraries.
╭─[input.sol:5:5]
5 │ using Utils for Bar;
│ ──────────┬─────────
│ ╰─────────── Error occurred here.
───╯

------------------------------------------------------------------------

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Probably makes sense to remove this binding snapshot since it'd always fail in v2.

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