diff --git a/crates/metaslang/cst/generated/public_api.txt b/crates/metaslang/cst/generated/public_api.txt index 83370fcc7c..dea44ae643 100644 --- a/crates/metaslang/cst/generated/public_api.txt +++ b/crates/metaslang/cst/generated/public_api.txt @@ -51,6 +51,22 @@ impl core::iter::traits::iterator::Iterator pub type metaslang_cst::cursor::CursorIterator::Item = metaslang_cst::nodes::Edge pub fn metaslang_cst::cursor::CursorIterator::next(&mut self) -> core::option::Option pub mod metaslang_cst::kinds +pub enum metaslang_cst::kinds::NodeKind +pub metaslang_cst::kinds::NodeKind::Nonterminal(::NonterminalKind) +pub metaslang_cst::kinds::NodeKind::Terminal(::TerminalKind) +impl core::clone::Clone for metaslang_cst::kinds::NodeKind where ::NonterminalKind: core::clone::Clone, ::TerminalKind: core::clone::Clone +pub fn metaslang_cst::kinds::NodeKind::clone(&self) -> metaslang_cst::kinds::NodeKind +impl core::cmp::Eq for metaslang_cst::kinds::NodeKind where ::NonterminalKind: core::cmp::Eq, ::TerminalKind: core::cmp::Eq +impl core::cmp::PartialEq for metaslang_cst::kinds::NodeKind where ::NonterminalKind: core::cmp::PartialEq, ::TerminalKind: core::cmp::PartialEq +pub fn metaslang_cst::kinds::NodeKind::eq(&self, other: &metaslang_cst::kinds::NodeKind) -> bool +impl core::fmt::Debug for metaslang_cst::kinds::NodeKind where ::NonterminalKind: core::fmt::Debug, ::TerminalKind: core::fmt::Debug +pub fn metaslang_cst::kinds::NodeKind::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result +impl core::marker::Copy for metaslang_cst::kinds::NodeKind where ::NonterminalKind: core::marker::Copy, ::TerminalKind: core::marker::Copy +impl core::convert::From> for &'static str +pub fn &'static str::from(val: metaslang_cst::kinds::NodeKind) -> Self +impl core::fmt::Display for metaslang_cst::kinds::NodeKind +pub fn metaslang_cst::kinds::NodeKind::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result +impl core::marker::StructuralPartialEq for metaslang_cst::kinds::NodeKind pub trait metaslang_cst::kinds::BaseKind: core::marker::Sized + core::fmt::Debug + core::marker::Copy + core::cmp::PartialEq + core::cmp::Eq + serde::ser::Serialize pub fn metaslang_cst::kinds::BaseKind::as_static_str(&self) -> &'static str pub fn metaslang_cst::kinds::BaseKind::try_from_str(str: &str) -> core::result::Result @@ -90,7 +106,7 @@ pub fn metaslang_cst::nodes::Node::is_terminal(&self) -> bool pub fn metaslang_cst::nodes::Node::is_terminal_with_kind(&self, kind: ::TerminalKind) -> bool pub fn metaslang_cst::nodes::Node::is_terminal_with_kinds(&self, kinds: &[::TerminalKind]) -> bool pub fn metaslang_cst::nodes::Node::is_trivia(&self) -> bool -pub fn metaslang_cst::nodes::Node::kind(&self) -> metaslang_cst::nodes::NodeKind +pub fn metaslang_cst::nodes::Node::kind(&self) -> metaslang_cst::kinds::NodeKind pub fn metaslang_cst::nodes::Node::nonterminal(kind: ::NonterminalKind, children: alloc::vec::Vec>) -> Self pub fn metaslang_cst::nodes::Node::terminal(kind: ::TerminalKind, text: alloc::string::String) -> Self pub fn metaslang_cst::nodes::Node::text_len(&self) -> metaslang_cst::text_index::TextIndex @@ -109,22 +125,6 @@ pub fn metaslang_cst::nodes::Node::from(terminal: alloc::rc::Rc core::marker::StructuralPartialEq for metaslang_cst::nodes::Node impl serde::ser::Serialize for metaslang_cst::nodes::Node where T: serde::ser::Serialize + metaslang_cst::kinds::KindTypes pub fn metaslang_cst::nodes::Node::serialize<__S>(&self, __serializer: __S) -> core::result::Result<<__S as serde::ser::Serializer>::Ok, <__S as serde::ser::Serializer>::Error> where __S: serde::ser::Serializer -pub enum metaslang_cst::nodes::NodeKind -pub metaslang_cst::nodes::NodeKind::Nonterminal(::NonterminalKind) -pub metaslang_cst::nodes::NodeKind::Terminal(::TerminalKind) -impl core::clone::Clone for metaslang_cst::nodes::NodeKind where ::NonterminalKind: core::clone::Clone, ::TerminalKind: core::clone::Clone -pub fn metaslang_cst::nodes::NodeKind::clone(&self) -> metaslang_cst::nodes::NodeKind -impl core::cmp::Eq for metaslang_cst::nodes::NodeKind where ::NonterminalKind: core::cmp::Eq, ::TerminalKind: core::cmp::Eq -impl core::cmp::PartialEq for metaslang_cst::nodes::NodeKind where ::NonterminalKind: core::cmp::PartialEq, ::TerminalKind: core::cmp::PartialEq -pub fn metaslang_cst::nodes::NodeKind::eq(&self, other: &metaslang_cst::nodes::NodeKind) -> bool -impl core::fmt::Debug for metaslang_cst::nodes::NodeKind where ::NonterminalKind: core::fmt::Debug, ::TerminalKind: core::fmt::Debug -pub fn metaslang_cst::nodes::NodeKind::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result -impl core::marker::Copy for metaslang_cst::nodes::NodeKind where ::NonterminalKind: core::marker::Copy, ::TerminalKind: core::marker::Copy -impl core::convert::From> for &'static str -pub fn &'static str::from(val: metaslang_cst::nodes::NodeKind) -> Self -impl core::fmt::Display for metaslang_cst::nodes::NodeKind -pub fn metaslang_cst::nodes::NodeKind::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result -impl core::marker::StructuralPartialEq for metaslang_cst::nodes::NodeKind pub struct metaslang_cst::nodes::Edge pub metaslang_cst::nodes::Edge::label: core::option::Option<::EdgeLabel> pub metaslang_cst::nodes::Edge::node: metaslang_cst::nodes::Node diff --git a/crates/solidity/outputs/cargo/crate/generated/public_api.txt b/crates/solidity/outputs/cargo/crate/generated/public_api.txt index 908b746e87..ab2e8d7acd 100644 --- a/crates/solidity/outputs/cargo/crate/generated/public_api.txt +++ b/crates/solidity/outputs/cargo/crate/generated/public_api.txt @@ -48,6 +48,7 @@ pub fn slang_solidity::compilation::InternalCompilationBuilder::create(language_ pub fn slang_solidity::compilation::InternalCompilationBuilder::resolve_import(&mut self, source_file_id: &str, import_path: &slang_solidity::cst::Cursor, destination_file_id: alloc::string::String) -> core::result::Result<(), ResolveImportError> pub mod slang_solidity::cst pub use slang_solidity::cst::EdgeLabelExtensions +pub use slang_solidity::cst::NodeKind pub use slang_solidity::cst::NonterminalKindExtensions pub use slang_solidity::cst::QueryError pub use slang_solidity::cst::TerminalKindExtensions diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_output/renderer.rs b/crates/solidity/outputs/cargo/tests/src/bindings_output/renderer.rs index dc762bfab0..92711989d2 100644 --- a/crates/solidity/outputs/cargo/tests/src/bindings_output/renderer.rs +++ b/crates/solidity/outputs/cargo/tests/src/bindings_output/renderer.rs @@ -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; } diff --git a/crates/solidity/testing/perf/src/tests/bindings_resolve.rs b/crates/solidity/testing/perf/src/tests/bindings_resolve.rs index 03437151b3..ec84c6c1dd 100644 --- a/crates/solidity/testing/perf/src/tests/bindings_resolve.rs +++ b/crates/solidity/testing/perf/src/tests/bindings_resolve.rs @@ -1,5 +1,6 @@ use std::rc::Rc; +use infra_utils::paths::PathExtensions; use slang_solidity::bindings::BindingGraph; use slang_solidity::cst::{NonterminalKind, TerminalKind}; @@ -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 { @@ -35,9 +36,12 @@ 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; } @@ -45,9 +49,11 @@ pub fn run(dependencies: BuiltBindingGraph) { && 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, ); } } diff --git a/crates/solidity/testing/sanctuary/src/tests.rs b/crates/solidity/testing/sanctuary/src/tests.rs index cbd90352a5..87a59f020f 100644 --- a/crates/solidity/testing/sanctuary/src/tests.rs +++ b/crates/solidity/testing/sanctuary/src/tests.rs @@ -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; }