Skip to content

Commit

Permalink
skip identifiers due to #1213 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarTawfik committed Jan 2, 2025
1 parent 3c4fb33 commit 856842b
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 26 deletions.
34 changes: 17 additions & 17 deletions crates/metaslang/cst/generated/public_api.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,12 @@ fn check_bindings_coverage<'a>(
{
if matches!(
cursor.ancestors().next(),
Some(ancestor) if ancestor.kind == NonterminalKind::ExperimentalFeature
) {
Some(ancestor)
// ignore identifiers in `pragma experimental` directives, as they are unbound feature names:
if ancestor.kind == NonterminalKind::ExperimentalFeature ||
// TODO(#1213): unbound named parameters in mapping types
ancestor.kind == NonterminalKind::MappingKey
) {
continue;
}

Expand Down
16 changes: 11 additions & 5 deletions crates/solidity/testing/perf/src/tests/bindings_resolve.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::rc::Rc;

use infra_utils::paths::PathExtensions;
use slang_solidity::bindings::BindingGraph;
use slang_solidity::cst::{NonterminalKind, TerminalKind};

Expand All @@ -11,7 +12,7 @@ pub struct BuiltBindingGraph {
}

pub fn setup() -> BuiltBindingGraph {
let files = super::bindings_build::setup();
let files = super::parser::run(super::parser::setup());
let binding_graph = super::bindings_build::run(files.clone());

BuiltBindingGraph {
Expand All @@ -35,19 +36,24 @@ pub fn run(dependencies: BuiltBindingGraph) {
]) {
if matches!(
cursor.ancestors().next(),
Some(ancestor) if ancestor.kind == NonterminalKind::ExperimentalFeature
) {
Some(ancestor)
// ignore identifiers in `pragma experimental` directives, as they are unbound feature names:
if ancestor.kind == NonterminalKind::ExperimentalFeature ||
// TODO(#1213): unbound named parameters in mapping types
ancestor.kind == NonterminalKind::MappingKey
) {
continue;
}

if binding_graph.definition_at(&cursor).is_none()
&& binding_graph.reference_at(&cursor).is_none()
{
panic!(
"Unbound identifier: '{value}' at '{range:?}'.",
"Unbound identifier: '{value}' in '{file_path}:{line}:{column}'.",
value = cursor.node().unparse(),
range = cursor.text_range()
file_path = file.path.unwrap_str(),
line = cursor.text_range().start.line + 1,
column = cursor.text_range().start.column + 1,
);
}
}
Expand Down
7 changes: 5 additions & 2 deletions crates/solidity/testing/sanctuary/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,12 @@ fn run_bindings_check(
{
if matches!(
cursor.ancestors().next(),
Some(ancestor) if ancestor.kind == NonterminalKind::ExperimentalFeature
) {
Some(ancestor)
// ignore identifiers in `pragma experimental` directives, as they are unbound feature names:
if ancestor.kind == NonterminalKind::ExperimentalFeature ||
// TODO(#1213): unbound named parameters in mapping types
ancestor.kind == NonterminalKind::MappingKey
) {
continue;
}

Expand Down

0 comments on commit 856842b

Please sign in to comment.