diff --git a/Cargo.lock b/Cargo.lock index e688fcbb3b..a5a2c96c1c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2437,7 +2437,6 @@ dependencies = [ "slang_solidity", "solidity_language", "strum_macros", - "thiserror", ] [[package]] diff --git a/crates/metaslang/bindings/generated/public_api.txt b/crates/metaslang/bindings/generated/public_api.txt index e0fe3e3212..e4b11e5bec 100644 --- a/crates/metaslang/bindings/generated/public_api.txt +++ b/crates/metaslang/bindings/generated/public_api.txt @@ -31,9 +31,7 @@ pub fn metaslang_bindings::BindingGraph::all_definitions(&self) -> impl core pub fn metaslang_bindings::BindingGraph::all_references(&self) -> impl core::iter::traits::iterator::Iterator> + '_ pub fn metaslang_bindings::BindingGraph::create(version: semver::Version, binding_rules: &str, path_resolver: alloc::rc::Rc>) -> Self pub fn metaslang_bindings::BindingGraph::definition_at(&self, cursor: &metaslang_cst::cursor::Cursor) -> core::option::Option> -pub fn metaslang_bindings::BindingGraph::get_context(&self) -> core::option::Option> pub fn metaslang_bindings::BindingGraph::reference_at(&self, cursor: &metaslang_cst::cursor::Cursor) -> core::option::Option> -pub fn metaslang_bindings::BindingGraph::set_context(&mut self, context: &metaslang_bindings::DefinitionHandle) pub struct metaslang_bindings::BuiltInLocation impl core::clone::Clone for metaslang_bindings::BuiltInLocation pub fn metaslang_bindings::BuiltInLocation::clone(&self) -> metaslang_bindings::BuiltInLocation @@ -47,7 +45,6 @@ pub fn metaslang_bindings::Definition<'a, KT>::get_definiens_cursor(&self) -> &m pub fn metaslang_bindings::Definition<'a, KT>::get_file(&self) -> metaslang_bindings::FileDescriptor pub fn metaslang_bindings::Definition<'a, KT>::id(&self) -> usize pub fn metaslang_bindings::Definition<'a, KT>::name_location(&self) -> metaslang_bindings::BindingLocation -pub fn metaslang_bindings::Definition<'a, KT>::to_handle(self) -> metaslang_bindings::DefinitionHandle impl<'a, KT: core::clone::Clone + metaslang_cst::kinds::KindTypes + 'static> core::clone::Clone for metaslang_bindings::Definition<'a, KT> pub fn metaslang_bindings::Definition<'a, KT>::clone(&self) -> metaslang_bindings::Definition<'a, KT> impl core::cmp::Eq for metaslang_bindings::Definition<'_, KT> @@ -59,7 +56,6 @@ impl core::fmt::Display for metas pub fn metaslang_bindings::Definition<'_, KT>::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result impl core::hash::Hash for metaslang_bindings::Definition<'_, KT> pub fn metaslang_bindings::Definition<'_, KT>::hash(&self, state: &mut H) -pub struct metaslang_bindings::DefinitionHandle(_) pub struct metaslang_bindings::Reference<'a, KT: metaslang_cst::kinds::KindTypes + 'static> impl<'a, KT: metaslang_cst::kinds::KindTypes + 'static> metaslang_bindings::Reference<'a, KT> pub fn metaslang_bindings::Reference<'a, KT>::definitions(&self) -> alloc::vec::Vec> @@ -67,7 +63,6 @@ pub fn metaslang_bindings::Reference<'a, KT>::get_cursor(&self) -> &metaslang_cs pub fn metaslang_bindings::Reference<'a, KT>::get_file(&self) -> metaslang_bindings::FileDescriptor pub fn metaslang_bindings::Reference<'a, KT>::id(&self) -> usize pub fn metaslang_bindings::Reference<'a, KT>::location(&self) -> metaslang_bindings::BindingLocation -pub fn metaslang_bindings::Reference<'a, KT>::resolve_definition(&self) -> core::result::Result, metaslang_bindings::ResolutionError<'a, KT>> impl<'a, KT: core::clone::Clone + metaslang_cst::kinds::KindTypes + 'static> core::clone::Clone for metaslang_bindings::Reference<'a, KT> pub fn metaslang_bindings::Reference<'a, KT>::clone(&self) -> metaslang_bindings::Reference<'a, KT> impl core::cmp::PartialEq for metaslang_bindings::Reference<'_, KT> diff --git a/crates/metaslang/bindings/src/builder/mod.rs b/crates/metaslang/bindings/src/builder/mod.rs index f768302d52..77943da877 100644 --- a/crates/metaslang/bindings/src/builder/mod.rs +++ b/crates/metaslang/bindings/src/builder/mod.rs @@ -245,27 +245,6 @@ //! //! ### Other node attributes introduced in Slang's usage of stack-graphs //! -//! #### `tag` attribute -//! -//! This is used to attach a specific meaning to the node, to alter the ranking -//! algorithm used when attempting to disambiguate between multiple definitions -//! found for a reference. This is an optional string attribute. -//! -//! Possible values: -//! -//! - "alias": marks a definition node as a semantic alias of another definition -//! (eg. an import alias) -//! -//! - "c3": used to mark a function/method definition to be a candidate in -//! disambiguation using the C3 linearisation algorithm. In order for C3 -//! linearisation to be possible, type hierarchy attributes need to be provided -//! as well (see `parents` attribute below). -//! -//! - "super": marks a reference as a call to super virtual call. This modifies -//! the C3 linearisation algorithm by eliminating the candidates that are at -//! or further down the hierarchy of where the reference occurs. To determine -//! where the reference occurs, we also use the `parents` attribute. -//! //! #### `parents` attribute //! //! Is used to convey semantic hierarchy. Can be applied to both definitions and @@ -278,20 +257,6 @@ //! later case, generally speaking they will need to be resolved at resolution //! time in order to be useful. //! -//! #### `export_node` and `import_nodes` -//! -//! These are used to define static fixed edges to add via `set_context()`. -//! Using `set_context()` will modify the underlying stack graph by inserting -//! edges from the `import_nodes` of all parents (resolved recursively) of the -//! given context, to the `export_node` associated with the context. -//! -//! This can be used to inject virtual method implementations defined in -//! subclasses in the scope of their parent classes, which are otherwise -//! lexically inaccessible. -//! -//! `export_node` is an optional graph node attribute, and `import_nodes` is an -//! optional list of graph nodes. Both apply only to definition nodes. -//! //! #### `extension_hook`, `extension_scope` and `inherit_extensions` //! //! These attributes enable the bindings API to resolve extension methods by @@ -328,7 +293,7 @@ use stack_graphs::arena::Handle; use stack_graphs::graph::{File, Node, NodeID, StackGraph}; use thiserror::Error; -use crate::{DefinitionBindingInfo, ReferenceBindingInfo, Tag}; +use crate::{DefinitionBindingInfo, ReferenceBindingInfo}; // Node type values static DROP_SCOPES_TYPE: &str = "drop_scopes"; @@ -342,8 +307,6 @@ static SCOPE_TYPE: &str = "scope"; static DEBUG_ATTR_PREFIX: &str = "debug_"; static DEFINIENS_NODE_ATTR: &str = "definiens_node"; static EMPTY_SOURCE_SPAN_ATTR: &str = "empty_source_span"; -static EXPORT_NODE_ATTR: &str = "export_node"; -static IMPORT_NODES_ATTR: &str = "import_nodes"; static IS_DEFINITION_ATTR: &str = "is_definition"; static IS_ENDPOINT_ATTR: &str = "is_endpoint"; static IS_EXPORTED_ATTR: &str = "is_exported"; @@ -356,7 +319,6 @@ static SCOPE_ATTR: &str = "scope"; static SOURCE_NODE_ATTR: &str = "source_node"; static SYMBOL_ATTR: &str = "symbol"; static SYNTAX_TYPE_ATTR: &str = "syntax_type"; -static TAG_ATTR: &str = "tag"; static TYPE_ATTR: &str = "type"; // Expected attributes per node type @@ -366,10 +328,7 @@ static POP_SCOPED_SYMBOL_ATTRS: Lazy> = Lazy::new(|| { SYMBOL_ATTR, IS_DEFINITION_ATTR, DEFINIENS_NODE_ATTR, - TAG_ATTR, PARENTS_ATTR, - EXPORT_NODE_ATTR, - IMPORT_NODES_ATTR, SYNTAX_TYPE_ATTR, EXTENSION_SCOPE_ATTR, INHERIT_EXTENSIONS_ATTR, @@ -381,10 +340,7 @@ static POP_SYMBOL_ATTRS: Lazy> = Lazy::new(|| { SYMBOL_ATTR, IS_DEFINITION_ATTR, DEFINIENS_NODE_ATTR, - TAG_ATTR, PARENTS_ATTR, - EXPORT_NODE_ATTR, - IMPORT_NODES_ATTR, SYNTAX_TYPE_ATTR, EXTENSION_SCOPE_ATTR, INHERIT_EXTENSIONS_ATTR, @@ -396,19 +352,11 @@ static PUSH_SCOPED_SYMBOL_ATTRS: Lazy> = Lazy::new(|| { SYMBOL_ATTR, SCOPE_ATTR, IS_REFERENCE_ATTR, - TAG_ATTR, - PARENTS_ATTR, - ]) -}); -static PUSH_SYMBOL_ATTRS: Lazy> = Lazy::new(|| { - HashSet::from([ - TYPE_ATTR, - SYMBOL_ATTR, - IS_REFERENCE_ATTR, - TAG_ATTR, PARENTS_ATTR, ]) }); +static PUSH_SYMBOL_ATTRS: Lazy> = + Lazy::new(|| HashSet::from([TYPE_ATTR, SYMBOL_ATTR, IS_REFERENCE_ATTR, PARENTS_ATTR])); static SCOPE_ATTRS: Lazy> = Lazy::new(|| { HashSet::from([ TYPE_ATTR, @@ -596,8 +544,6 @@ pub enum BuildError { ExecutionError(ExecutionError), #[error("Expected exported symbol scope in {0}, got {1}")] SymbolScopeError(String, String), - #[error("Unknown tag ‘{0}’")] - UnknownTag(String), #[error("Parent must be either a reference or definition")] InvalidParent(GraphNodeRef), } @@ -940,16 +886,6 @@ impl<'a, KT: KindTypes> Builder<'a, KT> { None => Vec::new(), }; - let tag = match node.attributes.get(TAG_ATTR) { - Some(tag_value) => Some(match tag_value.as_str()? { - "alias" => Tag::Alias, - "c3" => Tag::C3, - "super" => Tag::Super, - other_type => return Err(BuildError::UnknownTag(other_type.to_string())), - }), - None => None, - }; - if stack_graph_node.is_definition() { let definiens = match node.attributes.get(DEFINIENS_NODE_ATTR) { Some(definiens_node) => { @@ -960,26 +896,6 @@ impl<'a, KT: KindTypes> Builder<'a, KT> { None => None, }; - let export_node = match node.attributes.get(EXPORT_NODE_ATTR) { - Some(export_node) => { - Some(self.node_handle_for_graph_node(export_node.as_graph_node_ref()?)) - } - None => None, - }; - - let import_nodes = match node.attributes.get(IMPORT_NODES_ATTR) { - Some(import_nodes) => import_nodes - .as_list()? - .iter() - .flat_map(|value| { - value - .as_graph_node_ref() - .map(|id| self.node_handle_for_graph_node(id)) - }) - .collect(), - None => Vec::new(), - }; - let extension_scope = match node.attributes.get(EXTENSION_SCOPE_ATTR) { Some(extension_scope) => { Some(self.node_handle_for_graph_node(extension_scope.as_graph_node_ref()?)) @@ -993,17 +909,14 @@ impl<'a, KT: KindTypes> Builder<'a, KT> { node_handle, DefinitionBindingInfo { definiens, - tag, parents, - export_node, - import_nodes, extension_scope, inherit_extensions, }, ); } else if stack_graph_node.is_reference() { self.references_info - .insert(node_handle, ReferenceBindingInfo { tag, parents }); + .insert(node_handle, ReferenceBindingInfo { parents }); } if Self::load_flag(node, EXTENSION_HOOK_ATTR)? { diff --git a/crates/metaslang/bindings/src/lib.rs b/crates/metaslang/bindings/src/lib.rs index e830f97004..1588e48bdc 100644 --- a/crates/metaslang/bindings/src/lib.rs +++ b/crates/metaslang/bindings/src/lib.rs @@ -23,27 +23,14 @@ type CursorID = usize; pub use location::{BindingLocation, BuiltInLocation, UserFileLocation}; -pub struct DefinitionHandle(GraphHandle); - -#[derive(Clone, Copy, Debug, PartialEq, Eq)] -pub(crate) enum Tag { - Alias, - C3, - Super, -} - pub(crate) struct DefinitionBindingInfo { definiens: Option>, - tag: Option, parents: Vec, - export_node: Option, - import_nodes: Vec, extension_scope: Option, inherit_extensions: bool, } pub(crate) struct ReferenceBindingInfo { - tag: Option, parents: Vec, } @@ -56,7 +43,6 @@ pub struct BindingGraph { references_info: HashMap, cursor_to_definitions: HashMap, cursor_to_references: HashMap, - context: Option, extension_hooks: HashSet, } @@ -140,7 +126,6 @@ impl BindingGraph { references_info: HashMap::new(), cursor_to_definitions: HashMap::new(), cursor_to_references: HashMap::new(), - context: None, extension_hooks: HashSet::new(), } } @@ -257,85 +242,16 @@ impl BindingGraph { // either definitions or references handles .iter() - .filter_map(|handle| { + .flat_map(|handle| { if self.stack_graph[*handle].is_definition() { - self.to_definition(*handle) + vec![self.to_definition(*handle).unwrap()] } else { - self.to_reference(*handle)?.non_recursive_resolve().ok() + self.to_reference(*handle).unwrap().non_recursive_resolve() } }) .collect() } - pub fn get_context(&self) -> Option> { - self.context.and_then(|handle| self.to_definition(handle)) - } - - pub fn set_context(&mut self, context: &DefinitionHandle) { - assert!( - self.context.is_none(), - "Changing current binding context is not supported" - ); - let context_handle = context.0; - - assert!( - self.to_definition(context_handle).is_some(), - "Not a definition" - ); - self.context = Some(context_handle); - - // Retrieve export node from context - let Some(info) = self.definitions_info.get(&context_handle) else { - // no extra information for the definition; this shouldn't happen, - // but in that case we have nothing else to do - return; - }; - let Some(export_node) = info.export_node else { - // no export node in the context definition - return; - }; - - // Find all parents of the context - let all_parents = self.find_all_parents(context_handle); - - // Add stack graph edges to link to import nodes in all parents. This - // makes definitions in the export node scope reachable directly from - // all import nodes in all the parents. - for parent in &all_parents { - let Some(parent_info) = self.definitions_info.get(parent) else { - continue; - }; - for import_node in &parent_info.import_nodes { - self.stack_graph.add_edge(*import_node, export_node, 0); - } - } - } - - fn find_all_parents(&self, definition_handle: GraphHandle) -> HashSet { - let mut results = HashSet::new(); - let mut resolve_queue = Vec::new(); - resolve_queue.push(definition_handle); - - while let Some(definition) = resolve_queue.pop() { - let Some(definition_parents) = self - .definitions_info - .get(&definition) - .map(|info| &info.parents) - else { - continue; - }; - - let parents = self.resolve_handles(definition_parents); - for parent in &parents { - if !results.contains(&parent.handle) { - resolve_queue.push(parent.handle); - } - results.insert(parent.handle); - } - } - results - } - pub(crate) fn is_extension_hook(&self, node_handle: GraphHandle) -> bool { self.extension_hooks.contains(&node_handle) } @@ -413,14 +329,6 @@ impl<'a, KT: KindTypes + 'static> Definition<'a, KT> { .expect("Definition does not have a valid file descriptor") } - pub(crate) fn has_tag(&self, tag: Tag) -> bool { - self.owner - .definitions_info - .get(&self.handle) - .and_then(|info| info.tag) - .is_some_and(|definition_tag| definition_tag == tag) - } - pub(crate) fn resolve_parents(&self) -> Vec> { self.owner .definitions_info @@ -443,10 +351,6 @@ impl<'a, KT: KindTypes + 'static> Definition<'a, KT> { .get(&self.handle) .map_or(false, |info| info.inherit_extensions) } - - pub fn to_handle(self) -> DefinitionHandle { - DefinitionHandle(self.handle) - } } impl Display for Definition<'_, KT> { @@ -525,28 +429,14 @@ impl<'a, KT: KindTypes + 'static> Reference<'a, KT> { .expect("Reference does not have a valid file descriptor") } - pub fn resolve_definition(&self) -> Result, ResolutionError<'a, KT>> { - Resolver::build_for(self, ResolveOptions::Full).first() - } - pub fn definitions(&self) -> Vec> { Resolver::build_for(self, ResolveOptions::Full).all() } - pub(crate) fn non_recursive_resolve( - &self, - ) -> Result, ResolutionError<'a, KT>> { + pub(crate) fn non_recursive_resolve(&self) -> Vec> { // This was likely originated from a full resolution call, so cut // recursion here by restricting the resolution algorithm. - Resolver::build_for(self, ResolveOptions::NonRecursive).first() - } - - pub(crate) fn has_tag(&self, tag: Tag) -> bool { - self.owner - .references_info - .get(&self.handle) - .and_then(|info| info.tag) - .is_some_and(|reference_tag| reference_tag == tag) + Resolver::build_for(self, ResolveOptions::NonRecursive).all() } pub(crate) fn resolve_parents(&self) -> Vec> { diff --git a/crates/metaslang/bindings/src/resolver/c3.rs b/crates/metaslang/bindings/src/resolver/c3.rs deleted file mode 100644 index ae97ba945b..0000000000 --- a/crates/metaslang/bindings/src/resolver/c3.rs +++ /dev/null @@ -1,244 +0,0 @@ -use std::collections::{HashMap, VecDeque}; -use std::fmt::{Debug, Display}; -use std::hash::Hash; - -/// Produces a linearisation of a hierarchy of items using the C3 linearisation -/// algorithm. Given an item `A` with parents `(B1, B2)` in that order, the -/// linearisation of A can be defined as: -/// ``` -/// L(A) = [A] + merge(L(B1), L(B2), [B1, B2]) -/// ``` -/// The merge operation (defined below) will order the items of the vectors by -/// taking candidates that can only appear in the first position in all of the -/// vectors. -/// NOTE: parents are considered left-to-right as in the traditional C3 -/// linearisation algorithm, ie. Python style. -pub(crate) fn linearise( - target: &Item, - parents: &HashMap>, -) -> Option> { - let mut linearisations: HashMap> = HashMap::new(); - - // Keeps a running queue of pending linearisations. - let mut queue: VecDeque = VecDeque::new(); - queue.push_back(target.clone()); - - // When an item cannot be resolved, we save it here along the number of - // items already linearised. If we fail to linearise a second time, we use - // this to check if progress was made to avoid infinite loops with cycles. - let mut checkpoint = None; - - while let Some(item) = queue.pop_front() { - if linearisations.contains_key(&item) { - continue; - } - let item_parents = &parents[&item]; - let mut merge_set = Vec::new(); - for parent in item_parents { - match linearisations.get(parent) { - Some(parent_linearisation) => { - merge_set.push(parent_linearisation.clone()); - } - None => { - // Queue the parent with missing linearisation at the front to - // resolve it first (unless it's already queued) - if !queue.iter().any(|queued| queued == parent) { - queue.push_front(parent.clone()); - } - } - } - } - if merge_set.len() == item_parents.len() { - merge_set.push(item_parents.clone()); - let Some(merge_result) = merge(merge_set) else { - // Failed to linearise the current item; linearisation is not possible. - eprintln!("Linearisation of {item} failed"); - return None; - }; - - let mut result = Vec::new(); - result.push(item.clone()); - result.extend(merge_result); - - // Clear checkpoint if we just linearised it. - if matches!(checkpoint, Some((ref check_item, _)) if *check_item == item) { - checkpoint = None; - } - - linearisations.insert(item, result); - } else { - // We're missing linearisations of some parents, so re-enqueue the - // current item at the end and try again later, after hopefully - // recursively resolving the linearisation of the parents. - match checkpoint { - Some((ref check_item, items_linearised)) => { - if *check_item == item { - if items_linearised == linearisations.len() { - // no progress since last checkpoint; this indicates a cycle - eprintln!("Linearisation of {item} failed: cycle detected"); - return None; - } - // Update progress and re-try - checkpoint = Some((item.clone(), linearisations.len())); - } - } - None => { - // Create a checkpoint on the item we couldn't yet linearise. - checkpoint = Some((item.clone(), linearisations.len())); - } - } - queue.push_back(item); - } - } - - linearisations.remove(target) -} - -/// Merges the items in the set in C3 linearisation order. Returns None if -/// linearisation is not possible. -/// NOTE: Because we're dealing with vectors, we will be taking candidates from -/// the tails with `pop()` as it's more convenient, we will reverse all the -/// inputs. Both the inputs and the result are returned in natural order. -fn merge(mut set: Vec>) -> Option> { - set = set - .into_iter() - .filter_map(|mut subset| { - if subset.is_empty() { - None - } else { - subset.reverse(); - Some(subset) - } - }) - .collect(); - if set.is_empty() { - // Nothing to merge; this happens when linearising an item without parents - return Some(Vec::new()); - } - - let mut result = Vec::new(); - while let Some(found) = find_candidate(&set) { - set = remove_candidate_from_set(set, &found); - result.push(found); - } - // If set is empty, we successfully merged the set. - // Otherwise, linearisation is not possible. - if set.is_empty() { - Some(result) - } else { - None - } -} - -// Find a candidate in a set. A valid candidate can only appear in the last -// position in any vector in the set. -fn find_candidate(set: &Vec>) -> Option { - for subset in set { - let Some(candidate) = subset.last() else { - continue; - }; - if set.iter().all( - |subset| match subset.iter().position(|item| item == candidate) { - Some(position) => position == subset.len() - 1, - None => true, - }, - ) { - return Some(candidate.clone()); - } - } - None -} - -// Removes a candidate from the set. It should be a valid candidate, so it can -// only appear in the last position in each vector in the set. Removes empty -// vectors and returns the updated set. -fn remove_candidate_from_set( - set: Vec>, - element: &Item, -) -> Vec> { - set.into_iter() - .filter_map(|mut subset| { - if subset.last().expect("every vector in the set is not empty") == element { - subset.pop(); - } - if subset.is_empty() { - None - } else { - Some(subset) - } - }) - .collect() -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_merge_no_elements() { - assert_eq!(Some(vec![]), merge::<()>(vec![vec![]])); - } - - #[test] - fn test_merge_single_parent() { - assert_eq!(Some(vec!['A']), merge(vec![vec!['A'], vec!['A']])); - } - - #[test] - fn test_merge_two_parents() { - assert_eq!( - Some(vec!['A', 'B']), - merge(vec![vec!['A'], vec!['B'], vec!['A', 'B']]) - ); - } - - #[test] - fn test_merge_not_linearisable() { - assert_eq!(None, merge(vec![vec!['A', 'X'], vec![], vec!['X', 'A']])); - } - - #[test] - fn test_linearise() { - let mut parents = HashMap::new(); - parents.insert('A', vec![]); - parents.insert('B', vec!['A']); - parents.insert('C', vec!['A']); - parents.insert('D', vec!['B', 'C']); - parents.insert('E', vec!['C', 'B']); - - assert_eq!(Some(vec!['D', 'B', 'C', 'A']), linearise(&'D', &parents)); - assert_eq!(Some(vec!['E', 'C', 'B', 'A']), linearise(&'E', &parents)); - } - - #[test] - fn test_linearise_not_linearisable() { - let mut parents = HashMap::new(); - parents.insert('X', vec![]); - parents.insert('A', vec!['X']); - parents.insert('C', vec!['X', 'A']); - - assert_eq!(None, linearise(&'C', &parents)); - } - - #[test] - fn test_linearise_with_shallow_cycles() { - let mut parents = HashMap::new(); - parents.insert('B', vec!['A']); - parents.insert('A', vec!['B']); - - assert_eq!(None, linearise(&'A', &parents)); - assert_eq!(None, linearise(&'B', &parents)); - } - - #[test] - fn test_linearise_with_deep_cycles() { - let mut parents = HashMap::new(); - parents.insert('X', vec!['Y']); - parents.insert('Y', vec!['Z']); - parents.insert('Z', vec!['X']); - - assert_eq!(None, linearise(&'X', &parents)); - assert_eq!(None, linearise(&'Y', &parents)); - assert_eq!(None, linearise(&'Z', &parents)); - } -} diff --git a/crates/metaslang/bindings/src/resolver/mod.rs b/crates/metaslang/bindings/src/resolver/mod.rs index bcd01dc3b7..0faec8248c 100644 --- a/crates/metaslang/bindings/src/resolver/mod.rs +++ b/crates/metaslang/bindings/src/resolver/mod.rs @@ -9,9 +9,7 @@ use stack_graphs::stitching::{ }; use stack_graphs::CancellationError; -use crate::{BindingGraph, Definition, FileHandle, GraphHandle, Reference, ResolutionError, Tag}; - -mod c3; +use crate::{BindingGraph, Definition, FileHandle, GraphHandle, Reference}; /// The resolver executes algorithms to resolve a reference to one or more /// definitions. The reference may not be resolvable in the current state of the @@ -30,17 +28,11 @@ mod c3; /// 2. Virtual methods: a reference should find valid paths to all available /// definitions in a class hierarchy. /// -/// The multiple definitions can be ranked by one or more secondary algorithms -/// to be applied by this resolver. For example, an alias import definition -/// would be downgraded, allowing the resolver to prefer the actual definition -/// if found (it may not be available yet). Or a topological ordering may be -/// applied to definitions pointing to virtual methods. -/// pub(crate) struct Resolver<'a, KT: KindTypes + 'static> { owner: &'a BindingGraph, reference: Reference<'a, KT>, partials: PartialPaths, - results: Vec>, + results: Vec>, options: ResolveOptions, } @@ -50,18 +42,6 @@ pub(crate) enum ResolveOptions { NonRecursive, } -struct ResolvedPath<'a, KT: KindTypes + 'static> { - pub partial_path: PartialPath, - pub definition: Definition<'a, KT>, - pub score: f32, -} - -impl<'a, KT: KindTypes + 'static> ResolvedPath<'a, KT> { - pub fn len(&self) -> usize { - self.partial_path.edges.len() - } -} - /// Candidates for the forward stitching resolution process. This will inject /// edges to the the given extensions scopes at extension hook nodes when asked /// for forward candidates (ie. `get_forward_candidates`) by the resolution @@ -197,148 +177,18 @@ impl<'a, KT: KindTypes + 'static> Resolver<'a, KT> { .iter() .all(|other| !other.shadows(&mut self.partials, reference_path)) { - self.results.push(ResolvedPath { - definition: self - .owner + self.results.push( + self.owner .to_definition(end_node) .expect("path to end in a definition node"), - partial_path: reference_path.clone(), - score: 0.0, - }); + ); added_nodes.insert(end_node); } } } - pub fn all(&self) -> Vec> { + pub fn all(self) -> Vec> { self.results - .iter() - .map(|path| path.definition.clone()) - .collect() - } - - pub fn first(&mut self) -> Result, ResolutionError<'a, KT>> { - if self.results.len() > 1 { - self.rank_results(); - - let top_score = self.results[0].score; - let mut results = self - .results - .iter() - .take_while(|result| (result.score - top_score).abs() < f32::EPSILON) - .map(|result| result.definition.clone()) - .collect::>(); - if results.len() > 1 { - Err(ResolutionError::AmbiguousDefinitions(results)) - } else { - Ok(results.swap_remove(0)) - } - } else { - self.results - .first() - .map(|path| path.definition.clone()) - .ok_or(ResolutionError::Unresolved) - } - } - - fn rank_results(&mut self) { - if self.results.is_empty() { - return; - } - self.mark_down_aliases(); - self.mark_down_built_ins(); - if self.options == ResolveOptions::Full { - self.rank_c3_methods(); - } - self.results.sort_by(|a, b| b.score.total_cmp(&a.score)); - } - - fn mark_down_aliases(&mut self) { - // compute min and max path lengths - let (min_len, max_len) = - self.results - .iter() - .fold((usize::MAX, usize::MIN), |(min_len, max_len), result| { - let len = result.len(); - (min_len.min(len), max_len.max(len)) - }); - - for result in &mut self.results { - // mark down alias definitions - #[allow(clippy::cast_precision_loss)] - if result.definition.has_tag(Tag::Alias) { - result.score -= 100.0; - - // but prioritize longer paths so that we can still return a - // result if we only have multiple aliases as possible - // definitions - result.score += (result.len() - min_len) as f32 / (1 + max_len - min_len) as f32; - } - } - } - - fn mark_down_built_ins(&mut self) { - for result in &mut self.results { - if result.definition.get_file().is_system() { - result.score -= 200.0; - } - } - } - - fn rank_c3_methods(&mut self) { - // compute the linearisation to use for ranking - let caller_parents = self.reference.resolve_parents(); - let Some(caller_context) = caller_parents.first() else { - // the reference does not provide an enclosing definition, so nothing to do here - return; - }; - - // if the bindings has some context set, use it instead of the caller's - // to compute the full linearised ordering of methods - let resolution_context = match self.owner.get_context() { - Some(context) => context, - None => caller_context.clone(), - }; - - #[allow(clippy::mutable_key_type)] - let parents = Self::resolve_parents_all(resolution_context.clone()); - - let Some(mro) = c3::linearise(&resolution_context, &parents) else { - // linearisation failed - eprintln!("Linearisation of {resolution_context} failed"); - return; - }; - - let caller_context_index = mro.iter().position(|x| x == caller_context); - let super_call = self.reference.has_tag(Tag::Super); - - // Mark up user methods tagged C3 according to the computed linearisation. - // Because only contract functions are marked with the C3 tag, this has - // the added benefit of prioritizing them over globally defined - // functions. - for result in &mut self.results { - if result.definition.has_tag(Tag::C3) && result.definition.get_file().is_user() { - let definition_parents = result.definition.resolve_parents(); - let Some(definition_context) = definition_parents.first() else { - // this should not normally happen: the definition is tagged - // with the C3 selector but does not provide a resolvable - // enclosing definition - continue; - }; - - // find the definition context in the linearised result - #[allow(clippy::cast_precision_loss)] - if let Some(index) = mro.iter().position(|x| x == definition_context) { - // if this is a super call, ignore all implementations at or - // before (as in more derived) than the caller's - if !super_call - || (caller_context_index.is_none() || index > caller_context_index.unwrap()) - { - result.score += 100.0 * (mro.len() - index) as f32; - } - } - } - } } #[allow(clippy::mutable_key_type)] diff --git a/crates/solidity/inputs/language/bindings/rules.msgb b/crates/solidity/inputs/language/bindings/rules.msgb index f6b54ffcf2..9139aa190f 100644 --- a/crates/solidity/inputs/language/bindings/rules.msgb +++ b/crates/solidity/inputs/language/bindings/rules.msgb @@ -93,6 +93,8 @@ inherit .star_extension )] ]] { edge @source_unit.lexical_scope -> @unit_member.def + attr (@source_unit.lexical_scope -> @unit_member.def) precedence = 1 + edge @source_unit.defs -> @unit_member.def ; In the general case, the lexical scope of the definition connects directly @@ -239,7 +241,6 @@ inherit .star_extension node def attr (def) node_definition = @name attr (def) definiens_node = @symbol - attr (def) tag = "alias" ; deprioritize this definition edge @symbol.def -> def node import @@ -256,7 +257,6 @@ inherit .star_extension node def attr (def) node_definition = @alias attr (def) definiens_node = @symbol - attr (def) tag = "alias" ; deprioritize this definition edge @symbol.def -> def node import @@ -344,6 +344,7 @@ inherit .star_extension attr (@contract.def) extension_scope = @contract.extensions edge @contract.lexical_scope -> @contract.instance + attr (@contract.lexical_scope -> @contract.instance) precedence = 1 ; Instance scope can also see members and our namespace definitions edge @contract.instance -> @contract.members @@ -442,31 +443,6 @@ inherit .star_extension edge @contract.def -> type edge type -> type_contract_type edge type_contract_type -> @contract.parent_scope - - ; The following defines the connection nodes the resolution algorithm uses - ; *only when setting a compilation context/target*. - - ; This attribute defines the sink of edges added from base contracts when - ; setting this contract as the compilation context, and should provide access - ; to anything that can be reached through `super`. The instance scope is a bit - ; too broad, but `.members` is too narrow as it doesn't allow navigation to - ; parent contracts (and from the base we need to be able to reach all - ; contracts in the hierarchy). - attr (@contract.def) export_node = @contract.instance - - ; This node will eventually connect to the contract's members being compiled - ; and grants access to definitions in that contract and all its parents - ; (recursively). It only makes sense if `super` is defined (ie. if we have - ; parents), but we define it here to be able to use it in the declaration of - ; import nodes. This is the dual of the export_node above. - node @contract.super_import - attr (@contract.super_import) pop_symbol = "." - - ; This defines the source side of edges added to base contracts when setting - ; a contract as compilation context; this allows this contract (a base) to - ; access virtual methods in any sub-contract defined in the hierarchy (both - ; with and without `super`, hence the two connection points). - attr (@contract.def) import_nodes = [@contract.lexical_scope, @contract.super_import] } @contract [ContractDefinition @specifier [InheritanceSpecifier]] { @@ -489,17 +465,16 @@ inherit .star_extension attr (@contract.super) pop_symbol = "super" edge @contract.lexical_scope -> @contract.super - ; This connects `super` to exported scopes from all contracts in the hierarchy - ; when setting a contract compilation target (see more detailed description - ; above on the definition of the `super_import` node). - edge @contract.super -> @contract.super_import + node @contract.super_dot + attr (@contract.super_dot) pop_symbol = "." + edge @contract.super -> @contract.super_dot ; Then connect it through an `@instance` guard to the parent contracts through ; `super_scope`. This allows "instance"-like access to members of parents ; through `super`. node super_instance attr (super_instance) push_symbol = "@instance" - edge @contract.super_import -> super_instance + edge @contract.super_dot -> super_instance edge super_instance -> @contract.super_scope } @@ -589,7 +564,6 @@ inherit .star_extension ;; This may prioritize this definition (when there are multiple options) ;; according to the C3 linerisation ordering - attr (@function.def) tag = "c3" attr (@function.def) parents = [@contract.def] } @@ -611,7 +585,6 @@ inherit .star_extension ;; This may prioritize this definition (when there are multiple options) ;; according to the C3 linerisation ordering - attr (@modifier.def) tag = "c3" attr (@modifier.def) parents = [@contract.def] } @@ -2358,15 +2331,6 @@ inherit .star_extension edge member -> @expr.star_extension } -;; Special case: member accesses to `super` are tagged with "super" to rank -;; virtual methods correctly -[MemberAccessExpression - operand: [Expression [SuperKeyword]] - @name member: [Identifier] -] { - attr (@name.ref) tag = "super" -} - ;; Elementary types used as expressions (eg. for type casting, or for built-ins like `string.concat`) @expr [Expression @type [ElementaryType]] { edge @expr.output -> @type.ref diff --git a/crates/solidity/outputs/cargo/crate/src/generated/bindings/generated/binding_rules.rs b/crates/solidity/outputs/cargo/crate/src/generated/bindings/generated/binding_rules.rs index 28d75105e5..7712ef9336 100644 --- a/crates/solidity/outputs/cargo/crate/src/generated/bindings/generated/binding_rules.rs +++ b/crates/solidity/outputs/cargo/crate/src/generated/bindings/generated/binding_rules.rs @@ -98,6 +98,8 @@ inherit .star_extension )] ]] { edge @source_unit.lexical_scope -> @unit_member.def + attr (@source_unit.lexical_scope -> @unit_member.def) precedence = 1 + edge @source_unit.defs -> @unit_member.def ; In the general case, the lexical scope of the definition connects directly @@ -244,7 +246,6 @@ inherit .star_extension node def attr (def) node_definition = @name attr (def) definiens_node = @symbol - attr (def) tag = "alias" ; deprioritize this definition edge @symbol.def -> def node import @@ -261,7 +262,6 @@ inherit .star_extension node def attr (def) node_definition = @alias attr (def) definiens_node = @symbol - attr (def) tag = "alias" ; deprioritize this definition edge @symbol.def -> def node import @@ -349,6 +349,7 @@ inherit .star_extension attr (@contract.def) extension_scope = @contract.extensions edge @contract.lexical_scope -> @contract.instance + attr (@contract.lexical_scope -> @contract.instance) precedence = 1 ; Instance scope can also see members and our namespace definitions edge @contract.instance -> @contract.members @@ -447,31 +448,6 @@ inherit .star_extension edge @contract.def -> type edge type -> type_contract_type edge type_contract_type -> @contract.parent_scope - - ; The following defines the connection nodes the resolution algorithm uses - ; *only when setting a compilation context/target*. - - ; This attribute defines the sink of edges added from base contracts when - ; setting this contract as the compilation context, and should provide access - ; to anything that can be reached through `super`. The instance scope is a bit - ; too broad, but `.members` is too narrow as it doesn't allow navigation to - ; parent contracts (and from the base we need to be able to reach all - ; contracts in the hierarchy). - attr (@contract.def) export_node = @contract.instance - - ; This node will eventually connect to the contract's members being compiled - ; and grants access to definitions in that contract and all its parents - ; (recursively). It only makes sense if `super` is defined (ie. if we have - ; parents), but we define it here to be able to use it in the declaration of - ; import nodes. This is the dual of the export_node above. - node @contract.super_import - attr (@contract.super_import) pop_symbol = "." - - ; This defines the source side of edges added to base contracts when setting - ; a contract as compilation context; this allows this contract (a base) to - ; access virtual methods in any sub-contract defined in the hierarchy (both - ; with and without `super`, hence the two connection points). - attr (@contract.def) import_nodes = [@contract.lexical_scope, @contract.super_import] } @contract [ContractDefinition @specifier [InheritanceSpecifier]] { @@ -494,17 +470,16 @@ inherit .star_extension attr (@contract.super) pop_symbol = "super" edge @contract.lexical_scope -> @contract.super - ; This connects `super` to exported scopes from all contracts in the hierarchy - ; when setting a contract compilation target (see more detailed description - ; above on the definition of the `super_import` node). - edge @contract.super -> @contract.super_import + node @contract.super_dot + attr (@contract.super_dot) pop_symbol = "." + edge @contract.super -> @contract.super_dot ; Then connect it through an `@instance` guard to the parent contracts through ; `super_scope`. This allows "instance"-like access to members of parents ; through `super`. node super_instance attr (super_instance) push_symbol = "@instance" - edge @contract.super_import -> super_instance + edge @contract.super_dot -> super_instance edge super_instance -> @contract.super_scope } @@ -594,7 +569,6 @@ inherit .star_extension ;; This may prioritize this definition (when there are multiple options) ;; according to the C3 linerisation ordering - attr (@function.def) tag = "c3" attr (@function.def) parents = [@contract.def] } @@ -616,7 +590,6 @@ inherit .star_extension ;; This may prioritize this definition (when there are multiple options) ;; according to the C3 linerisation ordering - attr (@modifier.def) tag = "c3" attr (@modifier.def) parents = [@contract.def] } @@ -2363,15 +2336,6 @@ inherit .star_extension edge member -> @expr.star_extension } -;; Special case: member accesses to `super` are tagged with "super" to rank -;; virtual methods correctly -[MemberAccessExpression - operand: [Expression [SuperKeyword]] - @name member: [Identifier] -] { - attr (@name.ref) tag = "super" -} - ;; Elementary types used as expressions (eg. for type casting, or for built-ins like `string.concat`) @expr [Expression @type [ElementaryType]] { edge @expr.output -> @type.ref diff --git a/crates/solidity/outputs/cargo/tests/Cargo.toml b/crates/solidity/outputs/cargo/tests/Cargo.toml index efa99b67e2..f719a7dfff 100644 --- a/crates/solidity/outputs/cargo/tests/Cargo.toml +++ b/crates/solidity/outputs/cargo/tests/Cargo.toml @@ -32,7 +32,6 @@ slang_solidity = { workspace = true, features = [ ] } solidity_language = { workspace = true } strum_macros = { workspace = true } -thiserror = { workspace = true } [lints] workspace = true diff --git a/crates/solidity/outputs/cargo/tests/build.rs b/crates/solidity/outputs/cargo/tests/build.rs index 8f5c982af6..364cd44dc9 100644 --- a/crates/solidity/outputs/cargo/tests/build.rs +++ b/crates/solidity/outputs/cargo/tests/build.rs @@ -14,11 +14,6 @@ fn main() -> Result<()> { &tests_crate.join("src/generated"), )?; - lang_def.generate_bindings_assertions_tests( - &snapshots_crate.join("bindings_assertions"), - &tests_crate.join("src/bindings_assertions/generated"), - )?; - lang_def.generate_bindings_output_tests( &snapshots_crate.join("bindings_output"), &tests_crate.join("src/bindings_output/generated"), diff --git a/crates/solidity/outputs/cargo/tests/src/bindings.rs b/crates/solidity/outputs/cargo/tests/src/bindings.rs deleted file mode 100644 index c5a9cf60dc..0000000000 --- a/crates/solidity/outputs/cargo/tests/src/bindings.rs +++ /dev/null @@ -1,10 +0,0 @@ -use slang_solidity::bindings::{BindingGraph, Definition}; - -pub fn lookup_definition_by_name<'a>( - binding_graph: &'a BindingGraph, - name: &str, -) -> Option> { - binding_graph - .all_definitions() - .find(|definition| definition.get_cursor().node().unparse() == name) -} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/assertions.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/assertions.rs deleted file mode 100644 index fcc4d19547..0000000000 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/assertions.rs +++ /dev/null @@ -1,501 +0,0 @@ -use core::fmt; -use std::cmp::Ordering; -use std::collections::HashMap; - -use once_cell::sync::Lazy; -use regex::Regex; -use semver::{Version, VersionReq}; -use slang_solidity::bindings::{BindingGraph, Definition}; -use slang_solidity::cst::{Cursor, TerminalKind}; -use thiserror::Error; - -#[derive(Debug, Error)] -pub enum AssertionError { - #[error("Invalid assertion at {0}:{1}")] - InvalidAssertion(usize, usize), - - #[error("Invalid version requirement at line {0}: `{1}`")] - InvalidVersionReq(usize, String), - - #[error("Duplicate assertion definition {0}")] - DuplicateDefinition(String), - - #[error("No assertions found in line {0}")] - NoAssertionsFound(usize), - - #[error("Failed {failed} of {total} bindings assertions:\n{errors:#?}")] - FailedAssertions { - failed: usize, - total: usize, - errors: Vec, - }, -} - -pub struct Assertions<'a> { - definitions: HashMap>, - references: Vec>, -} - -#[derive(Clone, Debug, PartialEq)] -struct DefinitionAssertion<'a> { - id: String, - cursor: Cursor, - file: &'a str, -} - -#[derive(Clone, Debug, PartialEq)] -struct ReferenceAssertion<'a> { - id: Option, - cursor: Cursor, - file: &'a str, - version_req: Option, -} - -impl<'a> Assertions<'a> { - pub fn new() -> Self { - Self { - definitions: HashMap::new(), - references: Vec::new(), - } - } - - fn count(&self) -> usize { - self.definitions.len() + self.references.len() - } - - fn insert_definition_assertion( - &mut self, - assertion: DefinitionAssertion<'a>, - ) -> Result<(), AssertionError> { - let id = &assertion.id; - if self.definitions.contains_key(id) { - Err(AssertionError::DuplicateDefinition(id.clone())) - } else { - self.definitions.insert(id.clone(), assertion); - Ok(()) - } - } - - fn insert_reference_assertion(&mut self, assertion: ReferenceAssertion<'a>) { - self.references.push(assertion); - } -} - -impl<'a> fmt::Display for DefinitionAssertion<'a> { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!( - f, - "Assert Definition {id} {cursor}", - id = self.id, - cursor = DisplayCursor(&self.cursor, self.file), - ) - } -} - -impl<'a> fmt::Display for ReferenceAssertion<'a> { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "Assert ")?; - if let Some(id) = &self.id { - write!(f, "Reference {id}")?; - } else { - write!(f, "Unresolved Reference")?; - } - if let Some(version_req) = &self.version_req { - write!(f, " in versions {version_req}")?; - } - write!(f, " {}", DisplayCursor(&self.cursor, self.file)) - } -} - -struct DisplayCursor<'a>(&'a Cursor, &'a str); - -impl<'a> fmt::Display for DisplayCursor<'a> { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let offset = self.0.text_offset(); - write!( - f, - "`{}` at {}:{}:{}", - self.0.node().unparse(), - self.1, - offset.line + 1, - offset.column + 1, - ) - } -} - -/// Collects bindings assertions in comments in the parsed source code -/// accessible through the given cursor. The definitions take the following form: -/// -/// uint x; -/// // ^def:1 -/// -/// asserts that at the CST node above the caret symbol `^` (same column, not -/// necessarily in the previous line), the identifier `x` should create a -/// binding definition, and assigns it an ID of '1'. -/// -/// Conversely, for references: -/// -/// return x + y; -/// // ^ref:! (>= 0.5.0) -/// // ^ref:1 -/// -/// asserts that the CST identifier node `x` should be a binding reference which -/// should be declared as a corresponding definition assertion with identifier -/// '1'; and that the CST identifier node `y` should be a binding reference that -/// is unresolved for version at or above 0.5.0. -/// -/// For assertion targets that are located at the column where the comment -/// begins the alternative anchor `<` can be used. For example: -/// -/// x = y + 1; -/// // ^ref:2 -/// //( - assertions: &mut Assertions<'a>, - mut cursor: Cursor, - file: &'a str, - version: &Version, -) -> Result { - let mut skipped = 0; - loop { - if cursor - .node() - .is_terminal_with_kind(TerminalKind::SingleLineComment) - { - match find_assertion_in_comment(&cursor, version, file)? { - Some(Assertion::Definition(assertion)) => { - assertions.insert_definition_assertion(assertion)?; - } - Some(Assertion::Reference(assertion)) => { - assertions.insert_reference_assertion(assertion); - } - Some(Assertion::Skipped) => { - skipped += 1; - } - None => { - let line = cursor.text_offset().line + 1; - return Err(AssertionError::NoAssertionsFound(line)); - } - } - } - - if !cursor.go_to_next() { - break; - } - } - - Ok(skipped) -} - -#[derive(Clone, Debug, PartialEq)] -enum Assertion<'a> { - Definition(DefinitionAssertion<'a>), - Reference(ReferenceAssertion<'a>), - Skipped, -} - -static ASSERTION_REGEX: Lazy = Lazy::new(|| { - Regex::new(r"(?[\^]|[<])(?ref|def):(?[0-9a-zA-Z_-]+|!)([\t ]*\((?[^)]+)\))?") - .unwrap() -}); - -fn find_assertion_in_comment<'a>( - comment: &Cursor, - version: &Version, - file: &'a str, -) -> Result>, AssertionError> { - let comment_offset = comment.text_offset(); - let comment_col = comment_offset.column; - let comment_str = comment.node().unparse(); - - let Some(captures) = ASSERTION_REGEX.captures(&comment_str) else { - return Ok(None); - }; - - let assertion_id = captures.name("id").unwrap().as_str(); - let assertion_type = captures.name("type").unwrap().as_str(); - let assertion_anchor = captures.name("anchor").unwrap(); - let assertion_col = comment_col - + if assertion_anchor.as_str() == "^" { - assertion_anchor.start() - } else { - 0 - }; - let version_req = match captures.name("version") { - Some(version) => { - let Ok(version_req) = VersionReq::parse(version.as_str()) else { - return Err(AssertionError::InvalidVersionReq( - comment_offset.line + 1, - version.as_str().to_owned(), - )); - }; - Some(version_req) - } - None => None, - }; - - if let Some(cursor) = search_asserted_node_backwards(comment.clone(), assertion_col) { - let assertion = match assertion_type { - "ref" => { - let id = if assertion_id == "!" { - // this should be an unresolved reference - None - } else { - Some(assertion_id.to_owned()) - }; - Assertion::Reference(ReferenceAssertion { - id, - cursor, - file, - version_req, - }) - } - "def" => Assertion::Definition(DefinitionAssertion { - id: assertion_id.to_owned(), - cursor, - file, - }), - _ => unreachable!("unknown assertion type"), - }; - Ok(Some(assertion)) - } else { - // Assertion target may not be parseable with the current version - if let Some(version_req) = version_req { - if !version_req.matches(version) { - return Ok(Some(Assertion::Skipped)); - } - } - Err(AssertionError::InvalidAssertion( - comment_offset.line + 1, - assertion_col + 1, - )) - } -} - -fn search_asserted_node_backwards(mut cursor: Cursor, anchor_column: usize) -> Option { - let starting_line = cursor.text_offset().line; - while cursor.go_to_previous() { - // Skip if the cursor is on the same line - if cursor.text_offset().line == starting_line { - continue; - } - - // Skip over trivia, to allow defining multiple assertions for the same - // line of code in multiple single line comments - if cursor.node().is_trivia() { - continue; - } - - let cursor_column = cursor.text_offset().column; - match cursor_column.cmp(&anchor_column) { - Ordering::Equal => return Some(cursor), - Ordering::Greater => continue, - Ordering::Less => (), - } - // Skip over empty nodes which the parser may insert to fulfill the - // grammar (eg. commonly an empty Statements node) - if cursor.text_range().is_empty() { - continue; - } - - // Node is not found, and probably the anchor is invalid - break; - } - None -} - -/// Checks that the given `assertions` are fulfilled in the given `binding_graph` for -/// the indicated `version`. Only references can have version requirements, and -/// the absence of a requirement means the assertion should hold for all -/// language versions. -/// -pub fn check_assertions( - binding_graph: &BindingGraph, - assertions: &Assertions<'_>, - version: &Version, -) -> Result { - let mut failures: Vec = Vec::new(); - - check_definitions( - binding_graph, - assertions.definitions.values(), - &mut failures, - ); - check_references( - binding_graph, - version, - assertions.references.iter(), - &assertions.definitions, - &mut failures, - ); - - let count = assertions.count(); - if failures.is_empty() { - Ok(count) - } else { - Err(AssertionError::FailedAssertions { - total: count, - failed: failures.len(), - errors: failures, - }) - } -} - -fn check_definitions<'a>( - binding_graph: &BindingGraph, - definitions: impl Iterator>, - failures: &mut Vec, -) { - for assertion in definitions { - if let Err(failure) = find_definition(binding_graph, assertion) { - failures.push(failure); - } - } -} - -fn find_definition<'a>( - binding_graph: &'a BindingGraph, - assertion: &DefinitionAssertion<'_>, -) -> Result, String> { - let DefinitionAssertion { cursor, .. } = assertion; - - let Some(definition) = binding_graph.definition_at(cursor) else { - return Err(format!("{assertion} failed: not found")); - }; - - Ok(definition) -} - -fn check_references<'a>( - binding_graph: &BindingGraph, - version: &Version, - references: impl Iterator>, - definitions: &HashMap>, - failures: &mut Vec, -) { - for assertion in references { - if let Err(failure) = - check_reference_assertion(binding_graph, definitions, version, assertion) - { - failures.push(failure); - } - } -} - -fn check_reference_assertion( - binding_graph: &BindingGraph, - definitions: &HashMap>, - version: &Version, - assertion: &ReferenceAssertion<'_>, -) -> Result<(), String> { - let ReferenceAssertion { - id, version_req, .. - } = assertion; - - let version_matches = if let Some(version_req) = version_req { - version_req.matches(version) - } else { - true - }; - - let resolution = match find_and_resolve_reference(binding_graph, assertion) { - Ok(resolution) => resolution, - Err(err) => { - if version_matches { - return Err(err); - } - // the reference was not found, but that's ok if the assertion - // should not match for this version - None - } - }; - - match (version_matches, id) { - (true, None) => { - if let Some(resolved_handle) = resolution { - let resolved_cursor = resolved_handle.get_cursor(); - let resolved_file = resolved_handle.get_file(); - return Err(format!( - "{assertion} failed: expected not to resolve, but instead resolved to {resolved}", - resolved = DisplayCursor(resolved_cursor, resolved_file.get_path()) - )); - } - } - (true, Some(_)) => { - let Some(resolved_handle) = resolution else { - return Err(format!( - "{assertion} failed: did not resolve or ambiguous resolution" - )); - }; - let resolved_cursor = resolved_handle.get_cursor(); - let expected_handle = - lookup_referenced_definition(binding_graph, definitions, assertion)?; - let expected_cursor = expected_handle.get_cursor(); - if expected_cursor != resolved_cursor { - return Err(format!( - "{assertion} failed: expected resolve to {expected}, but instead resolved to {resolved}", - resolved = DisplayCursor(resolved_cursor, resolved_handle.get_file().get_path()), - expected = DisplayCursor(expected_cursor, expected_handle.get_file().get_path()), - )); - } - } - (false, None) => { - if resolution.is_none() { - return Err(format!( - "{assertion} failed: expected to resolve in this version" - )); - } - } - (false, Some(_)) => { - if let Some(resolved_handle) = resolution { - let resolved_cursor = resolved_handle.get_cursor(); - let referenced_handle = - lookup_referenced_definition(binding_graph, definitions, assertion)?; - let referenced_cursor = referenced_handle.get_cursor(); - if referenced_cursor == resolved_cursor { - return Err(format!( - "{assertion} failed: expected to not resolve to {resolved} in this version", - resolved = - DisplayCursor(resolved_cursor, resolved_handle.get_file().get_path()), - )); - } - } - } - } - - Ok(()) -} - -fn find_and_resolve_reference<'a>( - binding_graph: &'a BindingGraph, - assertion: &ReferenceAssertion<'_>, -) -> Result>, String> { - let ReferenceAssertion { cursor, .. } = assertion; - - let Some(reference) = binding_graph.reference_at(cursor) else { - return Err(format!("{assertion} failed: not found")); - }; - - // For the purpose of binding assertions, any failure to resolve to a single - // definition will be treated as if it was unresolved - Ok(reference.resolve_definition().ok()) -} - -fn lookup_referenced_definition<'a>( - binding_graph: &'a BindingGraph, - definitions: &HashMap>, - assertion: &ReferenceAssertion<'_>, -) -> Result, String> { - let ReferenceAssertion { id, .. } = assertion; - let Some(id) = id else { - return Err(format!("{assertion} failed: should not attempt to resolve")); - }; - let Some(definition) = definitions.get(id) else { - return Err(format!("{assertion} failed: reference is undefined")); - }; - find_definition(binding_graph, definition) -} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/arrays.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/arrays.rs deleted file mode 100644 index c907eafd7d..0000000000 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/arrays.rs +++ /dev/null @@ -1,20 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -use anyhow::Result; - -use crate::bindings_assertions::runner::run; - -#[test] -fn fixed() -> Result<()> { - run("arrays", "fixed") -} - -#[test] -fn nested_custom() -> Result<()> { - run("arrays", "nested_custom") -} - -#[test] -fn simple() -> Result<()> { - run("arrays", "simple") -} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/contracts.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/contracts.rs deleted file mode 100644 index a3603d5024..0000000000 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/contracts.rs +++ /dev/null @@ -1,45 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -use anyhow::Result; - -use crate::bindings_assertions::runner::run; - -#[test] -fn constructor_invocation() -> Result<()> { - run("contracts", "constructor_invocation") -} - -#[test] -fn diamond() -> Result<()> { - run("contracts", "diamond") -} - -#[test] -fn inheritance() -> Result<()> { - run("contracts", "inheritance") -} - -#[test] -fn linearisation_order() -> Result<()> { - run("contracts", "linearisation_order") -} - -#[test] -fn linearisation_with_context() -> Result<()> { - run("contracts", "linearisation_with_context") -} - -#[test] -fn virtual_lookup() -> Result<()> { - run("contracts", "virtual_lookup") -} - -#[test] -fn virtual_single() -> Result<()> { - run("contracts", "virtual_single") -} - -#[test] -fn visibility() -> Result<()> { - run("contracts", "visibility") -} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/control.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/control.rs deleted file mode 100644 index 79f1c04d03..0000000000 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/control.rs +++ /dev/null @@ -1,50 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -use anyhow::Result; - -use crate::bindings_assertions::runner::run; - -#[test] -fn do_while() -> Result<()> { - run("control", "do_while") -} - -#[test] -fn for_empty_init_or_cond() -> Result<()> { - run("control", "for_empty_init_or_cond") -} - -#[test] -fn for_stmt() -> Result<()> { - run("control", "for_stmt") -} - -#[test] -fn for_tuple_decon() -> Result<()> { - run("control", "for_tuple_decon") -} - -#[test] -fn if_else() -> Result<()> { - run("control", "if_else") -} - -#[test] -fn return_stmt() -> Result<()> { - run("control", "return_stmt") -} - -#[test] -fn try_stmt() -> Result<()> { - run("control", "try_stmt") -} - -#[test] -fn unchecked() -> Result<()> { - run("control", "unchecked") -} - -#[test] -fn while_stmt() -> Result<()> { - run("control", "while_stmt") -} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/enums.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/enums.rs deleted file mode 100644 index 03e8d7c029..0000000000 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/enums.rs +++ /dev/null @@ -1,10 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -use anyhow::Result; - -use crate::bindings_assertions::runner::run; - -#[test] -fn in_state_vars() -> Result<()> { - run("enums", "in_state_vars") -} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/errors.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/errors.rs deleted file mode 100644 index 2cdd2feae0..0000000000 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/errors.rs +++ /dev/null @@ -1,20 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -use anyhow::Result; - -use crate::bindings_assertions::runner::run; - -#[test] -fn named_args() -> Result<()> { - run("errors", "named_args") -} - -#[test] -fn revert_stmt() -> Result<()> { - run("errors", "revert_stmt") -} - -#[test] -fn typed_args() -> Result<()> { - run("errors", "typed_args") -} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/events.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/events.rs deleted file mode 100644 index 07b975b280..0000000000 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/events.rs +++ /dev/null @@ -1,20 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -use anyhow::Result; - -use crate::bindings_assertions::runner::run; - -#[test] -fn emit_stmt() -> Result<()> { - run("events", "emit_stmt") -} - -#[test] -fn named_args() -> Result<()> { - run("events", "named_args") -} - -#[test] -fn typed_args() -> Result<()> { - run("events", "typed_args") -} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/expressions.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/expressions.rs deleted file mode 100644 index fcd9acd7cf..0000000000 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/expressions.rs +++ /dev/null @@ -1,35 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -use anyhow::Result; - -use crate::bindings_assertions::runner::run; - -#[test] -fn basic() -> Result<()> { - run("expressions", "basic") -} - -#[test] -fn call_options() -> Result<()> { - run("expressions", "call_options") -} - -#[test] -fn call_output() -> Result<()> { - run("expressions", "call_output") -} - -#[test] -fn function_call() -> Result<()> { - run("expressions", "function_call") -} - -#[test] -fn new_output() -> Result<()> { - run("expressions", "new_output") -} - -#[test] -fn type_expression() -> Result<()> { - run("expressions", "type_expression") -} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/function_types.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/function_types.rs deleted file mode 100644 index 2d54ed42c5..0000000000 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/function_types.rs +++ /dev/null @@ -1,15 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -use anyhow::Result; - -use crate::bindings_assertions::runner::run; - -#[test] -fn external() -> Result<()> { - run("function_types", "external") -} - -#[test] -fn internal() -> Result<()> { - run("function_types", "internal") -} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/functions.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/functions.rs deleted file mode 100644 index f275d23b2b..0000000000 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/functions.rs +++ /dev/null @@ -1,10 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -use anyhow::Result; - -use crate::bindings_assertions::runner::run; - -#[test] -fn visibility() -> Result<()> { - run("functions", "visibility") -} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/imports.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/imports.rs deleted file mode 100644 index 4f0628f5d1..0000000000 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/imports.rs +++ /dev/null @@ -1,25 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -use anyhow::Result; - -use crate::bindings_assertions::runner::run; - -#[test] -fn deconstruction_imports() -> Result<()> { - run("imports", "deconstruction_imports") -} - -#[test] -fn named_imports() -> Result<()> { - run("imports", "named_imports") -} - -#[test] -fn path_imports() -> Result<()> { - run("imports", "path_imports") -} - -#[test] -fn unresolved_aliases() -> Result<()> { - run("imports", "unresolved_aliases") -} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/interfaces.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/interfaces.rs deleted file mode 100644 index 7d956ee7ae..0000000000 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/interfaces.rs +++ /dev/null @@ -1,10 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -use anyhow::Result; - -use crate::bindings_assertions::runner::run; - -#[test] -fn visibility() -> Result<()> { - run("interfaces", "visibility") -} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/mappings.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/mappings.rs deleted file mode 100644 index 345164a53f..0000000000 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/mappings.rs +++ /dev/null @@ -1,20 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -use anyhow::Result; - -use crate::bindings_assertions::runner::run; - -#[test] -fn nested() -> Result<()> { - run("mappings", "nested") -} - -#[test] -fn nested_custom() -> Result<()> { - run("mappings", "nested_custom") -} - -#[test] -fn simple() -> Result<()> { - run("mappings", "simple") -} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/mod.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/mod.rs deleted file mode 100644 index e61b9a8f6b..0000000000 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/mod.rs +++ /dev/null @@ -1,21 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -mod arrays; -mod constants; -mod contracts; -mod control; -mod enums; -mod errors; -mod events; -mod expressions; -mod function_types; -mod functions; -mod imports; -mod interfaces; -mod mappings; -mod modifiers; -mod scoping; -mod user_types; -mod using; -mod variables; -mod yul; diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/modifiers.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/modifiers.rs deleted file mode 100644 index bd63a004e6..0000000000 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/modifiers.rs +++ /dev/null @@ -1,10 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -use anyhow::Result; - -use crate::bindings_assertions::runner::run; - -#[test] -fn placeholder() -> Result<()> { - run("modifiers", "placeholder") -} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/user_types.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/user_types.rs deleted file mode 100644 index 66cd48f377..0000000000 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/user_types.rs +++ /dev/null @@ -1,10 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -use anyhow::Result; - -use crate::bindings_assertions::runner::run; - -#[test] -fn visibility() -> Result<()> { - run("user_types", "visibility") -} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/using.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/using.rs deleted file mode 100644 index 58420ec02b..0000000000 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/using.rs +++ /dev/null @@ -1,10 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -use anyhow::Result; - -use crate::bindings_assertions::runner::run; - -#[test] -fn inherited() -> Result<()> { - run("using", "inherited") -} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/variables.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/variables.rs deleted file mode 100644 index 31a2ddac36..0000000000 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/variables.rs +++ /dev/null @@ -1,25 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -use anyhow::Result; - -use crate::bindings_assertions::runner::run; - -#[test] -fn destructuring() -> Result<()> { - run("variables", "destructuring") -} - -#[test] -fn local_vars() -> Result<()> { - run("variables", "local_vars") -} - -#[test] -fn params() -> Result<()> { - run("variables", "params") -} - -#[test] -fn state_vars() -> Result<()> { - run("variables", "state_vars") -} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/yul.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/yul.rs deleted file mode 100644 index e324fe9095..0000000000 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/yul.rs +++ /dev/null @@ -1,40 +0,0 @@ -// This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -use anyhow::Result; - -use crate::bindings_assertions::runner::run; - -#[test] -fn blocks() -> Result<()> { - run("yul", "blocks") -} - -#[test] -fn fun_scopes() -> Result<()> { - run("yul", "fun_scopes") -} - -#[test] -fn functions() -> Result<()> { - run("yul", "functions") -} - -#[test] -fn if_stmt() -> Result<()> { - run("yul", "if_stmt") -} - -#[test] -fn labels() -> Result<()> { - run("yul", "labels") -} - -#[test] -fn stack_assign() -> Result<()> { - run("yul", "stack_assign") -} - -#[test] -fn variables() -> Result<()> { - run("yul", "variables") -} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/mod.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/mod.rs deleted file mode 100644 index 5b99d9a10e..0000000000 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -mod assertions; -mod generated; -mod runner; diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/runner.rs b/crates/solidity/outputs/cargo/tests/src/bindings_assertions/runner.rs deleted file mode 100644 index f593e1937d..0000000000 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/runner.rs +++ /dev/null @@ -1,88 +0,0 @@ -use std::fs; -use std::rc::Rc; - -use anyhow::Result; -use infra_utils::cargo::CargoWorkspace; -use semver::Version; -use slang_solidity::parser::Parser; -use slang_solidity::{bindings, diagnostic}; - -use crate::bindings::lookup_definition_by_name; -use crate::bindings_assertions::assertions::{ - check_assertions, collect_assertions_into, Assertions, -}; -use crate::generated::VERSION_BREAKS; -use crate::multi_part_file::{split_multi_file, Part}; -use crate::resolver::TestsPathResolver; - -pub fn run(group_name: &str, test_name: &str) -> Result<()> { - let file_name = format!("{test_name}.sol"); - let data_dir = CargoWorkspace::locate_source_crate("solidity_testing_snapshots")? - .join("bindings_assertions") - .join(group_name); - let input_path = data_dir.join(file_name); - let contents = fs::read_to_string(input_path)?; - - for version in &VERSION_BREAKS { - check_assertions_with_version(version, &contents)?; - } - Ok(()) -} - -fn check_assertions_with_version(version: &Version, contents: &str) -> Result<()> { - let parser = Parser::create(version.clone())?; - let mut binding_graph = - bindings::create_with_resolver(version.clone(), Rc::new(TestsPathResolver {}))?; - - let mut assertions = Assertions::new(); - let mut skipped = 0; - - let multi_part = split_multi_file(contents); - - for Part { - name: file_path, - contents: file_contents, - } in &multi_part.parts - { - let parse_output = parser.parse(Parser::ROOT_KIND, file_contents); - - if !parse_output.is_valid() { - let report = parse_output - .errors() - .iter() - .map(|error| diagnostic::render(error, file_path, file_contents, false)) - .collect::>() - .join("\n"); - eprintln!("\nParse errors for version {version}\nFile: {file_path}\n{report}"); - } - - binding_graph.add_user_file(file_path, parse_output.create_tree_cursor()); - skipped += collect_assertions_into( - &mut assertions, - parse_output.create_tree_cursor(), - file_path, - version, - )?; - } - - if let Some(context) = multi_part.context { - let context_definition = lookup_definition_by_name(&binding_graph, context) - .expect("context definition to be found") - .to_handle(); - binding_graph.set_context(&context_definition); - } - - let result = check_assertions(&binding_graph, &assertions, version); - - match result { - Ok(count) => { - assert!(count > 0, "No assertions found with version {version}"); - println!("Version {version}, {count} assertions OK, {skipped} skipped"); - } - Err(err) => { - panic!("Failed bindings assertions in version {version}:\n{err}"); - } - } - - Ok(()) -} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/constants.rs b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/constants.rs similarity index 64% rename from crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/constants.rs rename to crates/solidity/outputs/cargo/tests/src/bindings_output/generated/constants.rs index d8138e78b7..af753b0a73 100644 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/constants.rs +++ b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/constants.rs @@ -2,11 +2,11 @@ use anyhow::Result; -use crate::bindings_assertions::runner::run; +use crate::bindings_output::runner::run; #[test] -fn simple() -> Result<()> { - run("constants", "simple") +fn in_contract() -> Result<()> { + run("constants", "in_contract") } #[test] diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/contracts.rs b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/contracts.rs index a08b136dd9..8fe043c961 100644 --- a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/contracts.rs +++ b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/contracts.rs @@ -24,6 +24,11 @@ fn constructors() -> Result<()> { run("contracts", "constructors") } +#[test] +fn diamond() -> Result<()> { + run("contracts", "diamond") +} + #[test] fn fallback_receive() -> Result<()> { run("contracts", "fallback_receive") diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/control.rs b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/control.rs index cdb289dd0b..271005e4e1 100644 --- a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/control.rs +++ b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/control.rs @@ -4,6 +4,11 @@ use anyhow::Result; use crate::bindings_output::runner::run; +#[test] +fn do_while() -> Result<()> { + run("control", "do_while") +} + #[test] fn emit_event() -> Result<()> { run("control", "emit_event") @@ -44,6 +49,11 @@ fn if_else() -> Result<()> { run("control", "if_else") } +#[test] +fn return_stmt() -> Result<()> { + run("control", "return_stmt") +} + #[test] fn try_catch() -> Result<()> { run("control", "try_catch") @@ -54,6 +64,11 @@ fn try_stmt() -> Result<()> { run("control", "try_stmt") } +#[test] +fn unchecked() -> Result<()> { + run("control", "unchecked") +} + #[test] fn while_stmt() -> Result<()> { run("control", "while_stmt") diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/errors.rs b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/errors.rs index dc6cfdeec4..8bb66f3b7d 100644 --- a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/errors.rs +++ b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/errors.rs @@ -9,6 +9,16 @@ fn custom_types() -> Result<()> { run("errors", "custom_types") } +#[test] +fn named_args() -> Result<()> { + run("errors", "named_args") +} + +#[test] +fn revert_stmt() -> Result<()> { + run("errors", "revert_stmt") +} + #[test] fn selector() -> Result<()> { run("errors", "selector") diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/events.rs b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/events.rs index 5e8a63f2a5..5acb97331d 100644 --- a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/events.rs +++ b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/events.rs @@ -8,3 +8,13 @@ use crate::bindings_output::runner::run; fn custom_types() -> Result<()> { run("events", "custom_types") } + +#[test] +fn emit_stmt() -> Result<()> { + run("events", "emit_stmt") +} + +#[test] +fn named_args() -> Result<()> { + run("events", "named_args") +} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/expressions.rs b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/expressions.rs index d4e1b6730d..03d1ff3445 100644 --- a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/expressions.rs +++ b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/expressions.rs @@ -4,6 +4,11 @@ use anyhow::Result; use crate::bindings_output::runner::run; +#[test] +fn basic() -> Result<()> { + run("expressions", "basic") +} + #[test] fn binary_operators() -> Result<()> { run("expressions", "binary_operators") diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/function_types.rs b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/function_types.rs index 75d90a18e8..a4ae744c50 100644 --- a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/function_types.rs +++ b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/function_types.rs @@ -4,6 +4,11 @@ use anyhow::Result; use crate::bindings_output::runner::run; +#[test] +fn args_return_types() -> Result<()> { + run("function_types", "args_return_types") +} + #[test] fn call() -> Result<()> { run("function_types", "call") diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/imports.rs b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/imports.rs index 2917e63444..15ada57af2 100644 --- a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/imports.rs +++ b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/imports.rs @@ -9,7 +9,17 @@ fn alias_import() -> Result<()> { run("imports", "alias_import") } +#[test] +fn deconstruction() -> Result<()> { + run("imports", "deconstruction") +} + #[test] fn default() -> Result<()> { run("imports", "default") } + +#[test] +fn named() -> Result<()> { + run("imports", "named") +} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/mappings.rs b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/mappings.rs index c9a660ac10..6c1d13ffe2 100644 --- a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/mappings.rs +++ b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/mappings.rs @@ -9,7 +9,22 @@ fn custom_types() -> Result<()> { run("mappings", "custom_types") } +#[test] +fn elementary() -> Result<()> { + run("mappings", "elementary") +} + #[test] fn indexing() -> Result<()> { run("mappings", "indexing") } + +#[test] +fn nested() -> Result<()> { + run("mappings", "nested") +} + +#[test] +fn nested_custom() -> Result<()> { + run("mappings", "nested_custom") +} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/mod.rs b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/mod.rs index ebe2bbe3a0..b8e08152db 100644 --- a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/mod.rs +++ b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/mod.rs @@ -2,6 +2,7 @@ mod arrays; mod built_ins; +mod constants; mod contracts; mod control; mod enums; @@ -14,6 +15,7 @@ mod interfaces; mod libraries; mod mappings; mod modifiers; +mod scoping; mod structs; mod user_types; mod using; diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/scoping.rs b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/scoping.rs similarity index 59% rename from crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/scoping.rs rename to crates/solidity/outputs/cargo/tests/src/bindings_output/generated/scoping.rs index 5d7d6b535e..62b8bfcaa9 100644 --- a/crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/scoping.rs +++ b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/scoping.rs @@ -2,14 +2,24 @@ use anyhow::Result; -use crate::bindings_assertions::runner::run; +use crate::bindings_output::runner::run; #[test] fn c99_scopes() -> Result<()> { run("scoping", "c99_scopes") } +#[test] +fn functions() -> Result<()> { + run("scoping", "functions") +} + #[test] fn hoisting_scopes() -> Result<()> { run("scoping", "hoisting_scopes") } + +#[test] +fn shadowing() -> Result<()> { + run("scoping", "shadowing") +} diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/user_types.rs b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/user_types.rs index 889783f382..cff4124f21 100644 --- a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/user_types.rs +++ b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/user_types.rs @@ -4,6 +4,21 @@ use anyhow::Result; use crate::bindings_output::runner::run; +#[test] +fn in_contract() -> Result<()> { + run("user_types", "in_contract") +} + +#[test] +fn in_library() -> Result<()> { + run("user_types", "in_library") +} + +#[test] +fn top_level() -> Result<()> { + run("user_types", "top_level") +} + #[test] fn wrap_unwrap() -> Result<()> { run("user_types", "wrap_unwrap") diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/variables.rs b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/variables.rs index b820477fa7..4837b7188e 100644 --- a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/variables.rs +++ b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/variables.rs @@ -4,6 +4,11 @@ use anyhow::Result; use crate::bindings_output::runner::run; +#[test] +fn destructuring() -> Result<()> { + run("variables", "destructuring") +} + #[test] fn local_vars() -> Result<()> { run("variables", "local_vars") diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/yul.rs b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/yul.rs index f16d3cda70..2434ace98a 100644 --- a/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/yul.rs +++ b/crates/solidity/outputs/cargo/tests/src/bindings_output/generated/yul.rs @@ -4,6 +4,11 @@ use anyhow::Result; use crate::bindings_output::runner::run; +#[test] +fn blocks() -> Result<()> { + run("yul", "blocks") +} + #[test] fn conditionals() -> Result<()> { run("yul", "conditionals") @@ -24,6 +29,11 @@ fn identifiers_with_dots() -> Result<()> { run("yul", "identifiers_with_dots") } +#[test] +fn labels() -> Result<()> { + run("yul", "labels") +} + #[test] fn loops() -> Result<()> { run("yul", "loops") @@ -39,6 +49,11 @@ fn slot_suffix() -> Result<()> { run("yul", "slot_suffix") } +#[test] +fn stack_assign() -> Result<()> { + run("yul", "stack_assign") +} + #[test] fn variables() -> Result<()> { run("yul", "variables") 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 e3db19ffd7..ae170b2bdf 100644 --- a/crates/solidity/outputs/cargo/tests/src/bindings_output/renderer.rs +++ b/crates/solidity/outputs/cargo/tests/src/bindings_output/renderer.rs @@ -3,7 +3,6 @@ use std::ops::Range; use anyhow::Result; use ariadne::{Color, Config, FnCache, Label, Report, ReportBuilder, ReportKind, Source}; -use metaslang_bindings::ResolutionError; use slang_solidity::bindings::{BindingGraph, Definition, Reference}; use slang_solidity::cst::{NonterminalKind, Query}; use slang_solidity::diagnostic; @@ -175,33 +174,34 @@ fn build_report_for_part<'a>( start..end }; - let definition = reference.resolve_definition(); - let message = match definition { - Ok(definition) => { + let definitions = reference.definitions(); + let message = match definitions.len() { + 0 => { + all_resolved = false; + "unresolved".to_string() + } + 1 => { + let definition = definitions.first().unwrap(); if definition.get_file().is_system() { "ref: built-in".to_string() } else { let def_id = all_definitions .iter() - .position(|d| *d == definition) + .position(|d| d == definition) .unwrap(); format!("ref: {}", def_id + 1) } } - Err(ResolutionError::Unresolved) => { - all_resolved = false; - "unresolved".to_string() - } - Err(ResolutionError::AmbiguousDefinitions(ambiguous_definitions)) => { - let ref_labels = ambiguous_definitions + _ => { + let ref_labels = definitions .iter() - .filter_map(|ambiguous_definition| { - if ambiguous_definition.get_file().is_system() { + .filter_map(|definition| { + if definition.get_file().is_system() { Some("built-in".to_string()) } else { all_definitions .iter() - .position(|d| d == ambiguous_definition) + .position(|d| d == definition) .map(|index| format!("{}", index + 1)) } }) diff --git a/crates/solidity/outputs/cargo/tests/src/bindings_output/runner.rs b/crates/solidity/outputs/cargo/tests/src/bindings_output/runner.rs index 5daaf93288..218e694e4f 100644 --- a/crates/solidity/outputs/cargo/tests/src/bindings_output/runner.rs +++ b/crates/solidity/outputs/cargo/tests/src/bindings_output/runner.rs @@ -13,7 +13,6 @@ use slang_solidity::parser::{ParseOutput, Parser}; use super::graph::graphviz::render as render_graphviz_graph; use super::graph::mermaid::render as render_mermaid_graph; use super::renderer::render_bindings; -use crate::bindings::lookup_definition_by_name; use crate::generated::VERSION_BREAKS; use crate::multi_part_file::{split_multi_file, Part}; use crate::resolver::TestsPathResolver; @@ -66,13 +65,6 @@ pub fn run(group_name: &str, test_name: &str) -> Result<()> { }); } - if let Some(context) = multi_part.context { - let context_definition = lookup_definition_by_name(&binding_graph, context) - .expect("context definition to be found") - .to_handle(); - binding_graph.set_context(&context_definition); - } - let (bindings_output, all_resolved) = render_bindings(&binding_graph, &parsed_parts)?; let parse_success = parsed_parts.iter().all(|part| part.parse_output.is_valid()); diff --git a/crates/solidity/outputs/cargo/tests/src/lib.rs b/crates/solidity/outputs/cargo/tests/src/lib.rs index b62d53c1a2..ea8b38a537 100644 --- a/crates/solidity/outputs/cargo/tests/src/lib.rs +++ b/crates/solidity/outputs/cargo/tests/src/lib.rs @@ -3,8 +3,6 @@ use metaslang_bindings as _; mod binding_rules; -mod bindings; -mod bindings_assertions; mod bindings_output; mod built_ins; mod cst_output; diff --git a/crates/solidity/outputs/cargo/tests/src/multi_part_file.rs b/crates/solidity/outputs/cargo/tests/src/multi_part_file.rs index 204f1f8c6e..e06f118d4e 100644 --- a/crates/solidity/outputs/cargo/tests/src/multi_part_file.rs +++ b/crates/solidity/outputs/cargo/tests/src/multi_part_file.rs @@ -9,7 +9,6 @@ pub(crate) struct Part<'a> { #[derive(Debug, PartialEq)] pub(crate) struct MultiPart<'a> { - pub(crate) context: Option<&'a str>, pub(crate) parts: Vec>, } @@ -24,23 +23,7 @@ pub(crate) struct MultiPart<'a> { /// case, the returned vector will contain a single entry with the contents /// below the separator line. /// -/// The leading section before the first path separator may contain context -/// information of the form: -/// // --- context: Derived -/// -/// Other than that, non-whitespace content is not allowed before the first -/// path separator. -/// pub fn split_multi_file(contents: &str) -> MultiPart<'_> { - let context_re = Regex::new(r"(?m)\A// -{3,} context: (.+)\s*\n").unwrap(); - let (context, contents) = match context_re.captures(contents) { - Some(context_capture) => ( - Some(context_capture.get(1).unwrap().as_str()), - &contents[context_capture.get(0).unwrap().end()..], - ), - None => (None, contents), - }; - let separator_re = Regex::new(r"(?m)^// -{3,} path: (.+)\s*\n").unwrap(); let mut last_path: Option<&str> = None; let mut last_start = None; @@ -80,7 +63,7 @@ pub fn split_multi_file(contents: &str) -> MultiPart<'_> { }; parts.push(last_part); - MultiPart { context, parts } + MultiPart { parts } } #[test] @@ -98,7 +81,6 @@ fn splits_a_multi_file() { "#}; let result = split_multi_file(multi_file_contents); - assert!(result.context.is_none()); assert_eq!(3, result.parts.len()); assert_eq!( result.parts[0], @@ -159,34 +141,3 @@ fn disallows_content_before_first_path_tag() { let _ = split_multi_file(file_contents); } - -#[test] -fn captures_context() { - let file_contents = indoc! {r#" - // --- context: Base - contract Base {} - "#}; - let result = split_multi_file(file_contents); - assert_eq!(Some("Base"), result.context); - assert_eq!(1, result.parts.len()); - assert_eq!("input.sol", result.parts[0].name); - assert_eq!("contract Base {}\n", result.parts[0].contents); -} - -#[test] -fn captures_context_and_split_a_multi_file() { - let file_contents = indoc! {r#" - // --- context: Derived - // --- path: lib/base.sol - contract Base {} - // --- path: main.sol - contract Derived is Base {} - "#}; - let result = split_multi_file(file_contents); - assert_eq!(Some("Derived"), result.context); - assert_eq!(2, result.parts.len()); - assert_eq!("lib/base.sol", result.parts[0].name); - assert_eq!("contract Base {}\n", result.parts[0].contents); - assert_eq!("main.sol", result.parts[1].name); - assert_eq!("contract Derived is Base {}\n", result.parts[1].contents); -} diff --git a/crates/solidity/testing/perf/src/tests/references.rs b/crates/solidity/testing/perf/src/tests/references.rs index c039149a6d..9ba38d9f31 100644 --- a/crates/solidity/testing/perf/src/tests/references.rs +++ b/crates/solidity/testing/perf/src/tests/references.rs @@ -17,8 +17,8 @@ pub fn run(binding_graph: BindingGraph) { } reference_count += 1; - let resolution = reference.resolve_definition(); - if resolution.is_ok() { + let definitions = reference.definitions(); + if !definitions.is_empty() { resolved_references += 1; } } @@ -26,7 +26,7 @@ pub fn run(binding_graph: BindingGraph) { assert_eq!(reference_count, 1652, "Failed to fetch all references"); assert_eq!( - resolved_references, 1409, + resolved_references, 1490, "Failed to resolve all references" ); } diff --git a/crates/solidity/testing/snapshots/bindings_assertions/arrays/fixed.sol b/crates/solidity/testing/snapshots/bindings_assertions/arrays/fixed.sol deleted file mode 100644 index 5ce6c200c4..0000000000 --- a/crates/solidity/testing/snapshots/bindings_assertions/arrays/fixed.sol +++ /dev/null @@ -1,9 +0,0 @@ -contract Test { - function test() public { - uint[5] memory values; - values.pop(); - // ^ref:! -- fixed size arrays should not bind pop/push - values.push(1); - // ^ref:! -- fixed size arrays should not bind pop/push - } -} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/arrays/nested_custom.sol b/crates/solidity/testing/snapshots/bindings_assertions/arrays/nested_custom.sol deleted file mode 100644 index b9d71162e7..0000000000 --- a/crates/solidity/testing/snapshots/bindings_assertions/arrays/nested_custom.sol +++ /dev/null @@ -1,41 +0,0 @@ -contract CustomArrays { - uint constant SIZE = 5; - // ^def:7 - - struct Value { - // ^def:1 - uint value; - // ^def:2 - } - - Value[][SIZE] values; - // ^def:3 - // ^ref:7 - //= 0.7.4) - assert(MY_UINT > 100); - // ^ref:! (< 0.7.4) - // ^ref:4 (>= 0.7.4) - require(msg.sender == MY_ADDRESS); - // ^ref:! (< 0.7.4) - // ^ref:3 (>= 0.7.4) - } -} - -enum Direction { NORTH, SOUTH, EAST, WEST } -// ^def:1 (>= 0.6.0) -// ^def:2 (>= 0.6.0) - -address constant MY_ADDRESS = 0x777788889999AaAAbBbbCcccddDdeeeEfFFfCcCc; -// ^def:3 (>= 0.7.4) -uint256 constant MY_UINT = 123; -// ^def:4 (>= 0.7.4) -Direction constant MY_DIRECTION = Direction.EAST; -// ^ref:2 (>= 0.7.4) -// ^ref:1 (>= 0.7.4) -// ^def:5 (>= 0.7.4) -//= 0.7.4) diff --git a/crates/solidity/testing/snapshots/bindings_assertions/contracts/constructor_invocation.sol b/crates/solidity/testing/snapshots/bindings_assertions/contracts/constructor_invocation.sol deleted file mode 100644 index f54e0f15a0..0000000000 --- a/crates/solidity/testing/snapshots/bindings_assertions/contracts/constructor_invocation.sol +++ /dev/null @@ -1,21 +0,0 @@ -contract A { - // ^def:1 - function A(int x) {} - // ^def:2 - - constructor(int y) {} - // ^def:3 -} - -contract Test { - function foo() public { - new A({x: 2}); - // ^ref:1 - // ^ref:2 (< 0.5.0) - // ^ref:! (>= 0.5.0) - new A({y: 2}); - // ^ref:1 - // ^ref:3 (>= 0.4.22) - // ^ref:! (< 0.4.22) - } -} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/contracts/inheritance.sol b/crates/solidity/testing/snapshots/bindings_assertions/contracts/inheritance.sol deleted file mode 100644 index fe9afbf55a..0000000000 --- a/crates/solidity/testing/snapshots/bindings_assertions/contracts/inheritance.sol +++ /dev/null @@ -1,43 +0,0 @@ -contract B1 { - // ^def:1 - function b1_func() returns (int) { - // ^def:2 - return 1; - } -} - -contract B2 { - // ^def:3 - enum E { E1, E2 } - // ^def:7 - function b2_func() returns (int) { - // ^def:4 - return 2; - } -} - -contract C is B1 { - // ^def:5 - // ^ref:1 - E e_at_c; - //= 0.5.0) - // ^ref:2 (< 0.5.0) - } -} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/control/for_empty_init_or_cond.sol b/crates/solidity/testing/snapshots/bindings_assertions/control/for_empty_init_or_cond.sol deleted file mode 100644 index a3553c8694..0000000000 --- a/crates/solidity/testing/snapshots/bindings_assertions/control/for_empty_init_or_cond.sol +++ /dev/null @@ -1,24 +0,0 @@ -contract Test { - function empty_init() public { - int i = 1; - // ^def:1 - int x = 0; - // ^def:2 - for (; i < 10; i++) { - // ^ref:1 - // ^ref:1 - x += i; - // 10) break; - // ^ref:3 - } - } -} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/control/for_stmt.sol b/crates/solidity/testing/snapshots/bindings_assertions/control/for_stmt.sol deleted file mode 100644 index 1fb24752fe..0000000000 --- a/crates/solidity/testing/snapshots/bindings_assertions/control/for_stmt.sol +++ /dev/null @@ -1,32 +0,0 @@ -contract Test { - function simple_loop() public returns (int) { - int x = 1; - // ^def:1 - for (int i = 0; i < 10; i++) { - // ^def:2 - // ^ref:2 - // ^ref:2 - x = x * 2; - //= 0.5.0) - // ^ref:2 (< 0.5.0) - } - - function loop_with_outside_var() public { - int z; - // ^def:3 - int w = 0; - // ^def:4 - for ( z = 10; z > 0; w += z) { - //^ref:3 - // ^ref:3 - // ^ref:4 - // ^ref:3 - z--; - // 1) { - //= 0.5.0) - // ^ref:4 (< 0.5.0) - // ^ref:! (>= 0.5.0) - // ^ref:3 (< 0.5.0) - // ^ref:2 - } -} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/control/return_stmt.sol b/crates/solidity/testing/snapshots/bindings_assertions/control/return_stmt.sol deleted file mode 100644 index 532c19580f..0000000000 --- a/crates/solidity/testing/snapshots/bindings_assertions/control/return_stmt.sol +++ /dev/null @@ -1,8 +0,0 @@ -contract Test { - function test() returns (int) { - int x = 1; - // ^def:1 - return x; - // ^ref:1 - } -} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/control/try_stmt.sol b/crates/solidity/testing/snapshots/bindings_assertions/control/try_stmt.sol deleted file mode 100644 index f28a2b0dec..0000000000 --- a/crates/solidity/testing/snapshots/bindings_assertions/control/try_stmt.sol +++ /dev/null @@ -1,28 +0,0 @@ -interface DataFeed { function getData(address token) external returns (uint value); } - -contract FeedConsumer { - DataFeed feed; - // ^def:1 - uint errorCount; - // ^def:2 - function rate(address token) public returns (uint value, bool success) { - // ^def:5 - // ^def:4 - // ^def:3 - try feed.getData(token) returns (uint v) { - // ^def:6 - // ^ref:3 - //= 0.8.0) - // ^ref:3 (>= 0.8.0) - } -} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/control/while_stmt.sol b/crates/solidity/testing/snapshots/bindings_assertions/control/while_stmt.sol deleted file mode 100644 index 102037f5a7..0000000000 --- a/crates/solidity/testing/snapshots/bindings_assertions/control/while_stmt.sol +++ /dev/null @@ -1,17 +0,0 @@ -contract Test { - function test() public returns (int) { - int i = 1; - // ^def:1 - while (i < 100) { - // ^ref:1 - int odd = i % 2; - // ^def:2 - // ^ref:1 - i *= 3; - //= 0.5.0) - // ^ref:2 (< 0.5.0) - } -} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/enums/in_state_vars.sol b/crates/solidity/testing/snapshots/bindings_assertions/enums/in_state_vars.sol deleted file mode 100644 index 7c0a1c0d2d..0000000000 --- a/crates/solidity/testing/snapshots/bindings_assertions/enums/in_state_vars.sol +++ /dev/null @@ -1,10 +0,0 @@ -contract Foo { - enum Answer { Yes, No } - // ^def:3 - // ^def:2 - // ^def:1 - Answer choice = Answer.Yes; - //= 0.8.4) - // ^ref:1 (>= 0.8.4) - // ^ref:3 (>= 0.8.4) - } -} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/events/emit_stmt.sol b/crates/solidity/testing/snapshots/bindings_assertions/events/emit_stmt.sol deleted file mode 100644 index 6a0cf6be32..0000000000 --- a/crates/solidity/testing/snapshots/bindings_assertions/events/emit_stmt.sol +++ /dev/null @@ -1,23 +0,0 @@ -contract Test { - event TestEvent(int id); - // ^def:1 - - function test_emit() public { - int x = 1; - // ^def:2 - - emit TestEvent(x); - // ^ref:2 (>= 0.4.21) - // ^ref:1 (>= 0.4.21) - emit Utils.Debug(x); - // ^ref:2 (>= 0.4.21) - // ^ref:4 (>= 0.4.21) - // ^ref:3 (>= 0.4.21) - } -} - -library Utils { - // ^def:3 - event Debug(int subject); - // ^def:4 -} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/events/named_args.sol b/crates/solidity/testing/snapshots/bindings_assertions/events/named_args.sol deleted file mode 100644 index d50ec37a5f..0000000000 --- a/crates/solidity/testing/snapshots/bindings_assertions/events/named_args.sol +++ /dev/null @@ -1,18 +0,0 @@ -contract Test { - enum Severity { Info, Error } - // ^def:3 - - event Log ( - Severity level, - // ^def:1 - string message - // ^def:2 - ); - - function test() { - emit Log({message: "testing", level: Severity.Info}); - // ^ref:3 (>= 0.4.21) - // ^ref:1 (>= 0.4.21) - // ^ref:2 (>= 0.4.21) - } -} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/events/typed_args.sol b/crates/solidity/testing/snapshots/bindings_assertions/events/typed_args.sol deleted file mode 100644 index af8d1f0ecb..0000000000 --- a/crates/solidity/testing/snapshots/bindings_assertions/events/typed_args.sol +++ /dev/null @@ -1,22 +0,0 @@ -contract Test { - enum Severity { - //^def:1 - Info, - //= 0.4.21) - // ^ref:1 (>= 0.4.21) - // ^ref:2 (>= 0.4.21) - } -} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/expressions/basic.sol b/crates/solidity/testing/snapshots/bindings_assertions/expressions/basic.sol deleted file mode 100644 index 5c0b7b34da..0000000000 --- a/crates/solidity/testing/snapshots/bindings_assertions/expressions/basic.sol +++ /dev/null @@ -1,14 +0,0 @@ -contract Test { - function playground() returns (int) { - int x = 1; - // ^def:1 - int y = x + 2; - // ^ref:1 - // ^def:2 - return (x + y * x) / y; - // ^ref:2 - // ^ref:1 - // ^ref:2 - // ^ref:1 - } -} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/expressions/call_options.sol b/crates/solidity/testing/snapshots/bindings_assertions/expressions/call_options.sol deleted file mode 100644 index 6f724db9cb..0000000000 --- a/crates/solidity/testing/snapshots/bindings_assertions/expressions/call_options.sol +++ /dev/null @@ -1,23 +0,0 @@ -interface External { - function sample(uint x) external payable returns (uint); - // ^def:5 -} - -contract Test { - External ext; - // ^def:4 - function test(uint x) public returns (uint) { - // ^def:1 - uint v = 10; - // ^def:2 - uint g = 800; - // ^def:3 - - return ext.sample{ value: v, gas: g }(x); - // ^ref:1 (>= 0.6.2) - // ^ref:3 (>= 0.6.2) - // ^ref:2 (>= 0.6.2) - // ^ref:5 - // ^ref:4 - } -} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/expressions/call_output.sol b/crates/solidity/testing/snapshots/bindings_assertions/expressions/call_output.sol deleted file mode 100644 index 7bb655b6c8..0000000000 --- a/crates/solidity/testing/snapshots/bindings_assertions/expressions/call_output.sol +++ /dev/null @@ -1,17 +0,0 @@ -contract Test { - struct Resource { - uint value; - // ^def:1 - } - - function test_call_output() public returns (uint) { - return get_resource().value; - // ^ref:1 - // ^ref:2 - } - - function get_resource() internal returns (Resource memory) { - // ^def:2 - return Resource(1); - } -} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/expressions/function_call.sol b/crates/solidity/testing/snapshots/bindings_assertions/expressions/function_call.sol deleted file mode 100644 index 7dde629c86..0000000000 --- a/crates/solidity/testing/snapshots/bindings_assertions/expressions/function_call.sol +++ /dev/null @@ -1,29 +0,0 @@ -contract Test { - function playground() returns (int) { - int x = 1; - // ^def:1 - int y = 2; - // ^def:2 - int z = Utils.adder(x, y); - // ^ref:2 - // ^ref:1 - // ^ref:6 - // ^ref:5 - // ^def:3 - pointless(z, x); - //=0.5.3) - } - - function getSmallestValue() returns (Direction) { - // ^ref:1 - return type(Direction).min; - // ^ref:1 (>=0.5.3) - } -} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/function_types/external.sol b/crates/solidity/testing/snapshots/bindings_assertions/function_types/external.sol deleted file mode 100644 index cf312ed300..0000000000 --- a/crates/solidity/testing/snapshots/bindings_assertions/function_types/external.sol +++ /dev/null @@ -1,32 +0,0 @@ -contract Test { - struct Coords { - // ^def:1 - int x; - int y; - } - enum HitTest { - //^def:2 - Inside, - Outside - } - struct Box { - // ^def:3 - function (Coords memory) external returns (HitTest) hitTest; - // ^def:4 - // ^ref:2 - // ^ref:1 - } - Box[] boxes; - // ^def:5 - // mapping(uint256 => bool)) public nested; - // ^def:1 - - function get(address _addr1, uint256 _i) public view returns (bool) { - // ^def:2 - // ^def:3 - return nested[_addr1][_i]; - // ^ref:2 - // ^ref:3 - // ^ref:1 - } - - function set(address _addr1, uint256 _i, bool _boo) public { - // ^def:4 - // ^def:5 - // ^def:6 - nested[_addr1][_i] = _boo; - // ^ref:4 - // ^ref:5 - // ^ref:6 - // mapping(Kind => Values)) vaults; - // ^def:4 - // ^ref:2 - // ^ref:1 - - function store(address _addr, Kind _kind, uint _amount) public { - // ^def:5 - // ^def:6 - // ^def:7 - vaults[_addr][_kind].balance += _amount; - // ^ref:5 - // ^ref:3 - // ^ref:6 - // ^ref:7 - // uint256) public myMap; - // ^def:1 - - function get(address _addr) public view returns (uint256) { - // ^def:2 - return myMap[_addr]; - // ^ref:2 - // ^ref:1 - } - - function set(address _addr, uint256 _i) public { - // ^def:3 - // ^def:4 - myMap[_addr] = _i; - // ^ref:3 - // ^ref:4 - //=0.5.0) - // ^def:3 - { - uint x = 20; - // ^def:4 - return x + y; - // ^ref:3 - // ^ref:4 - } - } - - function another_func() returns (uint y) { - // ^def:5 - y = x + w; - //=0.5.0) - // ^ref:6 (<0.5.0) - // ^ref:1 - uint w = 5; - // ^def:6 - } -} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/scoping/hoisting_scopes.sol b/crates/solidity/testing/snapshots/bindings_assertions/scoping/hoisting_scopes.sol deleted file mode 100644 index 03c71d7bcc..0000000000 --- a/crates/solidity/testing/snapshots/bindings_assertions/scoping/hoisting_scopes.sol +++ /dev/null @@ -1,17 +0,0 @@ -contract Foo { - function bar() returns (int x) { - // ^def:1 - x = y + z; - //=0.5.0) - // ^ref:2 (<0.5.0) - // ^ref:! (>=0.5.0) - int y = 5; - // ^def:2 - { - int z = 10; - // ^def:3 - } - } -} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/user_types/visibility.sol b/crates/solidity/testing/snapshots/bindings_assertions/user_types/visibility.sol deleted file mode 100644 index 1c4bdf5df3..0000000000 --- a/crates/solidity/testing/snapshots/bindings_assertions/user_types/visibility.sol +++ /dev/null @@ -1,33 +0,0 @@ -contract Test { - // ^def:dummy - type Internal is uint; - // ^def:2 (>= 0.8.8) - - function test() public returns (int32) { - Internal inter = Internal.wrap(10); - // ^ref:2 (>= 0.8.8) - //= 0.8.8) - TopLevel tl = TopLevel.wrap(20); - // ^ref:1 (>= 0.8.8) - //= 0.8.8) - return MyLib.LibType.unwrap(MyLib.create()); - // ^ref:3 - // ^ref:4 (>= 0.8.8) - // ^ref:3 (>= 0.8.8) - } -} - -type TopLevel is uint256; -// ^def:1 (>= 0.8.8) - -library MyLib { - // ^def:3 - type LibType is int32; - // ^def:4 (>= 0.8.8) - - function create() public returns (LibType) { - // ^ref:4 (>= 0.8.8) - return LibType.wrap(30); - // ^ref:4 (>= 0.8.8) - } -} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/using/inherited.sol b/crates/solidity/testing/snapshots/bindings_assertions/using/inherited.sol deleted file mode 100644 index 6bcd410801..0000000000 --- a/crates/solidity/testing/snapshots/bindings_assertions/using/inherited.sol +++ /dev/null @@ -1,16 +0,0 @@ -library Lib { - function squared(int x) public returns (int) { return x * x; } - // ^def:1 -} - -contract Base { - using Lib for int; -} - -contract Test is Base { - function test(int x) public returns (int) { - return x.squared(); - // ^ref:1 (< 0.7.0) - // ^ref:! (>= 0.7.0) - } -} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/variables/destructuring.sol b/crates/solidity/testing/snapshots/bindings_assertions/variables/destructuring.sol deleted file mode 100644 index 3440cc559d..0000000000 --- a/crates/solidity/testing/snapshots/bindings_assertions/variables/destructuring.sol +++ /dev/null @@ -1,27 +0,0 @@ -library Test { - enum Choice { Yes, No } - // ^def:1 - - function test() public pure { - (int x, int y) = (1, 2); - // ^def:5 - // ^def:4 - (int z, , int w) = (1, 2, 3); - // ^def:7 - // ^def:6 - assert(x == z); - // ^ref:6 - // ^ref:4 - assert(y < w); - // ^ref:7 - // ^ref:5 - (, Choice c) = (Choice.Yes, Choice.No); - // ^ref:1 - // ^ref:1 - // ^def:8 - // ^ref:1 - - assert(c == Choice.No); - // ^ref:8 - } -} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/variables/local_vars.sol b/crates/solidity/testing/snapshots/bindings_assertions/variables/local_vars.sol deleted file mode 100644 index f4c3a060ce..0000000000 --- a/crates/solidity/testing/snapshots/bindings_assertions/variables/local_vars.sol +++ /dev/null @@ -1,15 +0,0 @@ -contract Foo { - function bar() returns (uint) { - uint x = 10; - // ^def:1 - - return x + 2; - // ^ref:1 - } - - function baz() returns (int) { - return w + x; - // ^ref:! - // ^ref:! - } -} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/variables/params.sol b/crates/solidity/testing/snapshots/bindings_assertions/variables/params.sol deleted file mode 100644 index 3686559624..0000000000 --- a/crates/solidity/testing/snapshots/bindings_assertions/variables/params.sol +++ /dev/null @@ -1,21 +0,0 @@ -contract Foo { - function bar(uint z) returns (uint) { - // ^def:1 - - return z + 1; - // ^ref:1 - } - - function baz() returns (int) { - return z + 2; - // ^ref:! - } - - function quux(int x) returns (int y) { - // ^def:2 - // ^def:3 - y = x + 5; - // ^ref:3 - // x { - // ^def:1 - x := add(x_i, outer()) - // ^ref:2 - } - - r := inner(a) - // ^ref:3 - // ^ref:1 - // y { - // ^def:2 - y := inner() - // ^ref:! -- function is not visible here - r := add(a, 1) - // ^ref:! -- assembly functions cannot access Solidity variables - // b { - // ^def:1 - b := add(a, 1) - } - - { - r := add(outer1(x), inner(x)) - // ^ref:2 - // ^ref:1 - function inner(f) -> g { - // ^def:2 - g:= mul(f, outer2(f)) - // ^ref:3 - } - } - - function outer2(c) -> d { - // ^def:3 - d := mul(c, outer2_inner(c)) - // ^ref:4 - - function outer2_inner(e) -> f { - // ^def:4 - f := e - } - } - } - } -} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/yul/if_stmt.sol b/crates/solidity/testing/snapshots/bindings_assertions/yul/if_stmt.sol deleted file mode 100644 index 903ffc0dd4..0000000000 --- a/crates/solidity/testing/snapshots/bindings_assertions/yul/if_stmt.sol +++ /dev/null @@ -1,19 +0,0 @@ -contract Test { - function test() public returns (uint256 r) { - // ^def:1 - uint256 x = 5; - // ^def:2 - assembly { - if gt(x, 2) { - //^ref:2 - r := foo() - // ^ref:3 - // z { - // ^def:3 - z := 1 - } - } - } -} diff --git a/crates/solidity/testing/snapshots/bindings_assertions/yul/variables.sol b/crates/solidity/testing/snapshots/bindings_assertions/yul/variables.sol deleted file mode 100644 index ffe029eb8d..0000000000 --- a/crates/solidity/testing/snapshots/bindings_assertions/yul/variables.sol +++ /dev/null @@ -1,17 +0,0 @@ -contract AssemblyVariables { - function yul_let(uint256 x) public returns (uint256 z) { - // ^def:2 - // ^def:1 - assembly { - let y := add(123, x) - // ^ref:1 - // ^def:3 - z := add(456, y) - // ^ref:3 - // 100); + │ ───┬── ───┬─── + │ ╰──────────── ref: built-in + │ │ + │ ╰───── ref: 8 + 11 │ require(msg.sender == MY_ADDRESS); + │ ───┬─── ─┬─ ───┬── ─────┬──── + │ ╰────────────────────────────── ref: built-in + │ │ │ │ + │ ╰──────────────────────── ref: built-in + │ │ │ + │ ╰────────────────── ref: built-in + │ │ + │ ╰────── ref: 7 +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─────▶ contract Constants { + 2 │ │ │ enum Direction { NORTH, SOUTH, EAST, WEST } + │ │ │ ───────────────────────┬┬─────┬──────┬─────┬──── + │ │ │ ╰────────────────────────── definiens: 3 + │ │ │ │ │ │ │ + │ │ │ ╰───────────────────────── definiens: 2 + │ │ │ │ │ │ + │ │ │ ╰─────────────────── definiens: 4 + │ │ │ │ │ + │ │ │ ╰──────────── definiens: 5 + │ │ │ │ + │ │ │ ╰────── definiens: 6 + 3 │ │ ╭─▶ + 4 │ │ ├─▶ address public constant MY_ADDRESS = 0x777788889999AaAAbBbbCcccddDdeeeEfFFfCcCc; + │ │ │ + │ │ ╰────────────────────────────────────────────────────────────────────────────────────────── definiens: 7 + 5 │ │ uint256 public constant MY_UINT = 123; + │ │ ─────────────────────┬───────────────────── + │ │ ╰─────────────────────── definiens: 8 + 6 │ │ │ Direction public constant MY_DIRECTION = Direction.EAST; + │ │ │ ──────────────────────────────┬────────────────────────────── + │ │ │ ╰──────────────────────────────── definiens: 9 + 7 │ │ ╭───▶ + ┆ ┆ ┆ + 12 │ │ ├───▶ } + │ │ │ + │ │ ╰───────────── definiens: 10 + 13 │ ├─────▶ } + │ │ + │ ╰─────────── definiens: 1 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/constants/in_contract/generated/0.4.22-success.txt b/crates/solidity/testing/snapshots/bindings_output/constants/in_contract/generated/0.4.22-success.txt new file mode 100644 index 0000000000..b74271393a --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/constants/in_contract/generated/0.4.22-success.txt @@ -0,0 +1,97 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Constants { + │ ────┬──── + │ ╰────── name: 1 + 2 │ enum Direction { NORTH, SOUTH, EAST, WEST } + │ ────┬──── ──┬── ──┬── ──┬─ ──┬─ + │ ╰───────────────────────────────── name: 2 + │ │ │ │ │ + │ ╰─────────────────────── name: 3 + │ │ │ │ + │ ╰──────────────── name: 4 + │ │ │ + │ ╰───────── name: 5 + │ │ + │ ╰─── name: 6 + │ + 4 │ address public constant MY_ADDRESS = 0x777788889999AaAAbBbbCcccddDdeeeEfFFfCcCc; + │ ─────┬──── + │ ╰────── name: 7 + 5 │ uint256 public constant MY_UINT = 123; + │ ───┬─── + │ ╰───── name: 8 + 6 │ Direction public constant MY_DIRECTION = Direction.EAST; + │ ────┬──── ──────┬───── ────┬──── ──┬─ + │ ╰──────────────────────────────────────────────────── ref: 2 + │ │ │ │ + │ ╰──────────────────────── name: 9 + │ │ │ + │ ╰─────────── ref: 2 + │ │ + │ ╰─── ref: 5 + │ + 8 │ function test() public { + │ ──┬─ + │ ╰─── name: 10 + 9 │ assert(MY_DIRECTION != Direction.NORTH); + │ ───┬── ──────┬───── ────┬──── ──┬── + │ ╰──────────────────────────────────── ref: built-in + │ │ │ │ + │ ╰────────────────────────── ref: 9 + │ │ │ + │ ╰──────────── ref: 2 + │ │ + │ ╰──── ref: 3 + 10 │ assert(MY_UINT > 100); + │ ───┬── ───┬─── + │ ╰──────────── ref: built-in + │ │ + │ ╰───── ref: 8 + 11 │ require(msg.sender == MY_ADDRESS); + │ ───┬─── ─┬─ ───┬── ─────┬──── + │ ╰────────────────────────────── refs: built-in, built-in + │ │ │ │ + │ ╰──────────────────────── ref: built-in + │ │ │ + │ ╰────────────────── ref: built-in + │ │ + │ ╰────── ref: 7 +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─────▶ contract Constants { + 2 │ │ │ enum Direction { NORTH, SOUTH, EAST, WEST } + │ │ │ ───────────────────────┬┬─────┬──────┬─────┬──── + │ │ │ ╰────────────────────────── definiens: 3 + │ │ │ │ │ │ │ + │ │ │ ╰───────────────────────── definiens: 2 + │ │ │ │ │ │ + │ │ │ ╰─────────────────── definiens: 4 + │ │ │ │ │ + │ │ │ ╰──────────── definiens: 5 + │ │ │ │ + │ │ │ ╰────── definiens: 6 + 3 │ │ ╭─▶ + 4 │ │ ├─▶ address public constant MY_ADDRESS = 0x777788889999AaAAbBbbCcccddDdeeeEfFFfCcCc; + │ │ │ + │ │ ╰────────────────────────────────────────────────────────────────────────────────────────── definiens: 7 + 5 │ │ uint256 public constant MY_UINT = 123; + │ │ ─────────────────────┬───────────────────── + │ │ ╰─────────────────────── definiens: 8 + 6 │ │ │ Direction public constant MY_DIRECTION = Direction.EAST; + │ │ │ ──────────────────────────────┬────────────────────────────── + │ │ │ ╰──────────────────────────────── definiens: 9 + 7 │ │ ╭───▶ + ┆ ┆ ┆ + 12 │ │ ├───▶ } + │ │ │ + │ │ ╰───────────── definiens: 10 + 13 │ ├─────▶ } + │ │ + │ ╰─────────── definiens: 1 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/constants/in_contract/generated/0.8.27-success.txt b/crates/solidity/testing/snapshots/bindings_output/constants/in_contract/generated/0.8.27-success.txt new file mode 100644 index 0000000000..53f9f32c95 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/constants/in_contract/generated/0.8.27-success.txt @@ -0,0 +1,97 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Constants { + │ ────┬──── + │ ╰────── name: 1 + 2 │ enum Direction { NORTH, SOUTH, EAST, WEST } + │ ────┬──── ──┬── ──┬── ──┬─ ──┬─ + │ ╰───────────────────────────────── name: 2 + │ │ │ │ │ + │ ╰─────────────────────── name: 3 + │ │ │ │ + │ ╰──────────────── name: 4 + │ │ │ + │ ╰───────── name: 5 + │ │ + │ ╰─── name: 6 + │ + 4 │ address public constant MY_ADDRESS = 0x777788889999AaAAbBbbCcccddDdeeeEfFFfCcCc; + │ ─────┬──── + │ ╰────── name: 7 + 5 │ uint256 public constant MY_UINT = 123; + │ ───┬─── + │ ╰───── name: 8 + 6 │ Direction public constant MY_DIRECTION = Direction.EAST; + │ ────┬──── ──────┬───── ────┬──── ──┬─ + │ ╰──────────────────────────────────────────────────── ref: 2 + │ │ │ │ + │ ╰──────────────────────── name: 9 + │ │ │ + │ ╰─────────── ref: 2 + │ │ + │ ╰─── ref: 5 + │ + 8 │ function test() public { + │ ──┬─ + │ ╰─── name: 10 + 9 │ assert(MY_DIRECTION != Direction.NORTH); + │ ───┬── ──────┬───── ────┬──── ──┬── + │ ╰──────────────────────────────────── ref: built-in + │ │ │ │ + │ ╰────────────────────────── ref: 9 + │ │ │ + │ ╰──────────── ref: 2 + │ │ + │ ╰──── ref: 3 + 10 │ assert(MY_UINT > 100); + │ ───┬── ───┬─── + │ ╰──────────── ref: built-in + │ │ + │ ╰───── ref: 8 + 11 │ require(msg.sender == MY_ADDRESS); + │ ───┬─── ─┬─ ───┬── ─────┬──── + │ ╰────────────────────────────── refs: built-in, built-in, built-in + │ │ │ │ + │ ╰──────────────────────── ref: built-in + │ │ │ + │ ╰────────────────── ref: built-in + │ │ + │ ╰────── ref: 7 +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─────▶ contract Constants { + 2 │ │ │ enum Direction { NORTH, SOUTH, EAST, WEST } + │ │ │ ───────────────────────┬┬─────┬──────┬─────┬──── + │ │ │ ╰────────────────────────── definiens: 3 + │ │ │ │ │ │ │ + │ │ │ ╰───────────────────────── definiens: 2 + │ │ │ │ │ │ + │ │ │ ╰─────────────────── definiens: 4 + │ │ │ │ │ + │ │ │ ╰──────────── definiens: 5 + │ │ │ │ + │ │ │ ╰────── definiens: 6 + 3 │ │ ╭─▶ + 4 │ │ ├─▶ address public constant MY_ADDRESS = 0x777788889999AaAAbBbbCcccddDdeeeEfFFfCcCc; + │ │ │ + │ │ ╰────────────────────────────────────────────────────────────────────────────────────────── definiens: 7 + 5 │ │ uint256 public constant MY_UINT = 123; + │ │ ─────────────────────┬───────────────────── + │ │ ╰─────────────────────── definiens: 8 + 6 │ │ │ Direction public constant MY_DIRECTION = Direction.EAST; + │ │ │ ──────────────────────────────┬────────────────────────────── + │ │ │ ╰──────────────────────────────── definiens: 9 + 7 │ │ ╭───▶ + ┆ ┆ ┆ + 12 │ │ ├───▶ } + │ │ │ + │ │ ╰───────────── definiens: 10 + 13 │ ├─────▶ } + │ │ + │ ╰─────────── definiens: 1 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_assertions/constants/simple.sol b/crates/solidity/testing/snapshots/bindings_output/constants/in_contract/input.sol similarity index 52% rename from crates/solidity/testing/snapshots/bindings_assertions/constants/simple.sol rename to crates/solidity/testing/snapshots/bindings_output/constants/in_contract/input.sol index 52d1f77830..7b2f2cec69 100644 --- a/crates/solidity/testing/snapshots/bindings_assertions/constants/simple.sol +++ b/crates/solidity/testing/snapshots/bindings_output/constants/in_contract/input.sol @@ -1,24 +1,13 @@ contract Constants { enum Direction { NORTH, SOUTH, EAST, WEST } - // ^def:1 - // ^def:2 address public constant MY_ADDRESS = 0x777788889999AaAAbBbbCcccddDdeeeEfFFfCcCc; - // ^def:3 uint256 public constant MY_UINT = 123; - // ^def:4 Direction public constant MY_DIRECTION = Direction.EAST; - // ^ref:2 - // ^ref:1 - // ^def:5 - // 100); - // ^ref:4 require(msg.sender == MY_ADDRESS); - // ^ref:3 } } diff --git a/crates/solidity/testing/snapshots/bindings_output/constants/top_level/generated/0.4.11-failure.txt b/crates/solidity/testing/snapshots/bindings_output/constants/top_level/generated/0.4.11-failure.txt new file mode 100644 index 0000000000..19fd17379d --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/constants/top_level/generated/0.4.11-failure.txt @@ -0,0 +1,58 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected ContractKeyword or ImportKeyword or InterfaceKeyword or LibraryKeyword or PragmaKeyword. + ╭─[input.sol:9:1] + │ + 9 │ ╭─▶ enum Direction { NORTH, SOUTH, EAST, WEST } + ┆ ┆ + 13 │ ├─▶ Direction constant MY_DIRECTION = Direction.EAST; + │ │ + │ ╰─────────────────────────────────────────────────────── Error occurred here. +────╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Constants { + │ ────┬──── + │ ╰────── name: 1 + 2 │ function test() public { + │ ──┬─ + │ ╰─── name: 2 + 3 │ assert(MY_DIRECTION != Direction.NORTH); + │ ───┬── ──────┬───── ────┬──── ──┬── + │ ╰──────────────────────────────────── ref: built-in + │ │ │ │ + │ ╰────────────────────────── unresolved + │ │ │ + │ ╰──────────── unresolved + │ │ + │ ╰──── unresolved + 4 │ assert(MY_UINT > 100); + │ ───┬── ───┬─── + │ ╰──────────── ref: built-in + │ │ + │ ╰───── unresolved + 5 │ require(msg.sender == MY_ADDRESS); + │ ───┬─── ─┬─ ───┬── ─────┬──── + │ ╰────────────────────────────── ref: built-in + │ │ │ │ + │ ╰──────────────────────── ref: built-in + │ │ │ + │ ╰────────────────── ref: built-in + │ │ + │ ╰────── unresolved +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Constants { + 2 │ │ ╭─▶ function test() public { + ┆ ┆ ┆ + 6 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 7 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/constants/top_level/generated/0.4.22-failure.txt b/crates/solidity/testing/snapshots/bindings_output/constants/top_level/generated/0.4.22-failure.txt new file mode 100644 index 0000000000..795458ac67 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/constants/top_level/generated/0.4.22-failure.txt @@ -0,0 +1,58 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected ContractKeyword or ImportKeyword or InterfaceKeyword or LibraryKeyword or PragmaKeyword. + ╭─[input.sol:9:1] + │ + 9 │ ╭─▶ enum Direction { NORTH, SOUTH, EAST, WEST } + ┆ ┆ + 13 │ ├─▶ Direction constant MY_DIRECTION = Direction.EAST; + │ │ + │ ╰─────────────────────────────────────────────────────── Error occurred here. +────╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Constants { + │ ────┬──── + │ ╰────── name: 1 + 2 │ function test() public { + │ ──┬─ + │ ╰─── name: 2 + 3 │ assert(MY_DIRECTION != Direction.NORTH); + │ ───┬── ──────┬───── ────┬──── ──┬── + │ ╰──────────────────────────────────── ref: built-in + │ │ │ │ + │ ╰────────────────────────── unresolved + │ │ │ + │ ╰──────────── unresolved + │ │ + │ ╰──── unresolved + 4 │ assert(MY_UINT > 100); + │ ───┬── ───┬─── + │ ╰──────────── ref: built-in + │ │ + │ ╰───── unresolved + 5 │ require(msg.sender == MY_ADDRESS); + │ ───┬─── ─┬─ ───┬── ─────┬──── + │ ╰────────────────────────────── refs: built-in, built-in + │ │ │ │ + │ ╰──────────────────────── ref: built-in + │ │ │ + │ ╰────────────────── ref: built-in + │ │ + │ ╰────── unresolved +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Constants { + 2 │ │ ╭─▶ function test() public { + ┆ ┆ ┆ + 6 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 7 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/constants/top_level/generated/0.6.0-failure.txt b/crates/solidity/testing/snapshots/bindings_output/constants/top_level/generated/0.6.0-failure.txt new file mode 100644 index 0000000000..309d20e547 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/constants/top_level/generated/0.6.0-failure.txt @@ -0,0 +1,82 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected ContractKeyword or EnumKeyword or ImportKeyword or InterfaceKeyword or LibraryKeyword or PragmaKeyword or StructKeyword. + ╭─[input.sol:11:1] + │ + 11 │ ╭─▶ address constant MY_ADDRESS = 0x777788889999AaAAbBbbCcccddDdeeeEfFFfCcCc; + ┆ ┆ + 13 │ ├─▶ Direction constant MY_DIRECTION = Direction.EAST; + │ │ + │ ╰─────────────────────────────────────────────────────── Error occurred here. +────╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Constants { + │ ────┬──── + │ ╰────── name: 1 + 2 │ function test() public { + │ ──┬─ + │ ╰─── name: 2 + 3 │ assert(MY_DIRECTION != Direction.NORTH); + │ ───┬── ──────┬───── ────┬──── ──┬── + │ ╰──────────────────────────────────── ref: built-in + │ │ │ │ + │ ╰────────────────────────── unresolved + │ │ │ + │ ╰──────────── ref: 3 + │ │ + │ ╰──── ref: 4 + 4 │ assert(MY_UINT > 100); + │ ───┬── ───┬─── + │ ╰──────────── ref: built-in + │ │ + │ ╰───── unresolved + 5 │ require(msg.sender == MY_ADDRESS); + │ ───┬─── ─┬─ ───┬── ─────┬──── + │ ╰────────────────────────────── refs: built-in, built-in + │ │ │ │ + │ ╰──────────────────────── ref: built-in + │ │ │ + │ ╰────────────────── ref: built-in + │ │ + │ ╰────── unresolved + │ + 9 │ enum Direction { NORTH, SOUTH, EAST, WEST } + │ ────┬──── ──┬── ──┬── ──┬─ ──┬─ + │ ╰───────────────────────────────── name: 3 + │ │ │ │ │ + │ ╰─────────────────────── name: 4 + │ │ │ │ + │ ╰──────────────── name: 5 + │ │ │ + │ ╰───────── name: 6 + │ │ + │ ╰─── name: 7 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ──▶ contract Constants { + 2 │ │ ╭───▶ function test() public { + ┆ ┆ ┆ + 6 │ │ ├───▶ } + │ │ │ + │ │ ╰───────────── definiens: 2 + 7 │ ├───│ ▶ } + │ │ │ + │ ╰─────────── definiens: 1 + 8 │ ╭─▶ + 9 │ ├─▶ enum Direction { NORTH, SOUTH, EAST, WEST } + │ │ ──┬── ──┬── ──┬─ ──┬─ + │ │ ╰────────────────────────── definiens: 4 + │ │ │ │ │ + │ │ ╰─────────────────── definiens: 5 + │ │ │ │ + │ │ ╰──────────── definiens: 6 + │ │ │ + │ │ ╰────── definiens: 7 + │ │ + │ ╰───────────────────────────────────────────────── definiens: 3 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/constants/top_level/generated/0.7.1-failure.txt b/crates/solidity/testing/snapshots/bindings_output/constants/top_level/generated/0.7.1-failure.txt new file mode 100644 index 0000000000..d908294b5d --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/constants/top_level/generated/0.7.1-failure.txt @@ -0,0 +1,82 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected ContractKeyword or EnumKeyword or FunctionKeyword or ImportKeyword or InterfaceKeyword or LibraryKeyword or PragmaKeyword or StructKeyword. + ╭─[input.sol:11:1] + │ + 11 │ ╭─▶ address constant MY_ADDRESS = 0x777788889999AaAAbBbbCcccddDdeeeEfFFfCcCc; + ┆ ┆ + 13 │ ├─▶ Direction constant MY_DIRECTION = Direction.EAST; + │ │ + │ ╰─────────────────────────────────────────────────────── Error occurred here. +────╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Constants { + │ ────┬──── + │ ╰────── name: 1 + 2 │ function test() public { + │ ──┬─ + │ ╰─── name: 2 + 3 │ assert(MY_DIRECTION != Direction.NORTH); + │ ───┬── ──────┬───── ────┬──── ──┬── + │ ╰──────────────────────────────────── ref: built-in + │ │ │ │ + │ ╰────────────────────────── unresolved + │ │ │ + │ ╰──────────── ref: 3 + │ │ + │ ╰──── ref: 4 + 4 │ assert(MY_UINT > 100); + │ ───┬── ───┬─── + │ ╰──────────── ref: built-in + │ │ + │ ╰───── unresolved + 5 │ require(msg.sender == MY_ADDRESS); + │ ───┬─── ─┬─ ───┬── ─────┬──── + │ ╰────────────────────────────── refs: built-in, built-in + │ │ │ │ + │ ╰──────────────────────── ref: built-in + │ │ │ + │ ╰────────────────── ref: built-in + │ │ + │ ╰────── unresolved + │ + 9 │ enum Direction { NORTH, SOUTH, EAST, WEST } + │ ────┬──── ──┬── ──┬── ──┬─ ──┬─ + │ ╰───────────────────────────────── name: 3 + │ │ │ │ │ + │ ╰─────────────────────── name: 4 + │ │ │ │ + │ ╰──────────────── name: 5 + │ │ │ + │ ╰───────── name: 6 + │ │ + │ ╰─── name: 7 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ──▶ contract Constants { + 2 │ │ ╭───▶ function test() public { + ┆ ┆ ┆ + 6 │ │ ├───▶ } + │ │ │ + │ │ ╰───────────── definiens: 2 + 7 │ ├───│ ▶ } + │ │ │ + │ ╰─────────── definiens: 1 + 8 │ ╭─▶ + 9 │ ├─▶ enum Direction { NORTH, SOUTH, EAST, WEST } + │ │ ──┬── ──┬── ──┬─ ──┬─ + │ │ ╰────────────────────────── definiens: 4 + │ │ │ │ │ + │ │ ╰─────────────────── definiens: 5 + │ │ │ │ + │ │ ╰──────────── definiens: 6 + │ │ │ + │ │ ╰────── definiens: 7 + │ │ + │ ╰───────────────────────────────────────────────── definiens: 3 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/constants/top_level/generated/0.7.4-success.txt b/crates/solidity/testing/snapshots/bindings_output/constants/top_level/generated/0.7.4-success.txt new file mode 100644 index 0000000000..050b3d1095 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/constants/top_level/generated/0.7.4-success.txt @@ -0,0 +1,98 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Constants { + │ ────┬──── + │ ╰────── name: 1 + 2 │ function test() public { + │ ──┬─ + │ ╰─── name: 2 + 3 │ assert(MY_DIRECTION != Direction.NORTH); + │ ───┬── ──────┬───── ────┬──── ──┬── + │ ╰──────────────────────────────────── ref: built-in + │ │ │ │ + │ ╰────────────────────────── ref: 10 + │ │ │ + │ ╰──────────── ref: 3 + │ │ + │ ╰──── ref: 4 + 4 │ assert(MY_UINT > 100); + │ ───┬── ───┬─── + │ ╰──────────── ref: built-in + │ │ + │ ╰───── ref: 9 + 5 │ require(msg.sender == MY_ADDRESS); + │ ───┬─── ─┬─ ───┬── ─────┬──── + │ ╰────────────────────────────── refs: built-in, built-in + │ │ │ │ + │ ╰──────────────────────── ref: built-in + │ │ │ + │ ╰────────────────── ref: built-in + │ │ + │ ╰────── ref: 8 + │ + 9 │ enum Direction { NORTH, SOUTH, EAST, WEST } + │ ────┬──── ──┬── ──┬── ──┬─ ──┬─ + │ ╰───────────────────────────────── name: 3 + │ │ │ │ │ + │ ╰─────────────────────── name: 4 + │ │ │ │ + │ ╰──────────────── name: 5 + │ │ │ + │ ╰───────── name: 6 + │ │ + │ ╰─── name: 7 + │ + 11 │ address constant MY_ADDRESS = 0x777788889999AaAAbBbbCcccddDdeeeEfFFfCcCc; + │ ─────┬──── + │ ╰────── name: 8 + 12 │ uint256 constant MY_UINT = 123; + │ ───┬─── + │ ╰───── name: 9 + 13 │ Direction constant MY_DIRECTION = Direction.EAST; + │ ────┬──── ──────┬───── ────┬──── ──┬─ + │ ╰───────────────────────────────────────────── ref: 3 + │ │ │ │ + │ ╰──────────────────────── name: 10 + │ │ │ + │ ╰─────────── ref: 3 + │ │ + │ ╰─── ref: 6 +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ────▶ contract Constants { + 2 │ │ ╭─────▶ function test() public { + ┆ ┆ ┆ + 6 │ │ ├─────▶ } + │ │ │ + │ │ ╰─────────────── definiens: 2 + 7 │ ├─────│ ▶ } + │ │ │ + │ ╰───────────── definiens: 1 + 8 │ ╭─▶ + 9 │ │ ├─▶ enum Direction { NORTH, SOUTH, EAST, WEST } + │ │ │ ──┬── ──┬── ──┬─ ──┬─ + │ │ │ ╰────────────────────────── definiens: 4 + │ │ │ │ │ │ + │ │ │ ╰─────────────────── definiens: 5 + │ │ │ │ │ + │ │ │ ╰──────────── definiens: 6 + │ │ │ │ + │ │ │ ╰────── definiens: 7 + │ │ │ + │ │ ╰───────────────────────────────────────────────── definiens: 3 + 10 │ ╭───▶ + 11 │ ├───▶ address constant MY_ADDRESS = 0x777788889999AaAAbBbbCcccddDdeeeEfFFfCcCc; + │ │ + │ ╰───────────────────────────────────────────────────────────────────────────────── definiens: 8 + 12 │ uint256 constant MY_UINT = 123; + │ ────────────────┬─────────────── + │ ╰───────────────── definiens: 9 + 13 │ Direction constant MY_DIRECTION = Direction.EAST; + │ ─────────────────────────┬──────────────────────── + │ ╰────────────────────────── definiens: 10 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/constants/top_level/generated/0.8.27-success.txt b/crates/solidity/testing/snapshots/bindings_output/constants/top_level/generated/0.8.27-success.txt new file mode 100644 index 0000000000..a47275c7f7 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/constants/top_level/generated/0.8.27-success.txt @@ -0,0 +1,98 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Constants { + │ ────┬──── + │ ╰────── name: 1 + 2 │ function test() public { + │ ──┬─ + │ ╰─── name: 2 + 3 │ assert(MY_DIRECTION != Direction.NORTH); + │ ───┬── ──────┬───── ────┬──── ──┬── + │ ╰──────────────────────────────────── ref: built-in + │ │ │ │ + │ ╰────────────────────────── ref: 10 + │ │ │ + │ ╰──────────── ref: 3 + │ │ + │ ╰──── ref: 4 + 4 │ assert(MY_UINT > 100); + │ ───┬── ───┬─── + │ ╰──────────── ref: built-in + │ │ + │ ╰───── ref: 9 + 5 │ require(msg.sender == MY_ADDRESS); + │ ───┬─── ─┬─ ───┬── ─────┬──── + │ ╰────────────────────────────── refs: built-in, built-in, built-in + │ │ │ │ + │ ╰──────────────────────── ref: built-in + │ │ │ + │ ╰────────────────── ref: built-in + │ │ + │ ╰────── ref: 8 + │ + 9 │ enum Direction { NORTH, SOUTH, EAST, WEST } + │ ────┬──── ──┬── ──┬── ──┬─ ──┬─ + │ ╰───────────────────────────────── name: 3 + │ │ │ │ │ + │ ╰─────────────────────── name: 4 + │ │ │ │ + │ ╰──────────────── name: 5 + │ │ │ + │ ╰───────── name: 6 + │ │ + │ ╰─── name: 7 + │ + 11 │ address constant MY_ADDRESS = 0x777788889999AaAAbBbbCcccddDdeeeEfFFfCcCc; + │ ─────┬──── + │ ╰────── name: 8 + 12 │ uint256 constant MY_UINT = 123; + │ ───┬─── + │ ╰───── name: 9 + 13 │ Direction constant MY_DIRECTION = Direction.EAST; + │ ────┬──── ──────┬───── ────┬──── ──┬─ + │ ╰───────────────────────────────────────────── ref: 3 + │ │ │ │ + │ ╰──────────────────────── name: 10 + │ │ │ + │ ╰─────────── ref: 3 + │ │ + │ ╰─── ref: 6 +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ────▶ contract Constants { + 2 │ │ ╭─────▶ function test() public { + ┆ ┆ ┆ + 6 │ │ ├─────▶ } + │ │ │ + │ │ ╰─────────────── definiens: 2 + 7 │ ├─────│ ▶ } + │ │ │ + │ ╰───────────── definiens: 1 + 8 │ ╭─▶ + 9 │ │ ├─▶ enum Direction { NORTH, SOUTH, EAST, WEST } + │ │ │ ──┬── ──┬── ──┬─ ──┬─ + │ │ │ ╰────────────────────────── definiens: 4 + │ │ │ │ │ │ + │ │ │ ╰─────────────────── definiens: 5 + │ │ │ │ │ + │ │ │ ╰──────────── definiens: 6 + │ │ │ │ + │ │ │ ╰────── definiens: 7 + │ │ │ + │ │ ╰───────────────────────────────────────────────── definiens: 3 + 10 │ ╭───▶ + 11 │ ├───▶ address constant MY_ADDRESS = 0x777788889999AaAAbBbbCcccddDdeeeEfFFfCcCc; + │ │ + │ ╰───────────────────────────────────────────────────────────────────────────────── definiens: 8 + 12 │ uint256 constant MY_UINT = 123; + │ ────────────────┬─────────────── + │ ╰───────────────── definiens: 9 + 13 │ Direction constant MY_DIRECTION = Direction.EAST; + │ ─────────────────────────┬──────────────────────── + │ ╰────────────────────────── definiens: 10 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/constants/top_level/input.sol b/crates/solidity/testing/snapshots/bindings_output/constants/top_level/input.sol new file mode 100644 index 0000000000..c21197a9fa --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/constants/top_level/input.sol @@ -0,0 +1,13 @@ +contract Constants { + function test() public { + assert(MY_DIRECTION != Direction.NORTH); + assert(MY_UINT > 100); + require(msg.sender == MY_ADDRESS); + } +} + +enum Direction { NORTH, SOUTH, EAST, WEST } + +address constant MY_ADDRESS = 0x777788889999AaAAbBbbCcccddDdeeeEfFFfCcCc; +uint256 constant MY_UINT = 123; +Direction constant MY_DIRECTION = Direction.EAST; diff --git a/crates/solidity/testing/snapshots/bindings_output/contracts/diamond/generated/0.4.11-failure.txt b/crates/solidity/testing/snapshots/bindings_output/contracts/diamond/generated/0.4.11-failure.txt new file mode 100644 index 0000000000..512f3eb7fe --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/contracts/diamond/generated/0.4.11-failure.txt @@ -0,0 +1,87 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract A { + │ ┬ + │ ╰── name: 1 + 2 │ function foo() public virtual { + │ ─┬─ ───┬─── + │ ╰──────────────────── name: 2 + │ │ + │ ╰───── unresolved + │ + 6 │ contract B is A { + │ ┬ ┬ + │ ╰─────── name: 3 + │ │ + │ ╰── ref: 1 + 7 │ function foo() public virtual override { + │ ─┬─ ───┬─── ────┬─── + │ ╰───────────────────────────── name: 4 + │ │ │ + │ ╰────────────── unresolved + │ │ + │ ╰───── unresolved + │ + 11 │ contract C is A { + │ ┬ ┬ + │ ╰─────── name: 5 + │ │ + │ ╰── ref: 1 + │ + 14 │ contract D is B, C { + │ ┬ ┬ ┬ + │ ╰────────── name: 6 + │ │ │ + │ ╰───── ref: 3 + │ │ + │ ╰── ref: 5 + 15 │ function foo() public virtual override { + │ ─┬─ ───┬─── ────┬─── + │ ╰───────────────────────────── name: 7 + │ │ │ + │ ╰────────────── unresolved + │ │ + │ ╰───── unresolved + 16 │ super.foo(); + │ ─┬─ + │ ╰─── refs: 4, 2 +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭───│ ──▶ contract A { + 2 │ │ ╭───▶ function foo() public virtual { + 3 │ │ ├───▶ } + │ │ │ + │ │ ╰───────────── definiens: 2 + 4 │ │ ├───────▶ } + │ │ │ + │ │ ╰───────────── definiens: 1 + 5 │ ╭───────────▶ + ┆ ┆ ┆ + 7 │ │ ╭─────▶ function foo() public virtual override { + 8 │ │ ├─────▶ } + │ │ │ + │ │ ╰─────────────── definiens: 4 + 9 │ ├─────────│ ▶ } + │ │ │ + │ ╰───────────────── definiens: 3 + 10 │ ╭─▶ + ┆ ┆ + 12 │ │ ├─▶ } + │ │ │ + │ │ ╰─────── definiens: 5 + 13 │ ╭─────────────▶ + ┆ ┆ ┆ + 15 │ │ ╭─────────▶ function foo() public virtual override { + ┆ ┆ ┆ + 17 │ │ ├─────────▶ } + │ │ │ + │ │ ╰─────────────────── definiens: 7 + 18 │ ├─────────────▶ } + │ │ + │ ╰─────────────────── definiens: 6 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/contracts/diamond/generated/0.5.0-failure.txt b/crates/solidity/testing/snapshots/bindings_output/contracts/diamond/generated/0.5.0-failure.txt new file mode 100644 index 0000000000..0c4315affa --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/contracts/diamond/generated/0.5.0-failure.txt @@ -0,0 +1,97 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected OpenBrace or ReturnsKeyword or Semicolon. + ╭─[input.sol:7:35] + │ + 7 │ ╭─▶ function foo() public virtual override { + 8 │ ├─▶ } + │ │ + │ ╰─────────── Error occurred here. +───╯ +Error: Expected OpenBrace or ReturnsKeyword or Semicolon. + ╭─[input.sol:15:35] + │ + 15 │ ╭─▶ function foo() public virtual override { + ┆ ┆ + 17 │ ├─▶ } + │ │ + │ ╰─────────── Error occurred here. +────╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract A { + │ ┬ + │ ╰── name: 1 + 2 │ function foo() public virtual { + │ ─┬─ ───┬─── + │ ╰──────────────────── name: 2 + │ │ + │ ╰───── unresolved + │ + 6 │ contract B is A { + │ ┬ ┬ + │ ╰─────── name: 3 + │ │ + │ ╰── ref: 1 + 7 │ function foo() public virtual override { + │ ─┬─ ───┬─── + │ ╰──────────────────── name: 4 + │ │ + │ ╰───── unresolved + │ + 11 │ contract C is A { + │ ┬ ┬ + │ ╰─────── name: 5 + │ │ + │ ╰── ref: 1 + │ + 14 │ contract D is B, C { + │ ┬ ┬ ┬ + │ ╰────────── name: 6 + │ │ │ + │ ╰───── ref: 3 + │ │ + │ ╰── ref: 5 + 15 │ function foo() public virtual override { + │ ─┬─ ───┬─── + │ ╰──────────────────── name: 7 + │ │ + │ ╰───── unresolved +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ──▶ contract A { + 2 │ │ ╭───▶ function foo() public virtual { + 3 │ │ ├───▶ } + │ │ │ + │ │ ╰───────────── definiens: 2 + 4 │ │ ├─────▶ } + │ │ │ + │ │ ╰─────────── definiens: 1 + 5 │ ╭───────▶ + ┆ ┆ + 7 │ │ function foo() public virtual override { + │ │ ────────────────┬──────────────── + │ │ ╰────────────────── definiens: 4 + ┆ ┆ + 9 │ ├─────│ ▶ } + │ │ │ + │ ╰───────────── definiens: 3 + 10 │ ╭─▶ + ┆ ┆ + 12 │ │ ├─▶ } + │ │ │ + │ │ ╰─────── definiens: 5 + 13 │ ╭─────────▶ + ┆ ┆ + 15 │ │ function foo() public virtual override { + │ │ ────────────────┬──────────────── + │ │ ╰────────────────── definiens: 7 + ┆ ┆ + 18 │ ├─────────▶ } + │ │ + │ ╰─────────────── definiens: 6 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/contracts/diamond/generated/0.6.0-success.txt b/crates/solidity/testing/snapshots/bindings_output/contracts/diamond/generated/0.6.0-success.txt new file mode 100644 index 0000000000..b902e2820b --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/contracts/diamond/generated/0.6.0-success.txt @@ -0,0 +1,77 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract A { + │ ┬ + │ ╰── name: 1 + 2 │ function foo() public virtual { + │ ─┬─ + │ ╰─── name: 2 + │ + 6 │ contract B is A { + │ ┬ ┬ + │ ╰─────── name: 3 + │ │ + │ ╰── ref: 1 + 7 │ function foo() public virtual override { + │ ─┬─ + │ ╰─── name: 4 + │ + 11 │ contract C is A { + │ ┬ ┬ + │ ╰─────── name: 5 + │ │ + │ ╰── ref: 1 + │ + 14 │ contract D is B, C { + │ ┬ ┬ ┬ + │ ╰────────── name: 6 + │ │ │ + │ ╰───── ref: 3 + │ │ + │ ╰── ref: 5 + 15 │ function foo() public virtual override { + │ ─┬─ + │ ╰─── name: 7 + 16 │ super.foo(); + │ ─┬─ + │ ╰─── refs: 4, 2 +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭───│ ──▶ contract A { + 2 │ │ ╭───▶ function foo() public virtual { + 3 │ │ ├───▶ } + │ │ │ + │ │ ╰───────────── definiens: 2 + 4 │ │ ├───────▶ } + │ │ │ + │ │ ╰───────────── definiens: 1 + 5 │ ╭───────────▶ + ┆ ┆ ┆ + 7 │ │ ╭─────▶ function foo() public virtual override { + 8 │ │ ├─────▶ } + │ │ │ + │ │ ╰─────────────── definiens: 4 + 9 │ ├─────────│ ▶ } + │ │ │ + │ ╰───────────────── definiens: 3 + 10 │ ╭─▶ + ┆ ┆ + 12 │ │ ├─▶ } + │ │ │ + │ │ ╰─────── definiens: 5 + 13 │ ╭─────────────▶ + ┆ ┆ ┆ + 15 │ │ ╭─────────▶ function foo() public virtual override { + ┆ ┆ ┆ + 17 │ │ ├─────────▶ } + │ │ │ + │ │ ╰─────────────────── definiens: 7 + 18 │ ├─────────────▶ } + │ │ + │ ╰─────────────────── definiens: 6 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_assertions/contracts/diamond.sol b/crates/solidity/testing/snapshots/bindings_output/contracts/diamond/input.sol similarity index 80% rename from crates/solidity/testing/snapshots/bindings_assertions/contracts/diamond.sol rename to crates/solidity/testing/snapshots/bindings_output/contracts/diamond/input.sol index eb1b9c294f..1c4b54d931 100644 --- a/crates/solidity/testing/snapshots/bindings_assertions/contracts/diamond.sol +++ b/crates/solidity/testing/snapshots/bindings_output/contracts/diamond/input.sol @@ -1,12 +1,10 @@ contract A { function foo() public virtual { - // ^def:1 } } contract B is A { function foo() public virtual override { - // ^def:2 } } @@ -16,6 +14,5 @@ contract C is A { contract D is B, C { function foo() public virtual override { super.foo(); - // ^ref:2 } } diff --git a/crates/solidity/testing/snapshots/bindings_output/contracts/super_linearisation/generated/0.4.11-success.txt b/crates/solidity/testing/snapshots/bindings_output/contracts/super_linearisation/generated/0.4.11-success.txt index 03245cb508..32c8607d0d 100644 --- a/crates/solidity/testing/snapshots/bindings_output/contracts/super_linearisation/generated/0.4.11-success.txt +++ b/crates/solidity/testing/snapshots/bindings_output/contracts/super_linearisation/generated/0.4.11-success.txt @@ -32,7 +32,7 @@ References and definitions: │ ╰─── name: 6 11 │ super.foo(); │ ─┬─ - │ ╰─── ref: 4 + │ ╰─── ref: 2 │ 14 │ contract D is B, C { │ ┬ ┬ ┬ @@ -46,7 +46,7 @@ References and definitions: │ ╰─── name: 8 16 │ super.foo(); │ ─┬─ - │ ╰─── ref: 6 + │ ╰─── refs: 4, 6, 2 ────╯ Definiens: ╭─[input.sol:1:1] diff --git a/crates/solidity/testing/snapshots/bindings_output/contracts/super_linearisation/input.sol b/crates/solidity/testing/snapshots/bindings_output/contracts/super_linearisation/input.sol index 417885b956..feaaf0ffc4 100644 --- a/crates/solidity/testing/snapshots/bindings_output/contracts/super_linearisation/input.sol +++ b/crates/solidity/testing/snapshots/bindings_output/contracts/super_linearisation/input.sol @@ -1,4 +1,3 @@ -// --- context: D contract A { function foo() public {} } diff --git a/crates/solidity/testing/snapshots/bindings_output/contracts/virtual_lookup/generated/0.4.11-success.txt b/crates/solidity/testing/snapshots/bindings_output/contracts/virtual_lookup/generated/0.4.11-success.txt index 0b54100137..3dacdf4358 100644 --- a/crates/solidity/testing/snapshots/bindings_output/contracts/virtual_lookup/generated/0.4.11-success.txt +++ b/crates/solidity/testing/snapshots/bindings_output/contracts/virtual_lookup/generated/0.4.11-success.txt @@ -14,7 +14,7 @@ References and definitions: │ ╰─── name: 3 4 │ foo(); │ ─┬─ - │ ╰─── ref: 5 + │ ╰─── ref: 2 │ 8 │ contract Derived is Base { │ ───┬─── ──┬─ diff --git a/crates/solidity/testing/snapshots/bindings_output/contracts/virtual_lookup/input.sol b/crates/solidity/testing/snapshots/bindings_output/contracts/virtual_lookup/input.sol index 0963149b57..e15b92e742 100644 --- a/crates/solidity/testing/snapshots/bindings_output/contracts/virtual_lookup/input.sol +++ b/crates/solidity/testing/snapshots/bindings_output/contracts/virtual_lookup/input.sol @@ -1,4 +1,3 @@ -// --- context: Derived contract Base { function foo() public {} function bar() public { diff --git a/crates/solidity/testing/snapshots/bindings_output/contracts/virtual_methods/generated/0.4.16-failure.txt b/crates/solidity/testing/snapshots/bindings_output/contracts/virtual_methods/generated/0.4.16-failure.txt index c3585c0adb..4294c861e6 100644 --- a/crates/solidity/testing/snapshots/bindings_output/contracts/virtual_methods/generated/0.4.16-failure.txt +++ b/crates/solidity/testing/snapshots/bindings_output/contracts/virtual_methods/generated/0.4.16-failure.txt @@ -59,7 +59,7 @@ References and definitions: │ ╰── ref: 5 25 │ return super.foo(); │ ─┬─ - │ ╰─── ref: 6 + │ ╰─── refs: 4, 6, 2 ────╯ Definiens: ╭─[input.sol:1:1] diff --git a/crates/solidity/testing/snapshots/bindings_output/contracts/virtual_methods/generated/0.6.0-success.txt b/crates/solidity/testing/snapshots/bindings_output/contracts/virtual_methods/generated/0.6.0-success.txt index 0a4d7f0572..4ec74aa27d 100644 --- a/crates/solidity/testing/snapshots/bindings_output/contracts/virtual_methods/generated/0.6.0-success.txt +++ b/crates/solidity/testing/snapshots/bindings_output/contracts/virtual_methods/generated/0.6.0-success.txt @@ -47,7 +47,7 @@ References and definitions: │ ╰── ref: 5 25 │ return super.foo(); │ ─┬─ - │ ╰─── ref: 6 + │ ╰─── refs: 4, 6, 2 ────╯ Definiens: ╭─[input.sol:1:1] diff --git a/crates/solidity/testing/snapshots/bindings_output/control/do_while/generated/0.4.11-success.txt b/crates/solidity/testing/snapshots/bindings_output/control/do_while/generated/0.4.11-success.txt new file mode 100644 index 0000000000..bf542d0fe8 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/control/do_while/generated/0.4.11-success.txt @@ -0,0 +1,47 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function test() public { + │ ──┬─ + │ ╰─── name: 2 + 3 │ int i = 1; + │ ┬ + │ ╰── name: 3 + │ + 5 │ int odd = i % 2; + │ ─┬─ ┬ + │ ╰─────── name: 4 + │ │ + │ ╰── ref: 3 + 6 │ i *= 3; + │ ┬ + │ ╰── ref: 3 + 7 │ } while (i < 100); + │ ┬ + │ ╰── ref: 3 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Test { + 2 │ │ ╭─▶ function test() public { + 3 │ │ │ int i = 1; + │ │ │ ─────────┬───────── + │ │ │ ╰─────────── definiens: 3 + ┆ ┆ ┆ + 5 │ │ │ int odd = i % 2; + │ │ │ ──────────────┬────────────── + │ │ │ ╰──────────────── definiens: 4 + ┆ ┆ ┆ + 8 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 9 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/control/do_while/input.sol b/crates/solidity/testing/snapshots/bindings_output/control/do_while/input.sol new file mode 100644 index 0000000000..01b7f70a20 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/control/do_while/input.sol @@ -0,0 +1,9 @@ +contract Test { + function test() public { + int i = 1; + do { + int odd = i % 2; + i *= 3; + } while (i < 100); + } +} diff --git a/crates/solidity/testing/snapshots/bindings_output/control/return_stmt/generated/0.4.11-success.txt b/crates/solidity/testing/snapshots/bindings_output/control/return_stmt/generated/0.4.11-success.txt new file mode 100644 index 0000000000..144361f139 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/control/return_stmt/generated/0.4.11-success.txt @@ -0,0 +1,34 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function test() public returns (int) { + │ ──┬─ + │ ╰─── name: 2 + 3 │ int x = 1; + │ ┬ + │ ╰── name: 3 + 4 │ return x; + │ ┬ + │ ╰── ref: 3 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Test { + 2 │ │ ╭─▶ function test() public returns (int) { + 3 │ │ │ int x = 1; + │ │ │ ─────────┬───────── + │ │ │ ╰─────────── definiens: 3 + ┆ ┆ ┆ + 5 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 6 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/control/return_stmt/input.sol b/crates/solidity/testing/snapshots/bindings_output/control/return_stmt/input.sol new file mode 100644 index 0000000000..bc65797c17 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/control/return_stmt/input.sol @@ -0,0 +1,6 @@ +contract Test { + function test() public returns (int) { + int x = 1; + return x; + } +} diff --git a/crates/solidity/testing/snapshots/bindings_output/control/unchecked/generated/0.4.11-failure.txt b/crates/solidity/testing/snapshots/bindings_output/control/unchecked/generated/0.4.11-failure.txt new file mode 100644 index 0000000000..6e0675171b --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/control/unchecked/generated/0.4.11-failure.txt @@ -0,0 +1,53 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected Identifier or MemoryKeyword or StorageKeyword. + ╭─[input.sol:4:19] + │ + 4 │ ╭─▶ unchecked { return c - b; } + 5 │ ├─▶ } + │ │ + │ ╰─────────── Error occurred here. +───╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function sub(uint a, uint b) public returns (uint) { + │ ─┬─ ┬ ┬ + │ ╰────────────────── name: 2 + │ │ │ + │ ╰────────── name: 3 + │ │ + │ ╰── name: 4 + 3 │ uint c = a; + │ ┬ ┬ + │ ╰────── name: 5 + │ │ + │ ╰── ref: 3 + 4 │ unchecked { return c - b; } + │ ────┬──── + │ ╰────── unresolved +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Test { + 2 │ │ ╭─▶ function sub(uint a, uint b) public returns (uint) { + │ │ │ ───┬── ───┬─── + │ │ │ ╰──────────── definiens: 3 + │ │ │ │ + │ │ │ ╰───── definiens: 4 + 3 │ │ │ uint c = a; + │ │ │ ──────────┬───────── + │ │ │ ╰─────────── definiens: 5 + ┆ ┆ ┆ + 5 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 6 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/control/unchecked/generated/0.5.0-failure.txt b/crates/solidity/testing/snapshots/bindings_output/control/unchecked/generated/0.5.0-failure.txt new file mode 100644 index 0000000000..6caeee07e1 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/control/unchecked/generated/0.5.0-failure.txt @@ -0,0 +1,50 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected AddressKeyword or AssemblyKeyword or BoolKeyword or BreakKeyword or ByteKeyword or BytesKeyword or CloseBrace or ContinueKeyword or DecimalLiteral or DoKeyword or DoubleQuotedHexStringLiteral or DoubleQuotedStringLiteral or EmitKeyword or FalseKeyword or FixedKeyword or ForKeyword or FunctionKeyword or HexLiteral or Identifier or IfKeyword or IntKeyword or MappingKeyword or NewKeyword or OpenBrace or OpenBracket or OpenParen or ReturnKeyword or SingleQuotedHexStringLiteral or SingleQuotedStringLiteral or StringKeyword or SuperKeyword or ThisKeyword or TrueKeyword or UfixedKeyword or UintKeyword or WhileKeyword. + ╭─[input.sol:4:9] + │ + 4 │ ╭─▶ unchecked { return c - b; } + 5 │ ├─▶ } + │ │ + │ ╰─────────── Error occurred here. +───╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function sub(uint a, uint b) public returns (uint) { + │ ─┬─ ┬ ┬ + │ ╰────────────────── name: 2 + │ │ │ + │ ╰────────── name: 3 + │ │ + │ ╰── name: 4 + 3 │ uint c = a; + │ ┬ ┬ + │ ╰────── name: 5 + │ │ + │ ╰── ref: 3 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Test { + 2 │ │ ╭─▶ function sub(uint a, uint b) public returns (uint) { + │ │ │ ───┬── ───┬─── + │ │ │ ╰──────────── definiens: 3 + │ │ │ │ + │ │ │ ╰───── definiens: 4 + 3 │ │ │ uint c = a; + │ │ │ ──────────┬───────── + │ │ │ ╰─────────── definiens: 5 + ┆ ┆ ┆ + 5 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 6 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/control/unchecked/generated/0.5.3-failure.txt b/crates/solidity/testing/snapshots/bindings_output/control/unchecked/generated/0.5.3-failure.txt new file mode 100644 index 0000000000..00829234ef --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/control/unchecked/generated/0.5.3-failure.txt @@ -0,0 +1,50 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected AddressKeyword or AssemblyKeyword or BoolKeyword or BreakKeyword or ByteKeyword or BytesKeyword or CloseBrace or ContinueKeyword or DecimalLiteral or DoKeyword or DoubleQuotedHexStringLiteral or DoubleQuotedStringLiteral or EmitKeyword or FalseKeyword or FixedKeyword or ForKeyword or FunctionKeyword or HexLiteral or Identifier or IfKeyword or IntKeyword or MappingKeyword or NewKeyword or OpenBrace or OpenBracket or OpenParen or ReturnKeyword or SingleQuotedHexStringLiteral or SingleQuotedStringLiteral or StringKeyword or SuperKeyword or ThisKeyword or TrueKeyword or TypeKeyword or UfixedKeyword or UintKeyword or WhileKeyword. + ╭─[input.sol:4:9] + │ + 4 │ ╭─▶ unchecked { return c - b; } + 5 │ ├─▶ } + │ │ + │ ╰─────────── Error occurred here. +───╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function sub(uint a, uint b) public returns (uint) { + │ ─┬─ ┬ ┬ + │ ╰────────────────── name: 2 + │ │ │ + │ ╰────────── name: 3 + │ │ + │ ╰── name: 4 + 3 │ uint c = a; + │ ┬ ┬ + │ ╰────── name: 5 + │ │ + │ ╰── ref: 3 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Test { + 2 │ │ ╭─▶ function sub(uint a, uint b) public returns (uint) { + │ │ │ ───┬── ───┬─── + │ │ │ ╰──────────── definiens: 3 + │ │ │ │ + │ │ │ ╰───── definiens: 4 + 3 │ │ │ uint c = a; + │ │ │ ──────────┬───────── + │ │ │ ╰─────────── definiens: 5 + ┆ ┆ ┆ + 5 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 6 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/control/unchecked/generated/0.6.0-failure.txt b/crates/solidity/testing/snapshots/bindings_output/control/unchecked/generated/0.6.0-failure.txt new file mode 100644 index 0000000000..fa70c8c5f3 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/control/unchecked/generated/0.6.0-failure.txt @@ -0,0 +1,50 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected AddressKeyword or AssemblyKeyword or BoolKeyword or BreakKeyword or ByteKeyword or BytesKeyword or CloseBrace or ContinueKeyword or DecimalLiteral or DoKeyword or DoubleQuotedHexStringLiteral or DoubleQuotedStringLiteral or EmitKeyword or FalseKeyword or FixedKeyword or ForKeyword or FunctionKeyword or HexLiteral or Identifier or IfKeyword or IntKeyword or MappingKeyword or NewKeyword or OpenBrace or OpenBracket or OpenParen or PayableKeyword or ReturnKeyword or SingleQuotedHexStringLiteral or SingleQuotedStringLiteral or StringKeyword or SuperKeyword or ThisKeyword or TrueKeyword or TryKeyword or TypeKeyword or UfixedKeyword or UintKeyword or WhileKeyword. + ╭─[input.sol:4:9] + │ + 4 │ ╭─▶ unchecked { return c - b; } + 5 │ ├─▶ } + │ │ + │ ╰─────────── Error occurred here. +───╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function sub(uint a, uint b) public returns (uint) { + │ ─┬─ ┬ ┬ + │ ╰────────────────── name: 2 + │ │ │ + │ ╰────────── name: 3 + │ │ + │ ╰── name: 4 + 3 │ uint c = a; + │ ┬ ┬ + │ ╰────── name: 5 + │ │ + │ ╰── ref: 3 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Test { + 2 │ │ ╭─▶ function sub(uint a, uint b) public returns (uint) { + │ │ │ ───┬── ───┬─── + │ │ │ ╰──────────── definiens: 3 + │ │ │ │ + │ │ │ ╰───── definiens: 4 + 3 │ │ │ uint c = a; + │ │ │ ──────────┬───────── + │ │ │ ╰─────────── definiens: 5 + ┆ ┆ ┆ + 5 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 6 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/control/unchecked/generated/0.7.0-failure.txt b/crates/solidity/testing/snapshots/bindings_output/control/unchecked/generated/0.7.0-failure.txt new file mode 100644 index 0000000000..f0ea1dd1d6 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/control/unchecked/generated/0.7.0-failure.txt @@ -0,0 +1,50 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected AddressKeyword or AssemblyKeyword or BoolKeyword or BreakKeyword or ByteKeyword or BytesKeyword or CloseBrace or ContinueKeyword or DecimalLiteral or DoKeyword or DoubleQuotedHexStringLiteral or DoubleQuotedStringLiteral or DoubleQuotedUnicodeStringLiteral or EmitKeyword or FalseKeyword or FixedKeyword or ForKeyword or FunctionKeyword or HexLiteral or Identifier or IfKeyword or IntKeyword or MappingKeyword or NewKeyword or OpenBrace or OpenBracket or OpenParen or PayableKeyword or ReturnKeyword or SingleQuotedHexStringLiteral or SingleQuotedStringLiteral or SingleQuotedUnicodeStringLiteral or StringKeyword or SuperKeyword or ThisKeyword or TrueKeyword or TryKeyword or TypeKeyword or UfixedKeyword or UintKeyword or WhileKeyword. + ╭─[input.sol:4:9] + │ + 4 │ ╭─▶ unchecked { return c - b; } + 5 │ ├─▶ } + │ │ + │ ╰─────────── Error occurred here. +───╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function sub(uint a, uint b) public returns (uint) { + │ ─┬─ ┬ ┬ + │ ╰────────────────── name: 2 + │ │ │ + │ ╰────────── name: 3 + │ │ + │ ╰── name: 4 + 3 │ uint c = a; + │ ┬ ┬ + │ ╰────── name: 5 + │ │ + │ ╰── ref: 3 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Test { + 2 │ │ ╭─▶ function sub(uint a, uint b) public returns (uint) { + │ │ │ ───┬── ───┬─── + │ │ │ ╰──────────── definiens: 3 + │ │ │ │ + │ │ │ ╰───── definiens: 4 + 3 │ │ │ uint c = a; + │ │ │ ──────────┬───────── + │ │ │ ╰─────────── definiens: 5 + ┆ ┆ ┆ + 5 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 6 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/control/unchecked/generated/0.8.0-success.txt b/crates/solidity/testing/snapshots/bindings_output/control/unchecked/generated/0.8.0-success.txt new file mode 100644 index 0000000000..6819e7d1f0 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/control/unchecked/generated/0.8.0-success.txt @@ -0,0 +1,46 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function sub(uint a, uint b) public returns (uint) { + │ ─┬─ ┬ ┬ + │ ╰────────────────── name: 2 + │ │ │ + │ ╰────────── name: 3 + │ │ + │ ╰── name: 4 + 3 │ uint c = a; + │ ┬ ┬ + │ ╰────── name: 5 + │ │ + │ ╰── ref: 3 + 4 │ unchecked { return c - b; } + │ ┬ ┬ + │ ╰────── ref: 5 + │ │ + │ ╰── ref: 4 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Test { + 2 │ │ ╭─▶ function sub(uint a, uint b) public returns (uint) { + │ │ │ ───┬── ───┬─── + │ │ │ ╰──────────── definiens: 3 + │ │ │ │ + │ │ │ ╰───── definiens: 4 + 3 │ │ │ uint c = a; + │ │ │ ──────────┬───────── + │ │ │ ╰─────────── definiens: 5 + ┆ ┆ ┆ + 5 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 6 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/control/unchecked/input.sol b/crates/solidity/testing/snapshots/bindings_output/control/unchecked/input.sol new file mode 100644 index 0000000000..185af02dfe --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/control/unchecked/input.sol @@ -0,0 +1,6 @@ +contract Test { + function sub(uint a, uint b) public returns (uint) { + uint c = a; + unchecked { return c - b; } + } +} diff --git a/crates/solidity/testing/snapshots/bindings_output/errors/named_args/generated/0.4.11-failure.txt b/crates/solidity/testing/snapshots/bindings_output/errors/named_args/generated/0.4.11-failure.txt new file mode 100644 index 0000000000..75794a1ca6 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/errors/named_args/generated/0.4.11-failure.txt @@ -0,0 +1,78 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected Equal or Semicolon. + ╭─[input.sol:3:19] + │ + 3 │ ╭─▶ error Failure ( + ┆ ┆ + 6 │ ├─▶ ); + │ │ + │ ╰──────────── Error occurred here. +───╯ +Error: Expected Equal or Semicolon. + ╭─[input.sol:8:23] + │ + 8 │ revert Failure({cause: Cause.NotAuthorized, details: "not owner"}); + │ ──────────────────────────┬───────────────────────── + │ ╰─────────────────────────── Error occurred here. +───╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ enum Cause { InsuficientFunds, NotAuthorized, InvalidDate } + │ ──┬── ────────┬─────── ──────┬────── ─────┬───── + │ ╰─────────────────────────────────────────────────── name: 2 + │ │ │ │ + │ ╰───────────────────────────────────── name: 3 + │ │ │ + │ ╰───────────────────── name: 4 + │ │ + │ ╰─────── name: 5 + 3 │ error Failure ( + │ ──┬── ───┬─── + │ ╰──────────── unresolved + │ │ + │ ╰───── name: 6 + │ + 7 │ function test() public { + │ ──┬─ + │ ╰─── name: 7 + 8 │ revert Failure({cause: Cause.NotAuthorized, details: "not owner"}); + │ ───┬── ───┬─── + │ ╰──────────── ref: built-in + │ │ + │ ╰───── name: 8 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─────▶ contract Test { + 2 │ │ │ enum Cause { InsuficientFunds, NotAuthorized, InvalidDate } + │ │ │ ─────────────────────────┬──────┬────────┬─────────────┬──────── + │ │ │ ╰──────────────────────────────────────── definiens: 3 + │ │ │ │ │ │ + │ │ │ ╰───────────────────────────────── definiens: 2 + │ │ │ │ │ + │ │ │ ╰──────────────────────── definiens: 4 + │ │ │ │ + │ │ │ ╰────────── definiens: 5 + 3 │ │ ╭─▶ error Failure ( + ┆ ┆ ┆ + 6 │ │ │ ├─▶ ); + │ │ │ │ + │ │ │ ╰──────────── definiens: 6 + 7 │ │ ╭───▶ function test() public { + 8 │ │ │ revert Failure({cause: Cause.NotAuthorized, details: "not owner"}); + │ │ │ ──────────────────────────────────────┬───────────────────────────────────── + │ │ │ ╰─────────────────────────────────────── definiens: 8 + 9 │ │ ├───▶ } + │ │ │ + │ │ ╰───────────── definiens: 7 + 10 │ ├─────▶ } + │ │ + │ ╰─────────── definiens: 1 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/errors/named_args/generated/0.4.22-failure.txt b/crates/solidity/testing/snapshots/bindings_output/errors/named_args/generated/0.4.22-failure.txt new file mode 100644 index 0000000000..946ca08a70 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/errors/named_args/generated/0.4.22-failure.txt @@ -0,0 +1,78 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected Equal or Semicolon. + ╭─[input.sol:3:19] + │ + 3 │ ╭─▶ error Failure ( + ┆ ┆ + 6 │ ├─▶ ); + │ │ + │ ╰──────────── Error occurred here. +───╯ +Error: Expected Equal or Semicolon. + ╭─[input.sol:8:23] + │ + 8 │ revert Failure({cause: Cause.NotAuthorized, details: "not owner"}); + │ ──────────────────────────┬───────────────────────── + │ ╰─────────────────────────── Error occurred here. +───╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ enum Cause { InsuficientFunds, NotAuthorized, InvalidDate } + │ ──┬── ────────┬─────── ──────┬────── ─────┬───── + │ ╰─────────────────────────────────────────────────── name: 2 + │ │ │ │ + │ ╰───────────────────────────────────── name: 3 + │ │ │ + │ ╰───────────────────── name: 4 + │ │ + │ ╰─────── name: 5 + 3 │ error Failure ( + │ ──┬── ───┬─── + │ ╰──────────── unresolved + │ │ + │ ╰───── name: 6 + │ + 7 │ function test() public { + │ ──┬─ + │ ╰─── name: 7 + 8 │ revert Failure({cause: Cause.NotAuthorized, details: "not owner"}); + │ ───┬── ───┬─── + │ ╰──────────── refs: built-in, built-in + │ │ + │ ╰───── name: 8 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─────▶ contract Test { + 2 │ │ │ enum Cause { InsuficientFunds, NotAuthorized, InvalidDate } + │ │ │ ─────────────────────────┬──────┬────────┬─────────────┬──────── + │ │ │ ╰──────────────────────────────────────── definiens: 3 + │ │ │ │ │ │ + │ │ │ ╰───────────────────────────────── definiens: 2 + │ │ │ │ │ + │ │ │ ╰──────────────────────── definiens: 4 + │ │ │ │ + │ │ │ ╰────────── definiens: 5 + 3 │ │ ╭─▶ error Failure ( + ┆ ┆ ┆ + 6 │ │ │ ├─▶ ); + │ │ │ │ + │ │ │ ╰──────────── definiens: 6 + 7 │ │ ╭───▶ function test() public { + 8 │ │ │ revert Failure({cause: Cause.NotAuthorized, details: "not owner"}); + │ │ │ ──────────────────────────────────────┬───────────────────────────────────── + │ │ │ ╰─────────────────────────────────────── definiens: 8 + 9 │ │ ├───▶ } + │ │ │ + │ │ ╰───────────── definiens: 7 + 10 │ ├─────▶ } + │ │ + │ ╰─────────── definiens: 1 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/errors/named_args/generated/0.8.4-success.txt b/crates/solidity/testing/snapshots/bindings_output/errors/named_args/generated/0.8.4-success.txt new file mode 100644 index 0000000000..8450347e33 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/errors/named_args/generated/0.8.4-success.txt @@ -0,0 +1,76 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ enum Cause { InsuficientFunds, NotAuthorized, InvalidDate } + │ ──┬── ────────┬─────── ──────┬────── ─────┬───── + │ ╰─────────────────────────────────────────────────── name: 2 + │ │ │ │ + │ ╰───────────────────────────────────── name: 3 + │ │ │ + │ ╰───────────────────── name: 4 + │ │ + │ ╰─────── name: 5 + 3 │ error Failure ( + │ ───┬─── + │ ╰───── name: 6 + 4 │ Cause cause, + │ ──┬── ──┬── + │ ╰────────── ref: 2 + │ │ + │ ╰──── name: 7 + 5 │ string details + │ ───┬─── + │ ╰───── name: 8 + │ + 7 │ function test() public { + │ ──┬─ + │ ╰─── name: 9 + 8 │ revert Failure({cause: Cause.NotAuthorized, details: "not owner"}); + │ ───┬─── ──┬── ──┬── ──────┬────── ───┬─── + │ ╰────────────────────────────────────────── ref: 6 + │ │ │ │ │ + │ ╰────────────────────────────────── ref: 7 + │ │ │ │ + │ ╰─────────────────────────── ref: 2 + │ │ │ + │ ╰───────────────── ref: 4 + │ │ + │ ╰───── ref: 8 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─────▶ contract Test { + 2 │ │ │ enum Cause { InsuficientFunds, NotAuthorized, InvalidDate } + │ │ │ ─────────────────────────┬──────┬────────┬─────────────┬──────── + │ │ │ ╰──────────────────────────────────────── definiens: 3 + │ │ │ │ │ │ + │ │ │ ╰───────────────────────────────── definiens: 2 + │ │ │ │ │ + │ │ │ ╰──────────────────────── definiens: 4 + │ │ │ │ + │ │ │ ╰────────── definiens: 5 + 3 │ │ ╭─▶ error Failure ( + 4 │ │ │ Cause cause, + │ │ │ ─────────┬───────── + │ │ │ ╰─────────── definiens: 7 + 5 │ │ │ string details + │ │ │ ───────────┬─────────── + │ │ │ ╰───────────── definiens: 8 + 6 │ │ │ ├─▶ ); + │ │ │ │ + │ │ │ ╰──────────── definiens: 6 + 7 │ │ ╭───▶ function test() public { + ┆ ┆ ┆ + 9 │ │ ├───▶ } + │ │ │ + │ │ ╰───────────── definiens: 9 + 10 │ ├─────▶ } + │ │ + │ ╰─────────── definiens: 1 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_assertions/errors/named_args.sol b/crates/solidity/testing/snapshots/bindings_output/errors/named_args/input.sol similarity index 54% rename from crates/solidity/testing/snapshots/bindings_assertions/errors/named_args.sol rename to crates/solidity/testing/snapshots/bindings_output/errors/named_args/input.sol index 4258aa3142..42837d77c8 100644 --- a/crates/solidity/testing/snapshots/bindings_assertions/errors/named_args.sol +++ b/crates/solidity/testing/snapshots/bindings_output/errors/named_args/input.sol @@ -1,16 +1,10 @@ contract Test { enum Cause { InsuficientFunds, NotAuthorized, InvalidDate } - // ^def:3 error Failure ( Cause cause, - // ^def:1 string details - // ^def:2 ); function test() public { revert Failure({cause: Cause.NotAuthorized, details: "not owner"}); - // ^ref:1 (>= 0.8.4) - // ^ref:3 (>= 0.8.4) - // ^ref:2 (>= 0.8.4) } } diff --git a/crates/solidity/testing/snapshots/bindings_output/errors/revert_stmt/generated/0.4.11-failure.txt b/crates/solidity/testing/snapshots/bindings_output/errors/revert_stmt/generated/0.4.11-failure.txt new file mode 100644 index 0000000000..b5c9084121 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/errors/revert_stmt/generated/0.4.11-failure.txt @@ -0,0 +1,111 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected Equal or Semicolon. + ╭─[input.sol:2:23] + │ + 2 │ error InvalidState(); + │ ─┬ + │ ╰── Error occurred here. +───╯ +Error: Expected Equal or Semicolon. + ╭─[input.sol:5:28] + │ + 5 │ revert InvalidState(); + │ ─┬ + │ ╰── Error occurred here. +───╯ +Error: Expected Equal or Semicolon. + ╭─[input.sol:10:21] + │ + 10 │ revert Utils.GenericError(code); + │ ─────────┬───────── + │ ╰─────────── Error occurred here. +────╯ +Error: Expected Equal or Semicolon. + ╭─[input.sol:15:23] + │ + 15 │ error GenericError(int code); + │ ─────┬──── + │ ╰────── Error occurred here. +────╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ error InvalidState(); + │ ──┬── ──────┬───── + │ ╰───────────────── unresolved + │ │ + │ ╰─────── name: 2 + │ + 4 │ function testRevert() public { + │ ─────┬──── + │ ╰────── name: 3 + 5 │ revert InvalidState(); + │ ───┬── ──────┬───── + │ ╰───────────────── ref: built-in + │ │ + │ ╰─────── name: 4 + │ + 8 │ function testOtherRevert() public { + │ ───────┬─────── + │ ╰───────── name: 5 + 9 │ int code = 10; + │ ──┬─ + │ ╰─── name: 6 + 10 │ revert Utils.GenericError(code); + │ ───┬── ──┬── + │ ╰────────── ref: built-in + │ │ + │ ╰──── name: 7 + │ + 14 │ library Utils { + │ ──┬── + │ ╰──── name: 8 + 15 │ error GenericError(int code); + │ ──┬── ──────┬───── + │ ╰───────────────── unresolved + │ │ + │ ╰─────── name: 9 +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭───────▶ contract Test { + 2 │ │ │ error InvalidState(); + │ │ │ ─────────────┬──────────── + │ │ │ ╰────────────── definiens: 2 + 3 │ │ ╭───▶ + ┆ ┆ ┆ + 5 │ │ │ revert InvalidState(); + │ │ │ ───────────────┬─────────────── + │ │ │ ╰───────────────── definiens: 4 + 6 │ │ │ ├───▶ } + │ │ │ │ + │ │ │ ╰───────────── definiens: 3 + 7 │ │ ╭─────▶ + ┆ ┆ ┆ + 9 │ │ │ int code = 10; + │ │ │ ───────────┬─────────── + │ │ │ ╰───────────── definiens: 6 + 10 │ │ │ revert Utils.GenericError(code); + │ │ │ ────────────────────┬──────────────────── + │ │ │ ╰────────────────────── definiens: 7 + 11 │ │ ├─────▶ } + │ │ │ + │ │ ╰─────────────── definiens: 5 + 12 │ ├─────│ ▶ } + │ │ │ + │ ╰───────────── definiens: 1 + 13 │ ╭─▶ + ┆ ┆ + 15 │ │ error GenericError(int code); + │ │ ─────────────────┬──────────────── + │ │ ╰────────────────── definiens: 9 + 16 │ ├─▶ } + │ │ + │ ╰─────── definiens: 8 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/errors/revert_stmt/generated/0.4.22-failure.txt b/crates/solidity/testing/snapshots/bindings_output/errors/revert_stmt/generated/0.4.22-failure.txt new file mode 100644 index 0000000000..a8132e3b90 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/errors/revert_stmt/generated/0.4.22-failure.txt @@ -0,0 +1,111 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected Equal or Semicolon. + ╭─[input.sol:2:23] + │ + 2 │ error InvalidState(); + │ ─┬ + │ ╰── Error occurred here. +───╯ +Error: Expected Equal or Semicolon. + ╭─[input.sol:5:28] + │ + 5 │ revert InvalidState(); + │ ─┬ + │ ╰── Error occurred here. +───╯ +Error: Expected Equal or Semicolon. + ╭─[input.sol:10:21] + │ + 10 │ revert Utils.GenericError(code); + │ ─────────┬───────── + │ ╰─────────── Error occurred here. +────╯ +Error: Expected Equal or Semicolon. + ╭─[input.sol:15:23] + │ + 15 │ error GenericError(int code); + │ ─────┬──── + │ ╰────── Error occurred here. +────╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ error InvalidState(); + │ ──┬── ──────┬───── + │ ╰───────────────── unresolved + │ │ + │ ╰─────── name: 2 + │ + 4 │ function testRevert() public { + │ ─────┬──── + │ ╰────── name: 3 + 5 │ revert InvalidState(); + │ ───┬── ──────┬───── + │ ╰───────────────── refs: built-in, built-in + │ │ + │ ╰─────── name: 4 + │ + 8 │ function testOtherRevert() public { + │ ───────┬─────── + │ ╰───────── name: 5 + 9 │ int code = 10; + │ ──┬─ + │ ╰─── name: 6 + 10 │ revert Utils.GenericError(code); + │ ───┬── ──┬── + │ ╰────────── refs: built-in, built-in + │ │ + │ ╰──── name: 7 + │ + 14 │ library Utils { + │ ──┬── + │ ╰──── name: 8 + 15 │ error GenericError(int code); + │ ──┬── ──────┬───── + │ ╰───────────────── unresolved + │ │ + │ ╰─────── name: 9 +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭───────▶ contract Test { + 2 │ │ │ error InvalidState(); + │ │ │ ─────────────┬──────────── + │ │ │ ╰────────────── definiens: 2 + 3 │ │ ╭───▶ + ┆ ┆ ┆ + 5 │ │ │ revert InvalidState(); + │ │ │ ───────────────┬─────────────── + │ │ │ ╰───────────────── definiens: 4 + 6 │ │ │ ├───▶ } + │ │ │ │ + │ │ │ ╰───────────── definiens: 3 + 7 │ │ ╭─────▶ + ┆ ┆ ┆ + 9 │ │ │ int code = 10; + │ │ │ ───────────┬─────────── + │ │ │ ╰───────────── definiens: 6 + 10 │ │ │ revert Utils.GenericError(code); + │ │ │ ────────────────────┬──────────────────── + │ │ │ ╰────────────────────── definiens: 7 + 11 │ │ ├─────▶ } + │ │ │ + │ │ ╰─────────────── definiens: 5 + 12 │ ├─────│ ▶ } + │ │ │ + │ ╰───────────── definiens: 1 + 13 │ ╭─▶ + ┆ ┆ + 15 │ │ error GenericError(int code); + │ │ ─────────────────┬──────────────── + │ │ ╰────────────────── definiens: 9 + 16 │ ├─▶ } + │ │ + │ ╰─────── definiens: 8 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/errors/revert_stmt/generated/0.8.4-success.txt b/crates/solidity/testing/snapshots/bindings_output/errors/revert_stmt/generated/0.8.4-success.txt new file mode 100644 index 0000000000..bef9b88a37 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/errors/revert_stmt/generated/0.8.4-success.txt @@ -0,0 +1,77 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ error InvalidState(); + │ ──────┬───── + │ ╰─────── name: 2 + │ + 4 │ function testRevert() public { + │ ─────┬──── + │ ╰────── name: 3 + 5 │ revert InvalidState(); + │ ──────┬───── + │ ╰─────── ref: 2 + │ + 8 │ function testOtherRevert() public { + │ ───────┬─────── + │ ╰───────── name: 4 + 9 │ int code = 10; + │ ──┬─ + │ ╰─── name: 5 + 10 │ revert Utils.GenericError(code); + │ ──┬── ──────┬───── ──┬─ + │ ╰────────────────────── ref: 6 + │ │ │ + │ ╰──────────── ref: 7 + │ │ + │ ╰─── ref: 5 + │ + 14 │ library Utils { + │ ──┬── + │ ╰──── name: 6 + 15 │ error GenericError(int code); + │ ──────┬───── ──┬─ + │ ╰──────────────── name: 7 + │ │ + │ ╰─── name: 8 +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭───────▶ contract Test { + 2 │ │ │ error InvalidState(); + │ │ │ ─────────────┬──────────── + │ │ │ ╰────────────── definiens: 2 + 3 │ │ ╭───▶ + ┆ ┆ ┆ + 6 │ │ │ ├───▶ } + │ │ │ │ + │ │ │ ╰───────────── definiens: 3 + 7 │ │ ╭─────▶ + ┆ ┆ ┆ + 9 │ │ │ int code = 10; + │ │ │ ───────────┬─────────── + │ │ │ ╰───────────── definiens: 5 + ┆ ┆ ┆ + 11 │ │ ├─────▶ } + │ │ │ + │ │ ╰─────────────── definiens: 4 + 12 │ ├─────│ ▶ } + │ │ │ + │ ╰───────────── definiens: 1 + 13 │ ╭─▶ + ┆ ┆ + 15 │ │ error GenericError(int code); + │ │ ─────────────────┬─────────┬────── + │ │ ╰────────────────── definiens: 7 + │ │ │ + │ │ ╰──────── definiens: 8 + 16 │ ├─▶ } + │ │ + │ ╰─────── definiens: 6 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_assertions/errors/revert_stmt.sol b/crates/solidity/testing/snapshots/bindings_output/errors/revert_stmt/input.sol similarity index 55% rename from crates/solidity/testing/snapshots/bindings_assertions/errors/revert_stmt.sol rename to crates/solidity/testing/snapshots/bindings_output/errors/revert_stmt/input.sol index 189ed28f4b..3e2306e87b 100644 --- a/crates/solidity/testing/snapshots/bindings_assertions/errors/revert_stmt.sol +++ b/crates/solidity/testing/snapshots/bindings_output/errors/revert_stmt/input.sol @@ -1,24 +1,16 @@ contract Test { error InvalidState(); - // ^def:1 function testRevert() public { revert InvalidState(); - // ^ref:1 (>= 0.8.4) } function testOtherRevert() public { int code = 10; - // ^def:2 revert Utils.GenericError(code); - // ^ref:2 (>= 0.8.4) - // ^ref:4 (>= 0.8.4) - // ^ref:3 (>= 0.8.4) } } library Utils { - // ^def:3 error GenericError(int code); - // ^def:4 } diff --git a/crates/solidity/testing/snapshots/bindings_output/events/emit_stmt/generated/0.4.11-failure.txt b/crates/solidity/testing/snapshots/bindings_output/events/emit_stmt/generated/0.4.11-failure.txt new file mode 100644 index 0000000000..28ad656606 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/events/emit_stmt/generated/0.4.11-failure.txt @@ -0,0 +1,94 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected Equal or Semicolon. + ╭─[input.sol:7:23] + │ + 7 │ emit TestEvent(x); + │ ─┬─ + │ ╰─── Error occurred here. +───╯ +Error: Expected Equal or Semicolon. + ╭─[input.sol:8:19] + │ + 8 │ emit Utils.Debug(x); + │ ────┬──── + │ ╰────── Error occurred here. +───╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ event TestEvent(int id); + │ ────┬──── ─┬ + │ ╰───────────── name: 2 + │ │ + │ ╰── name: 3 + │ + 4 │ function test_emit() public { + │ ────┬──── + │ ╰────── name: 4 + 5 │ int x = 1; + │ ┬ + │ ╰── name: 5 + │ + 7 │ emit TestEvent(x); + │ ──┬─ ────┬──── + │ ╰───────────── unresolved + │ │ + │ ╰────── name: 6 + 8 │ emit Utils.Debug(x); + │ ──┬─ ──┬── + │ ╰───────── unresolved + │ │ + │ ╰──── name: 7 + │ + 12 │ library Utils { + │ ──┬── + │ ╰──── name: 8 + 13 │ event Debug(int subject); + │ ──┬── ───┬─── + │ ╰──────────────── name: 9 + │ │ + │ ╰───── name: 10 +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭───────▶ contract Test { + 2 │ │ │ event TestEvent(int id); + │ │ │ ──────────────┬────────┬───── + │ │ │ ╰──────────────── definiens: 2 + │ │ │ │ + │ │ │ ╰─────── definiens: 3 + 3 │ │ ╭─────▶ + ┆ ┆ ┆ + 5 │ │ │ │ int x = 1; + │ │ │ │ ─────────┬───────── + │ │ │ │ ╰─────────── definiens: 5 + 6 │ │ │ ╭─▶ + 7 │ │ │ ├─▶ emit TestEvent(x); + │ │ │ │ + │ │ │ ╰──────────────────────────────── definiens: 6 + 8 │ │ │ emit Utils.Debug(x); + │ │ │ ──────────────┬────────────── + │ │ │ ╰──────────────── definiens: 7 + 9 │ │ ├─────▶ } + │ │ │ + │ │ ╰─────────────── definiens: 4 + 10 │ ├───│ ──▶ } + │ │ │ + │ ╰───────────── definiens: 1 + 11 │ ╭───▶ + ┆ ┆ + 13 │ │ event Debug(int subject); + │ │ ───────────────┬─────┬──────── + │ │ ╰──────────────── definiens: 9 + │ │ │ + │ │ ╰────────── definiens: 10 + 14 │ ├───▶ } + │ │ + │ ╰───────── definiens: 8 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/events/emit_stmt/generated/0.4.21-success.txt b/crates/solidity/testing/snapshots/bindings_output/events/emit_stmt/generated/0.4.21-success.txt new file mode 100644 index 0000000000..2593cd01a4 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/events/emit_stmt/generated/0.4.21-success.txt @@ -0,0 +1,75 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ event TestEvent(int id); + │ ────┬──── ─┬ + │ ╰───────────── name: 2 + │ │ + │ ╰── name: 3 + │ + 4 │ function test_emit() public { + │ ────┬──── + │ ╰────── name: 4 + 5 │ int x = 1; + │ ┬ + │ ╰── name: 5 + │ + 7 │ emit TestEvent(x); + │ ────┬──── ┬ + │ ╰──────── ref: 2 + │ │ + │ ╰── ref: 5 + 8 │ emit Utils.Debug(x); + │ ──┬── ──┬── ┬ + │ ╰──────────── ref: 6 + │ │ │ + │ ╰────── ref: 7 + │ │ + │ ╰── ref: 5 + │ + 12 │ library Utils { + │ ──┬── + │ ╰──── name: 6 + 13 │ event Debug(int subject); + │ ──┬── ───┬─── + │ ╰──────────────── name: 7 + │ │ + │ ╰───── name: 8 +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─────▶ contract Test { + 2 │ │ │ event TestEvent(int id); + │ │ │ ──────────────┬────────┬───── + │ │ │ ╰──────────────── definiens: 2 + │ │ │ │ + │ │ │ ╰─────── definiens: 3 + 3 │ │ ╭───▶ + ┆ ┆ ┆ + 5 │ │ │ int x = 1; + │ │ │ ─────────┬───────── + │ │ │ ╰─────────── definiens: 5 + ┆ ┆ ┆ + 9 │ │ ├───▶ } + │ │ │ + │ │ ╰───────────── definiens: 4 + 10 │ ├───│ ▶ } + │ │ │ + │ ╰─────────── definiens: 1 + 11 │ ╭─▶ + ┆ ┆ + 13 │ │ event Debug(int subject); + │ │ ───────────────┬─────┬──────── + │ │ ╰──────────────── definiens: 7 + │ │ │ + │ │ ╰────────── definiens: 8 + 14 │ ├─▶ } + │ │ + │ ╰─────── definiens: 6 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/events/emit_stmt/input.sol b/crates/solidity/testing/snapshots/bindings_output/events/emit_stmt/input.sol new file mode 100644 index 0000000000..cd6492aa21 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/events/emit_stmt/input.sol @@ -0,0 +1,14 @@ +contract Test { + event TestEvent(int id); + + function test_emit() public { + int x = 1; + + emit TestEvent(x); + emit Utils.Debug(x); + } +} + +library Utils { + event Debug(int subject); +} diff --git a/crates/solidity/testing/snapshots/bindings_output/events/named_args/generated/0.4.11-failure.txt b/crates/solidity/testing/snapshots/bindings_output/events/named_args/generated/0.4.11-failure.txt new file mode 100644 index 0000000000..336e7179ea --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/events/named_args/generated/0.4.11-failure.txt @@ -0,0 +1,79 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected Equal or Semicolon. + ╭─[input.sol:10:17] + │ + 10 │ emit Log({message: "testing", level: Severity.Info}); + │ ──────────────────────┬───────────────────── + │ ╰─────────────────────── Error occurred here. +────╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ enum Severity { Info, Error } + │ ────┬─── ──┬─ ──┬── + │ ╰─────────────────── name: 2 + │ │ │ + │ ╰────────── name: 3 + │ │ + │ ╰──── name: 4 + │ + 4 │ event Log ( + │ ─┬─ + │ ╰─── name: 5 + 5 │ Severity level, + │ ────┬─── ──┬── + │ ╰─────────── ref: 2 + │ │ + │ ╰──── name: 6 + 6 │ string message + │ ───┬─── + │ ╰───── name: 7 + │ + 9 │ function test() { + │ ──┬─ + │ ╰─── name: 8 + 10 │ emit Log({message: "testing", level: Severity.Info}); + │ ──┬─ ─┬─ + │ ╰─────── unresolved + │ │ + │ ╰─── name: 9 +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─────▶ contract Test { + 2 │ │ │ enum Severity { Info, Error } + │ │ │ ─────────────────┬────┬─────┬───── + │ │ │ ╰────────────────── definiens: 2 + │ │ │ │ │ + │ │ │ ╰───────────── definiens: 3 + │ │ │ │ + │ │ │ ╰─────── definiens: 4 + 3 │ │ ╭─▶ + ┆ ┆ ┆ + 5 │ │ │ Severity level, + │ │ │ ───────────┬────────── + │ │ │ ╰──────────── definiens: 6 + 6 │ │ │ string message + │ │ │ ───────────┬─────────── + │ │ │ ╰───────────── definiens: 7 + 7 │ │ │ ├─▶ ); + │ │ │ │ + │ │ │ ╰──────────── definiens: 5 + 8 │ │ ╭───▶ + ┆ ┆ ┆ + 10 │ │ │ emit Log({message: "testing", level: Severity.Info}); + │ │ │ ───────────────────────────────┬────────────────────────────── + │ │ │ ╰──────────────────────────────── definiens: 9 + 11 │ │ ├───▶ } + │ │ │ + │ │ ╰───────────── definiens: 8 + 12 │ ├─────▶ } + │ │ + │ ╰─────────── definiens: 1 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/events/named_args/generated/0.4.21-success.txt b/crates/solidity/testing/snapshots/bindings_output/events/named_args/generated/0.4.21-success.txt new file mode 100644 index 0000000000..2e9248fa6c --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/events/named_args/generated/0.4.21-success.txt @@ -0,0 +1,74 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ enum Severity { Info, Error } + │ ────┬─── ──┬─ ──┬── + │ ╰─────────────────── name: 2 + │ │ │ + │ ╰────────── name: 3 + │ │ + │ ╰──── name: 4 + │ + 4 │ event Log ( + │ ─┬─ + │ ╰─── name: 5 + 5 │ Severity level, + │ ────┬─── ──┬── + │ ╰─────────── ref: 2 + │ │ + │ ╰──── name: 6 + 6 │ string message + │ ───┬─── + │ ╰───── name: 7 + │ + 9 │ function test() { + │ ──┬─ + │ ╰─── name: 8 + 10 │ emit Log({message: "testing", level: Severity.Info}); + │ ─┬─ ───┬─── ──┬── ────┬─── ──┬─ + │ ╰───────────────────────────────────────────── ref: 5 + │ │ │ │ │ + │ ╰────────────────────────────────────── ref: 7 + │ │ │ │ + │ ╰─────────────────── ref: 6 + │ │ │ + │ ╰────────── ref: 2 + │ │ + │ ╰─── ref: 3 +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─────▶ contract Test { + 2 │ │ │ enum Severity { Info, Error } + │ │ │ ─────────────────┬────┬─────┬───── + │ │ │ ╰────────────────── definiens: 2 + │ │ │ │ │ + │ │ │ ╰───────────── definiens: 3 + │ │ │ │ + │ │ │ ╰─────── definiens: 4 + 3 │ │ ╭─▶ + ┆ ┆ ┆ + 5 │ │ │ Severity level, + │ │ │ ───────────┬────────── + │ │ │ ╰──────────── definiens: 6 + 6 │ │ │ string message + │ │ │ ───────────┬─────────── + │ │ │ ╰───────────── definiens: 7 + 7 │ │ │ ├─▶ ); + │ │ │ │ + │ │ │ ╰──────────── definiens: 5 + 8 │ │ ╭───▶ + ┆ ┆ ┆ + 11 │ │ ├───▶ } + │ │ │ + │ │ ╰───────────── definiens: 8 + 12 │ ├─────▶ } + │ │ + │ ╰─────────── definiens: 1 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/events/named_args/input.sol b/crates/solidity/testing/snapshots/bindings_output/events/named_args/input.sol new file mode 100644 index 0000000000..b06c4b10b9 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/events/named_args/input.sol @@ -0,0 +1,12 @@ +contract Test { + enum Severity { Info, Error } + + event Log ( + Severity level, + string message + ); + + function test() { + emit Log({message: "testing", level: Severity.Info}); + } +} diff --git a/crates/solidity/testing/snapshots/bindings_output/expressions/basic/generated/0.4.11-success.txt b/crates/solidity/testing/snapshots/bindings_output/expressions/basic/generated/0.4.11-success.txt new file mode 100644 index 0000000000..b931a3954b --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/expressions/basic/generated/0.4.11-success.txt @@ -0,0 +1,48 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function playground() public returns (int) { + │ ─────┬──── + │ ╰────── name: 2 + 3 │ int x = 1; + │ ┬ + │ ╰── name: 3 + 4 │ int y = x + 2; + │ ┬ ┬ + │ ╰────── name: 4 + │ │ + │ ╰── ref: 3 + 5 │ return (x + y * x) / y; + │ ┬ ┬ ┬ ┬ + │ ╰─────────────── ref: 3 + │ │ │ │ + │ ╰─────────── ref: 4 + │ │ │ + │ ╰─────── ref: 3 + │ │ + │ ╰── ref: 4 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Test { + 2 │ │ ╭─▶ function playground() public returns (int) { + 3 │ │ │ int x = 1; + │ │ │ ─────────┬───────── + │ │ │ ╰─────────── definiens: 3 + 4 │ │ │ int y = x + 2; + │ │ │ ───────────┬─────────── + │ │ │ ╰───────────── definiens: 4 + ┆ ┆ ┆ + 6 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 7 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/expressions/basic/input.sol b/crates/solidity/testing/snapshots/bindings_output/expressions/basic/input.sol new file mode 100644 index 0000000000..427be24e39 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/expressions/basic/input.sol @@ -0,0 +1,7 @@ +contract Test { + function playground() public returns (int) { + int x = 1; + int y = x + 2; + return (x + y * x) / y; + } +} diff --git a/crates/solidity/testing/snapshots/bindings_output/function_types/args_return_types/generated/0.4.11-success.txt b/crates/solidity/testing/snapshots/bindings_output/function_types/args_return_types/generated/0.4.11-success.txt new file mode 100644 index 0000000000..40162b078f --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/function_types/args_return_types/generated/0.4.11-success.txt @@ -0,0 +1,107 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ struct Coords { + │ ───┬── + │ ╰──── name: 2 + 3 │ int x; + │ ┬ + │ ╰── name: 3 + 4 │ int y; + │ ┬ + │ ╰── name: 4 + │ + 6 │ enum HitTest { + │ ───┬─── + │ ╰───── name: 5 + 7 │ Inside, + │ ───┬── + │ ╰──── name: 6 + 8 │ Outside + │ ───┬─── + │ ╰───── name: 7 + │ + 10 │ struct Box { + │ ─┬─ + │ ╰─── name: 8 + 11 │ function (Coords memory) external returns (HitTest) hitTest; + │ ───┬── ───┬─── ───┬─── + │ ╰─────────────────────────────────────────────── ref: 2 + │ │ │ + │ ╰────────────── ref: 5 + │ │ + │ ╰───── name: 9 + │ + 14 │ function insideBox(Box memory b, Coords memory p) public returns (bool) { + │ ────┬──── ─┬─ ┬ ───┬── ┬ + │ ╰──────────────────────────────────── name: 10 + │ │ │ │ │ + │ ╰───────────────────────────── ref: 8 + │ │ │ │ + │ ╰─────────────────── name: 11 + │ │ │ + │ ╰───────────── ref: 2 + │ │ + │ ╰── name: 12 + 15 │ return b.hitTest(p) == HitTest.Inside; + │ ┬ ───┬─── ┬ ───┬─── ───┬── + │ ╰─────────────────────────────── ref: 11 + │ │ │ │ │ + │ ╰────────────────────────── ref: 9 + │ │ │ │ + │ ╰───────────────────── ref: 12 + │ │ │ + │ ╰──────────── ref: 5 + │ │ + │ ╰──── ref: 6 +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭───────│ ▶ contract Test { + 2 │ │ ╭─▶ struct Coords { + 3 │ │ │ int x; + │ │ │ ───────┬─────── + │ │ │ ╰───────── definiens: 3 + 4 │ │ │ int y; + │ │ │ ───────┬─────── + │ │ │ ╰───────── definiens: 4 + 5 │ │ │ ├─▶ } + │ │ │ │ + │ │ │ ╰─────────── definiens: 2 + 6 │ │ ╭───▶ enum HitTest { + 7 │ │ │ Inside, + │ │ │ ───┬── + │ │ │ ╰──── definiens: 6 + 8 │ │ │ Outside + │ │ │ ───┬─── + │ │ │ ╰───── definiens: 7 + 9 │ │ │ ├───▶ } + │ │ │ │ + │ │ │ ╰───────────── definiens: 5 + 10 │ │ ╭─────▶ struct Box { + 11 │ │ │ function (Coords memory) external returns (HitTest) hitTest; + │ │ │ ──────────────────────────────────┬────────────────────────────────── + │ │ │ ╰──────────────────────────────────── definiens: 9 + 12 │ │ │ ├─────▶ } + │ │ │ │ + │ │ │ ╰─────────────── definiens: 8 + 13 │ │ ╭───────▶ + 14 │ │ │ function insideBox(Box memory b, Coords memory p) public returns (bool) { + │ │ │ ──────┬───── ────────┬─────── + │ │ │ ╰──────────────────────── definiens: 11 + │ │ │ │ + │ │ │ ╰───────── definiens: 12 + ┆ ┆ ┆ + 16 │ │ ├───────▶ } + │ │ │ + │ │ ╰───────────────── definiens: 10 + 17 │ ├─────────▶ } + │ │ + │ ╰─────────────── definiens: 1 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/function_types/args_return_types/input.sol b/crates/solidity/testing/snapshots/bindings_output/function_types/args_return_types/input.sol new file mode 100644 index 0000000000..c46817b725 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/function_types/args_return_types/input.sol @@ -0,0 +1,17 @@ +contract Test { + struct Coords { + int x; + int y; + } + enum HitTest { + Inside, + Outside + } + struct Box { + function (Coords memory) external returns (HitTest) hitTest; + } + + function insideBox(Box memory b, Coords memory p) public returns (bool) { + return b.hitTest(p) == HitTest.Inside; + } +} diff --git a/crates/solidity/testing/snapshots/bindings_output/imports/deconstruction/generated/0.4.11-success.txt b/crates/solidity/testing/snapshots/bindings_output/imports/deconstruction/generated/0.4.11-success.txt new file mode 100644 index 0000000000..60cdaebc76 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/imports/deconstruction/generated/0.4.11-success.txt @@ -0,0 +1,98 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[main.sol:1:1] + │ + 1 │ import {Foo} from "lib/foo.sol"; + │ ─┬─ + │ ╰─── name: 1 + │ │ + │ ╰─── ref: 5 + 2 │ import {Bar as LocalBar} from "lib/bar.sol"; + │ ─┬─ ────┬─── + │ ╰─────────────── ref: 7 + │ │ + │ ╰───── name: 2 + │ + 4 │ contract Sample { + │ ───┬── + │ ╰──── name: 3 + 5 │ function test() returns (int) { + │ ──┬─ + │ ╰─── name: 4 + 6 │ return Foo.foo() + LocalBar.bar(); + │ ─┬─ ─┬─ ────┬─── ─┬─ + │ ╰──────────────────────── refs: 1, 5 + │ │ │ │ + │ ╰──────────────────── ref: 6 + │ │ │ + │ ╰───────── refs: 2, 7 + │ │ + │ ╰─── ref: 8 +───╯ +Definiens: + ╭─[main.sol:1:1] + │ + 1 │ import {Foo} from "lib/foo.sol"; + │ ─┬─ + │ ╰─── definiens: 1 + 2 │ │ import {Bar as LocalBar} from "lib/bar.sol"; + │ │ ───────┬─────── + │ │ ╰───────── definiens: 2 + 3 │ ╭───▶ + ┆ ┆ ┆ + 5 │ │ ╭─▶ function test() returns (int) { + ┆ ┆ ┆ + 7 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 4 + 8 │ ├───▶ } + │ │ + │ ╰───────── definiens: 3 +───╯ +References and definitions: + ╭─[lib/foo.sol:1:1] + │ + 1 │ library Foo { + │ ─┬─ + │ ╰─── name: 5 + 2 │ function foo() returns (int) { + │ ─┬─ + │ ╰─── name: 6 +───╯ +Definiens: + ╭─[lib/foo.sol:1:1] + │ + 1 │ ╭─│ ▶ library Foo { + 2 │ │ ╭─▶ function foo() returns (int) { + ┆ ┆ ┆ + 4 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 6 + 5 │ ├───▶ } + │ │ + │ ╰───────── definiens: 5 +───╯ +References and definitions: + ╭─[lib/bar.sol:1:1] + │ + 1 │ library Bar { + │ ─┬─ + │ ╰─── name: 7 + 2 │ function bar() returns (int) { + │ ─┬─ + │ ╰─── name: 8 +───╯ +Definiens: + ╭─[lib/bar.sol:1:1] + │ + 1 │ ╭─│ ▶ library Bar { + 2 │ │ ╭─▶ function bar() returns (int) { + ┆ ┆ ┆ + 4 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 8 + 5 │ ├───▶ } + │ │ + │ ╰───────── definiens: 7 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_assertions/imports/deconstruction_imports.sol b/crates/solidity/testing/snapshots/bindings_output/imports/deconstruction/input.sol similarity index 60% rename from crates/solidity/testing/snapshots/bindings_assertions/imports/deconstruction_imports.sol rename to crates/solidity/testing/snapshots/bindings_output/imports/deconstruction/input.sol index 4a43c59031..a2b0ec04bd 100644 --- a/crates/solidity/testing/snapshots/bindings_assertions/imports/deconstruction_imports.sol +++ b/crates/solidity/testing/snapshots/bindings_output/imports/deconstruction/input.sol @@ -1,35 +1,23 @@ // --- path: main.sol import {Foo} from "lib/foo.sol"; -// ^def:4 -// ^ref:6 import {Bar as LocalBar} from "lib/bar.sol"; -// ^ref:5 -// ^def:3 contract Sample { function test() returns (int) { return Foo.foo() + LocalBar.bar(); - // ^ref:2 - // ^ref:5 - // ^ref:1 - // ^ref:6 } } // --- path: lib/foo.sol library Foo { - // ^def:6 function foo() returns (int) { - // ^def:1 return 1; } } // --- path: lib/bar.sol library Bar { - // ^def:5 function bar() returns (int) { - // ^def:2 return 2; } } diff --git a/crates/solidity/testing/snapshots/bindings_output/imports/named/generated/0.4.11-success.txt b/crates/solidity/testing/snapshots/bindings_output/imports/named/generated/0.4.11-success.txt new file mode 100644 index 0000000000..e925e13fa5 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/imports/named/generated/0.4.11-success.txt @@ -0,0 +1,76 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[main.sol:1:1] + │ + 1 │ import * as foo from "lib/foo.sol"; + │ ─┬─ + │ ╰─── name: 1 + │ + 3 │ contract Example { + │ ───┬─── + │ ╰───── name: 2 + 4 │ function test(int x) returns (int) { + │ ──┬─ ┬ + │ ╰───────── name: 3 + │ │ + │ ╰── name: 4 + 5 │ return foo.Foo.test(x); + │ ─┬─ ─┬─ ──┬─ ┬ + │ ╰────────────── ref: 1 + │ │ │ │ + │ ╰────────── ref: 5 + │ │ │ + │ ╰───── ref: 6 + │ │ + │ ╰── ref: 4 +───╯ +Definiens: + ╭─[main.sol:1:1] + │ + 1 │ │ import * as foo from "lib/foo.sol"; + │ │ ──────────────┬───────────── + │ │ ╰─────────────── definiens: 1 + 2 │ ╭───▶ + ┆ ┆ ┆ + 4 │ │ ╭─▶ function test(int x) returns (int) { + │ │ │ ──┬── + │ │ │ ╰──── definiens: 4 + ┆ ┆ ┆ + 6 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 3 + 7 │ ├───▶ } + │ │ + │ ╰───────── definiens: 2 +───╯ +References and definitions: + ╭─[lib/foo.sol:1:1] + │ + 1 │ library Foo { + │ ─┬─ + │ ╰─── name: 5 + 2 │ function test(int x) returns (int) { + │ ──┬─ ┬ + │ ╰───────── name: 6 + │ │ + │ ╰── name: 7 + 3 │ return x + 2; + │ ┬ + │ ╰── ref: 7 +───╯ +Definiens: + ╭─[lib/foo.sol:1:1] + │ + 1 │ ╭─│ ▶ library Foo { + 2 │ │ ╭─▶ function test(int x) returns (int) { + │ │ │ ──┬── + │ │ │ ╰──── definiens: 7 + ┆ ┆ ┆ + 4 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 6 + 5 │ ├───▶ } + │ │ + │ ╰───────── definiens: 5 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_assertions/imports/named_imports.sol b/crates/solidity/testing/snapshots/bindings_output/imports/named/input.sol similarity index 67% rename from crates/solidity/testing/snapshots/bindings_assertions/imports/named_imports.sol rename to crates/solidity/testing/snapshots/bindings_output/imports/named/input.sol index 7c67b38745..bc5d06f066 100644 --- a/crates/solidity/testing/snapshots/bindings_assertions/imports/named_imports.sol +++ b/crates/solidity/testing/snapshots/bindings_output/imports/named/input.sol @@ -1,21 +1,15 @@ // --- path: main.sol import * as foo from "lib/foo.sol"; -// ^def:1 contract Example { function test(int x) returns (int) { return foo.Foo.test(x); - // ^ref:3 - // ^ref:2 - // ^ref:1 } } // --- path: lib/foo.sol library Foo { - // ^def:2 function test(int x) returns (int) { - // ^def:3 return x + 2; } } diff --git a/crates/solidity/testing/snapshots/bindings_output/interfaces/visibility/generated/0.4.11-success.txt b/crates/solidity/testing/snapshots/bindings_output/interfaces/visibility/generated/0.4.11-success.txt index 83b755a551..7bbea29b38 100644 --- a/crates/solidity/testing/snapshots/bindings_output/interfaces/visibility/generated/0.4.11-success.txt +++ b/crates/solidity/testing/snapshots/bindings_output/interfaces/visibility/generated/0.4.11-success.txt @@ -18,16 +18,14 @@ References and definitions: │ ╰─────────────────── name: 5 │ │ │ ╰──── name: 6 - 4 │ function calculate() returns (Choice); - │ ────┬──── ───┬── - │ ╰──────────────────────── name: 7 - │ │ - │ ╰──── ref: 2 - 5 │ function get_book() returns (Book); - │ ────┬─── ──┬─ - │ ╰───────────────────── name: 8 - │ │ - │ ╰─── ref: 5 + 4 │ function calculate() external returns (int); + │ ────┬──── + │ ╰────── name: 7 + 5 │ function get_book() external returns (Book memory); + │ ────┬─── ──┬─ + │ ╰────────────────────────────── name: 8 + │ │ + │ ╰─── ref: 5 │ 8 │ contract Test { │ ──┬─ @@ -52,41 +50,62 @@ References and definitions: │ ╰──────── ref: 5 │ │ │ ╰─── name: 11 + │ + 12 │ function test(Example e) public returns (int) { + │ ──┬─ ───┬─── ┬ + │ ╰───────────── name: 12 + │ │ │ + │ ╰─────── ref: 1 + │ │ + │ ╰── name: 13 + 13 │ return e.calculate(); + │ ┬ ────┬──── + │ ╰──────────── ref: 13 + │ │ + │ ╰────── ref: 7 ────╯ Definiens: ╭─[input.sol:1:1] │ - 1 │ ╭───▶ interface Example { - 2 │ │ enum Choice { One, Two } - │ │ ──────────────┬────┬────┬──── - │ │ ╰──────────────── definiens: 2 - │ │ │ │ - │ │ ╰─────────── definiens: 3 - │ │ │ - │ │ ╰────── definiens: 4 - 3 │ │ struct Book { string author; } - │ │ ─────────────────┬──────┬────────── - │ │ ╰─────────────────── definiens: 5 - │ │ │ - │ │ ╰──────────── definiens: 6 - 4 │ │ function calculate() returns (Choice); - │ │ ─────────────────────┬───────────────────── - │ │ ╰─────────────────────── definiens: 7 - 5 │ │ function get_book() returns (Book); - │ │ ────────────────────┬─────────────────── - │ │ ╰───────────────────── definiens: 8 - 6 │ ├─│ ▶ } - │ │ │ - │ ╰───────── definiens: 1 - 7 │ ╭─▶ - ┆ ┆ - 9 │ │ Example.Choice choice = Example.Choice.One; - │ │ ────────────────────────┬─────────────────────── - │ │ ╰───────────────────────── definiens: 10 - 10 │ │ Example.Book book; - │ │ ───────────┬─────────── - │ │ ╰───────────── definiens: 11 - 11 │ ├─▶ } - │ │ - │ ╰─────── definiens: 9 + 1 │ ╭─────▶ interface Example { + 2 │ │ enum Choice { One, Two } + │ │ ──────────────┬────┬────┬──── + │ │ ╰──────────────── definiens: 2 + │ │ │ │ + │ │ ╰─────────── definiens: 3 + │ │ │ + │ │ ╰────── definiens: 4 + 3 │ │ struct Book { string author; } + │ │ ─────────────────┬──────┬────────── + │ │ ╰─────────────────── definiens: 5 + │ │ │ + │ │ ╰──────────── definiens: 6 + 4 │ │ function calculate() external returns (int); + │ │ ────────────────────────┬──────────────────────── + │ │ ╰────────────────────────── definiens: 7 + 5 │ │ function get_book() external returns (Book memory); + │ │ ────────────────────────────┬─────────────────────────── + │ │ ╰───────────────────────────── definiens: 8 + 6 │ ├─│ ──▶ } + │ │ │ + │ ╰─────────── definiens: 1 + 7 │ ╭───▶ + ┆ ┆ + 9 │ │ Example.Choice choice = Example.Choice.One; + │ │ ────────────────────────┬─────────────────────── + │ │ ╰───────────────────────── definiens: 10 + 10 │ │ │ Example.Book book; + │ │ │ ───────────┬─────────── + │ │ │ ╰───────────── definiens: 11 + 11 │ │ ╭─▶ + 12 │ │ │ function test(Example e) public returns (int) { + │ │ │ ────┬──── + │ │ │ ╰────── definiens: 13 + ┆ ┆ ┆ + 14 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 12 + 15 │ ├───▶ } + │ │ + │ ╰───────── definiens: 9 ────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/interfaces/visibility/input.sol b/crates/solidity/testing/snapshots/bindings_output/interfaces/visibility/input.sol index b509d7ea62..4e28e85fda 100644 --- a/crates/solidity/testing/snapshots/bindings_output/interfaces/visibility/input.sol +++ b/crates/solidity/testing/snapshots/bindings_output/interfaces/visibility/input.sol @@ -1,11 +1,15 @@ interface Example { enum Choice { One, Two } struct Book { string author; } - function calculate() returns (Choice); - function get_book() returns (Book); + function calculate() external returns (int); + function get_book() external returns (Book memory); } contract Test { Example.Choice choice = Example.Choice.One; Example.Book book; + + function test(Example e) public returns (int) { + return e.calculate(); + } } diff --git a/crates/solidity/testing/snapshots/bindings_output/mappings/elementary/generated/0.4.11-failure.txt b/crates/solidity/testing/snapshots/bindings_output/mappings/elementary/generated/0.4.11-failure.txt new file mode 100644 index 0000000000..2f32ca1215 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/mappings/elementary/generated/0.4.11-failure.txt @@ -0,0 +1,34 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected CloseBrace or OpenBrace or ReturnsKeyword or Semicolon. + ╭─[input.sol:4:5] + │ + 4 │ ╭─▶ function get(address _addr) public view returns (uint256) { + ┆ ┆ + 14 │ ├─▶ } + │ │ + │ ╰─────────── Error occurred here. +────╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Mapping { + │ ───┬─── + │ ╰───── name: 1 + 2 │ mapping(address => uint256) public myMap; + │ ──┬── + │ ╰──── name: 2 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─▶ contract Mapping { + 2 │ │ mapping(address => uint256) public myMap; + │ │ ───────────────────────┬────────────────────── + │ │ ╰──────────────────────── definiens: 2 + ┆ ┆ + 15 │ ├─▶ } + │ │ + │ ╰─────── definiens: 1 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/mappings/elementary/generated/0.4.16-success.txt b/crates/solidity/testing/snapshots/bindings_output/mappings/elementary/generated/0.4.16-success.txt new file mode 100644 index 0000000000..8b4fe334a7 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/mappings/elementary/generated/0.4.16-success.txt @@ -0,0 +1,86 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Mapping { + │ ───┬─── + │ ╰───── name: 1 + 2 │ mapping(address => uint256) public myMap; + │ ──┬── + │ ╰──── name: 2 + │ + 4 │ function get(address _addr) public view returns (uint256) { + │ ─┬─ ──┬── + │ ╰───────────────── name: 3 + │ │ + │ ╰──── name: 4 + 5 │ return myMap[_addr]; + │ ──┬── ──┬── + │ ╰────────── ref: 2 + │ │ + │ ╰──── ref: 4 + │ + 8 │ function set(address _addr, uint256 _i) public { + │ ─┬─ ──┬── ─┬ + │ ╰───────────────────────────── name: 5 + │ │ │ + │ ╰──────────────── name: 6 + │ │ + │ ╰── name: 7 + 9 │ myMap[_addr] = _i; + │ ──┬── ──┬── ─┬ + │ ╰──────────────── ref: 2 + │ │ │ + │ ╰────────── ref: 6 + │ │ + │ ╰── ref: 7 + │ + 12 │ function remove(address _addr) public { + │ ───┬── ──┬── + │ ╰────────────────── name: 8 + │ │ + │ ╰──── name: 9 + 13 │ delete myMap[_addr]; + │ ──┬── ──┬── + │ ╰────────── ref: 2 + │ │ + │ ╰──── ref: 9 +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭───────▶ contract Mapping { + 2 │ │ │ mapping(address => uint256) public myMap; + │ │ │ ───────────────────────┬────────────────────── + │ │ │ ╰──────────────────────── definiens: 2 + 3 │ │ ╭─────▶ + 4 │ │ │ function get(address _addr) public view returns (uint256) { + │ │ │ ──────┬────── + │ │ │ ╰──────── definiens: 4 + ┆ ┆ ┆ + 6 │ │ ├─│ ──▶ } + │ │ │ │ + │ │ ╰─────────────── definiens: 3 + 7 │ │ ╭───▶ + 8 │ │ │ function set(address _addr, uint256 _i) public { + │ │ │ ──────┬────── ─────┬───── + │ │ │ ╰──────────────────── definiens: 6 + │ │ │ │ + │ │ │ ╰─────── definiens: 7 + ┆ ┆ ┆ + 10 │ │ ├─│ ▶ } + │ │ │ │ + │ │ ╰───────────── definiens: 5 + 11 │ │ ╭─▶ + 12 │ │ │ function remove(address _addr) public { + │ │ │ ──────┬────── + │ │ │ ╰──────── definiens: 9 + ┆ ┆ ┆ + 14 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 8 + 15 │ ├───────▶ } + │ │ + │ ╰───────────── definiens: 1 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/mappings/elementary/input.sol b/crates/solidity/testing/snapshots/bindings_output/mappings/elementary/input.sol new file mode 100644 index 0000000000..fe623b46ec --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/mappings/elementary/input.sol @@ -0,0 +1,15 @@ +contract Mapping { + mapping(address => uint256) public myMap; + + function get(address _addr) public view returns (uint256) { + return myMap[_addr]; + } + + function set(address _addr, uint256 _i) public { + myMap[_addr] = _i; + } + + function remove(address _addr) public { + delete myMap[_addr]; + } +} diff --git a/crates/solidity/testing/snapshots/bindings_output/mappings/nested/generated/0.4.11-failure.txt b/crates/solidity/testing/snapshots/bindings_output/mappings/nested/generated/0.4.11-failure.txt new file mode 100644 index 0000000000..d0530f87e6 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/mappings/nested/generated/0.4.11-failure.txt @@ -0,0 +1,34 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected CloseBrace or OpenBrace or ReturnsKeyword or Semicolon. + ╭─[input.sol:4:5] + │ + 4 │ ╭─▶ function get(address _addr1, uint256 _i) public view returns (bool) { + ┆ ┆ + 14 │ ├─▶ } + │ │ + │ ╰─────────── Error occurred here. +────╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract NestedMapping { + │ ──────┬────── + │ ╰──────── name: 1 + 2 │ mapping(address => mapping(uint256 => bool)) public nested; + │ ───┬── + │ ╰──── name: 2 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─▶ contract NestedMapping { + 2 │ │ mapping(address => mapping(uint256 => bool)) public nested; + │ │ ────────────────────────────────┬─────────────────────────────── + │ │ ╰───────────────────────────────── definiens: 2 + ┆ ┆ + 15 │ ├─▶ } + │ │ + │ ╰─────── definiens: 1 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/mappings/nested/generated/0.4.16-success.txt b/crates/solidity/testing/snapshots/bindings_output/mappings/nested/generated/0.4.16-success.txt new file mode 100644 index 0000000000..1a4bcc1331 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/mappings/nested/generated/0.4.16-success.txt @@ -0,0 +1,104 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract NestedMapping { + │ ──────┬────── + │ ╰──────── name: 1 + 2 │ mapping(address => mapping(uint256 => bool)) public nested; + │ ───┬── + │ ╰──── name: 2 + │ + 4 │ function get(address _addr1, uint256 _i) public view returns (bool) { + │ ─┬─ ───┬── ─┬ + │ ╰────────────────────────────── name: 3 + │ │ │ + │ ╰──────────────── name: 4 + │ │ + │ ╰── name: 5 + 5 │ return nested[_addr1][_i]; + │ ───┬── ───┬── ─┬ + │ ╰─────────────── ref: 2 + │ │ │ + │ ╰──────── ref: 4 + │ │ + │ ╰── ref: 5 + │ + 8 │ function set(address _addr1, uint256 _i, bool _boo) public { + │ ─┬─ ───┬── ─┬ ──┬─ + │ ╰───────────────────────────────────────── name: 6 + │ │ │ │ + │ ╰─────────────────────────── name: 7 + │ │ │ + │ ╰───────────── name: 8 + │ │ + │ ╰─── name: 9 + 9 │ nested[_addr1][_i] = _boo; + │ ───┬── ───┬── ─┬ ──┬─ + │ ╰─────────────────────── ref: 2 + │ │ │ │ + │ ╰──────────────── ref: 7 + │ │ │ + │ ╰────────── ref: 8 + │ │ + │ ╰─── ref: 9 + │ + 12 │ function remove(address _addr1, uint256 _i) public { + │ ───┬── ───┬── ─┬ + │ ╰─────────────────────────────── name: 10 + │ │ │ + │ ╰──────────────── name: 11 + │ │ + │ ╰── name: 12 + 13 │ delete nested[_addr1][_i]; + │ ───┬── ───┬── ─┬ + │ ╰─────────────── ref: 2 + │ │ │ + │ ╰──────── ref: 11 + │ │ + │ ╰── ref: 12 +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭───────▶ contract NestedMapping { + 2 │ │ │ mapping(address => mapping(uint256 => bool)) public nested; + │ │ │ ────────────────────────────────┬─────────────────────────────── + │ │ │ ╰───────────────────────────────── definiens: 2 + 3 │ │ ╭─────▶ + 4 │ │ │ function get(address _addr1, uint256 _i) public view returns (bool) { + │ │ │ ───────┬────── ─────┬───── + │ │ │ ╰──────────────────── definiens: 4 + │ │ │ │ + │ │ │ ╰─────── definiens: 5 + ┆ ┆ ┆ + 6 │ │ ├─│ ──▶ } + │ │ │ │ + │ │ ╰─────────────── definiens: 3 + 7 │ │ ╭───▶ + 8 │ │ │ function set(address _addr1, uint256 _i, bool _boo) public { + │ │ │ ───────┬────── ─────┬───── ─────┬──── + │ │ │ ╰─────────────────────────────── definiens: 7 + │ │ │ │ │ + │ │ │ ╰────────────────── definiens: 8 + │ │ │ │ + │ │ │ ╰────── definiens: 9 + ┆ ┆ ┆ + 10 │ │ ├─│ ▶ } + │ │ │ │ + │ │ ╰───────────── definiens: 6 + 11 │ │ ╭─▶ + 12 │ │ │ function remove(address _addr1, uint256 _i) public { + │ │ │ ───────┬────── ─────┬───── + │ │ │ ╰──────────────────── definiens: 11 + │ │ │ │ + │ │ │ ╰─────── definiens: 12 + ┆ ┆ ┆ + 14 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 10 + 15 │ ├───────▶ } + │ │ + │ ╰───────────── definiens: 1 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/mappings/nested/input.sol b/crates/solidity/testing/snapshots/bindings_output/mappings/nested/input.sol new file mode 100644 index 0000000000..d64391800f --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/mappings/nested/input.sol @@ -0,0 +1,15 @@ +contract NestedMapping { + mapping(address => mapping(uint256 => bool)) public nested; + + function get(address _addr1, uint256 _i) public view returns (bool) { + return nested[_addr1][_i]; + } + + function set(address _addr1, uint256 _i, bool _boo) public { + nested[_addr1][_i] = _boo; + } + + function remove(address _addr1, uint256 _i) public { + delete nested[_addr1][_i]; + } +} diff --git a/crates/solidity/testing/snapshots/bindings_output/mappings/nested_custom/generated/0.4.11-success.txt b/crates/solidity/testing/snapshots/bindings_output/mappings/nested_custom/generated/0.4.11-success.txt new file mode 100644 index 0000000000..de74d20ec3 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/mappings/nested_custom/generated/0.4.11-success.txt @@ -0,0 +1,119 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract NestedCustom { + │ ──────┬───── + │ ╰─────── name: 1 + 2 │ enum Kind { Alpha, Beta } + │ ──┬─ ──┬── ──┬─ + │ ╰───────────────── name: 2 + │ │ │ + │ ╰────────── name: 3 + │ │ + │ ╰─── name: 4 + 3 │ struct Values { + │ ───┬── + │ ╰──── name: 5 + 4 │ uint balance; + │ ───┬─── + │ ╰───── name: 6 + │ + 6 │ mapping(address => mapping(Kind => Values)) vaults; + │ ──┬─ ───┬── ───┬── + │ ╰────────────────────── ref: 2 + │ │ │ + │ ╰───────────── ref: 5 + │ │ + │ ╰──── name: 7 + │ + 8 │ function store(address _addr, Kind _kind, uint _amount) public { + │ ──┬── ──┬── ──┬─ ──┬── ───┬─── + │ ╰──────────────────────────────────────────── name: 8 + │ │ │ │ │ + │ ╰────────────────────────────── name: 9 + │ │ │ │ + │ ╰─────────────────────── ref: 2 + │ │ │ + │ ╰────────────────── name: 10 + │ │ + │ ╰───── name: 11 + 9 │ vaults[_addr][_kind].balance += _amount; + │ ───┬── ──┬── ──┬── ───┬─── ───┬─── + │ ╰───────────────────────────────────── ref: 7 + │ │ │ │ │ + │ ╰─────────────────────────────── ref: 9 + │ │ │ │ + │ ╰──────────────────────── ref: 10 + │ │ │ + │ ╰──────────────── ref: 6 + │ │ + │ ╰───── ref: 11 + │ + 12 │ function balance(address _addr, Kind _kind) public returns (uint) { + │ ───┬─── ──┬── ──┬─ ──┬── + │ ╰─────────────────────────────── name: 12 + │ │ │ │ + │ ╰──────────────── name: 13 + │ │ │ + │ ╰───────── ref: 2 + │ │ + │ ╰──── name: 14 + 13 │ return vaults[_addr][_kind].balance; + │ ───┬── ──┬── ──┬── ───┬─── + │ ╰────────────────────────── ref: 7 + │ │ │ │ + │ ╰──────────────────── ref: 13 + │ │ │ + │ ╰───────────── ref: 14 + │ │ + │ ╰───── ref: 6 +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭───────▶ contract NestedCustom { + 2 │ │ │ enum Kind { Alpha, Beta } + │ │ │ ───────────────┬──┬──────┬──── + │ │ │ ╰──────────────── definiens: 2 + │ │ │ │ │ + │ │ │ ╰───────────── definiens: 3 + │ │ │ │ + │ │ │ ╰────── definiens: 4 + 3 │ │ ╭─▶ struct Values { + 4 │ │ │ uint balance; + │ │ │ ───────────┬────────── + │ │ │ ╰──────────── definiens: 6 + 5 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 5 + 6 │ │ │ mapping(address => mapping(Kind => Values)) vaults; + │ │ │ ────────────────────────────┬─────────────────────────── + │ │ │ ╰───────────────────────────── definiens: 7 + 7 │ │ ╭─────▶ + 8 │ │ │ function store(address _addr, Kind _kind, uint _amount) public { + │ │ │ ──────┬────── ─────┬───── ──────┬────── + │ │ │ ╰────────────────────────────────── definiens: 9 + │ │ │ │ │ + │ │ │ ╰───────────────────── definiens: 10 + │ │ │ │ + │ │ │ ╰──────── definiens: 11 + ┆ ┆ ┆ + 10 │ │ ├─│ ──▶ } + │ │ │ │ + │ │ ╰─────────────── definiens: 8 + 11 │ │ ╭───▶ + 12 │ │ │ function balance(address _addr, Kind _kind) public returns (uint) { + │ │ │ ──────┬────── ─────┬───── + │ │ │ ╰──────────────────── definiens: 13 + │ │ │ │ + │ │ │ ╰─────── definiens: 14 + ┆ ┆ ┆ + 14 │ │ ├───▶ } + │ │ │ + │ │ ╰───────────── definiens: 12 + 15 │ ├───────▶ } + │ │ + │ ╰───────────── definiens: 1 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/mappings/nested_custom/input.sol b/crates/solidity/testing/snapshots/bindings_output/mappings/nested_custom/input.sol new file mode 100644 index 0000000000..4418e4f2a1 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/mappings/nested_custom/input.sol @@ -0,0 +1,15 @@ +contract NestedCustom { + enum Kind { Alpha, Beta } + struct Values { + uint balance; + } + mapping(address => mapping(Kind => Values)) vaults; + + function store(address _addr, Kind _kind, uint _amount) public { + vaults[_addr][_kind].balance += _amount; + } + + function balance(address _addr, Kind _kind) public returns (uint) { + return vaults[_addr][_kind].balance; + } +} diff --git a/crates/solidity/testing/snapshots/bindings_output/modifiers/diamond/generated/0.4.11-failure.txt b/crates/solidity/testing/snapshots/bindings_output/modifiers/diamond/generated/0.4.11-failure.txt index fae8d1101a..e5dbf054b9 100644 --- a/crates/solidity/testing/snapshots/bindings_output/modifiers/diamond/generated/0.4.11-failure.txt +++ b/crates/solidity/testing/snapshots/bindings_output/modifiers/diamond/generated/0.4.11-failure.txt @@ -61,7 +61,7 @@ References and definitions: │ ──┬─ ─┬─ │ ╰──────────────── name: 8 │ │ - │ ╰─── ref: 4 + │ ╰─── refs: 6, 4, 2 ────╯ Definiens: ╭─[input.sol:1:1] diff --git a/crates/solidity/testing/snapshots/bindings_output/modifiers/diamond/generated/0.6.0-success.txt b/crates/solidity/testing/snapshots/bindings_output/modifiers/diamond/generated/0.6.0-success.txt index 360284a628..012a00ea85 100644 --- a/crates/solidity/testing/snapshots/bindings_output/modifiers/diamond/generated/0.6.0-success.txt +++ b/crates/solidity/testing/snapshots/bindings_output/modifiers/diamond/generated/0.6.0-success.txt @@ -45,7 +45,7 @@ References and definitions: │ ──┬─ ─┬─ │ ╰──────────────── name: 8 │ │ - │ ╰─── ref: 4 + │ ╰─── refs: 6, 4, 2 ────╯ Definiens: ╭─[input.sol:1:1] diff --git a/crates/solidity/testing/snapshots/bindings_output/modifiers/virtual_modifier/generated/0.6.0-success.txt b/crates/solidity/testing/snapshots/bindings_output/modifiers/virtual_modifier/generated/0.6.0-success.txt index dcf92c2c10..3aed323f47 100644 --- a/crates/solidity/testing/snapshots/bindings_output/modifiers/virtual_modifier/generated/0.6.0-success.txt +++ b/crates/solidity/testing/snapshots/bindings_output/modifiers/virtual_modifier/generated/0.6.0-success.txt @@ -28,7 +28,7 @@ References and definitions: │ ──┬─ ─┬─ │ ╰──────────────── name: 5 │ │ - │ ╰─── ref: 4 + │ ╰─── refs: 4, 2 ───╯ Definiens: ╭─[input.sol:1:1] diff --git a/crates/solidity/testing/snapshots/bindings_output/scoping/c99_scopes/generated/0.4.11-success.txt b/crates/solidity/testing/snapshots/bindings_output/scoping/c99_scopes/generated/0.4.11-success.txt new file mode 100644 index 0000000000..deff3b7496 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/scoping/c99_scopes/generated/0.4.11-success.txt @@ -0,0 +1,60 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Foo { + │ ─┬─ + │ ╰─── name: 1 + 2 │ uint x = 10; + │ ┬ + │ ╰── name: 2 + │ + 4 │ function a_func(uint x) returns (uint) { + │ ───┬── ┬ + │ ╰─────────── name: 3 + │ │ + │ ╰── name: 4 + │ + 6 │ uint y = x + 1; + │ ┬ ┬ + │ ╰────── name: 5 + │ │ + │ ╰── ref: 6 + │ + 8 │ uint x = 20; + │ ┬ + │ ╰── name: 6 + 9 │ return x + y; + │ ┬ ┬ + │ ╰────── ref: 6 + │ │ + │ ╰── ref: 5 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─────▶ contract Foo { + 2 │ │ │ uint x = 10; + │ │ │ ────────┬──────── + │ │ │ ╰────────── definiens: 2 + 3 │ │ ╭───▶ + 4 │ │ │ │ function a_func(uint x) returns (uint) { + │ │ │ │ ───┬── + │ │ │ │ ╰──── definiens: 4 + 5 │ │ │ ╭─▶ // Solidity < 0.5.0 binds the following `x` differently than >= 0.5.0 + 6 │ │ │ ├─▶ uint y = x + 1; + │ │ │ │ + │ │ │ ╰───────────────────────────── definiens: 5 + ┆ ┆ ┆ + 8 │ │ │ uint x = 20; + │ │ │ ────────────┬──────────── + │ │ │ ╰────────────── definiens: 6 + ┆ ┆ ┆ + 11 │ │ ├───▶ } + │ │ │ + │ │ ╰───────────── definiens: 3 + 12 │ ├─────▶ } + │ │ + │ ╰─────────── definiens: 1 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/scoping/c99_scopes/generated/0.5.0-success.txt b/crates/solidity/testing/snapshots/bindings_output/scoping/c99_scopes/generated/0.5.0-success.txt new file mode 100644 index 0000000000..069c07a46d --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/scoping/c99_scopes/generated/0.5.0-success.txt @@ -0,0 +1,60 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Foo { + │ ─┬─ + │ ╰─── name: 1 + 2 │ uint x = 10; + │ ┬ + │ ╰── name: 2 + │ + 4 │ function a_func(uint x) returns (uint) { + │ ───┬── ┬ + │ ╰─────────── name: 3 + │ │ + │ ╰── name: 4 + │ + 6 │ uint y = x + 1; + │ ┬ ┬ + │ ╰────── name: 5 + │ │ + │ ╰── ref: 4 + │ + 8 │ uint x = 20; + │ ┬ + │ ╰── name: 6 + 9 │ return x + y; + │ ┬ ┬ + │ ╰────── ref: 6 + │ │ + │ ╰── ref: 5 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─────▶ contract Foo { + 2 │ │ │ uint x = 10; + │ │ │ ────────┬──────── + │ │ │ ╰────────── definiens: 2 + 3 │ │ ╭───▶ + 4 │ │ │ │ function a_func(uint x) returns (uint) { + │ │ │ │ ───┬── + │ │ │ │ ╰──── definiens: 4 + 5 │ │ │ ╭─▶ // Solidity < 0.5.0 binds the following `x` differently than >= 0.5.0 + 6 │ │ │ ├─▶ uint y = x + 1; + │ │ │ │ + │ │ │ ╰───────────────────────────── definiens: 5 + ┆ ┆ ┆ + 8 │ │ │ uint x = 20; + │ │ │ ────────────┬──────────── + │ │ │ ╰────────────── definiens: 6 + ┆ ┆ ┆ + 11 │ │ ├───▶ } + │ │ │ + │ │ ╰───────────── definiens: 3 + 12 │ ├─────▶ } + │ │ + │ ╰─────────── definiens: 1 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/scoping/c99_scopes/input.sol b/crates/solidity/testing/snapshots/bindings_output/scoping/c99_scopes/input.sol new file mode 100644 index 0000000000..cd5d987c09 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/scoping/c99_scopes/input.sol @@ -0,0 +1,12 @@ +contract Foo { + uint x = 10; + + function a_func(uint x) returns (uint) { + // Solidity < 0.5.0 binds the following `x` differently than >= 0.5.0 + uint y = x + 1; + { + uint x = 20; + return x + y; + } + } +} diff --git a/crates/solidity/testing/snapshots/bindings_output/scoping/functions/generated/0.4.11-failure.txt b/crates/solidity/testing/snapshots/bindings_output/scoping/functions/generated/0.4.11-failure.txt new file mode 100644 index 0000000000..faf87d280d --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/scoping/functions/generated/0.4.11-failure.txt @@ -0,0 +1,70 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected ContractKeyword or ImportKeyword or InterfaceKeyword or LibraryKeyword or PragmaKeyword. + ╭─[input.sol:16:1] + │ + 16 │ ╭─▶ function top_level() returns (int) { + ┆ ┆ + 18 │ ├─▶ } + │ │ + │ ╰─────── Error occurred here. +────╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Sample { + │ ───┬── + │ ╰──── name: 1 + 2 │ function test() returns (int) { + │ ──┬─ + │ ╰─── name: 2 + 3 │ return from_sample() + top_level() + MyLib.from_lib(); + │ ─────┬───── ────┬──── ──┬── ────┬─── + │ ╰──────────────────────────────────────── ref: 3 + │ │ │ │ + │ ╰───────────────────────── unresolved + │ │ │ + │ ╰───────────── ref: 4 + │ │ + │ ╰───── ref: 5 + │ + 5 │ function from_sample() returns (int) { + │ ─────┬───── + │ ╰─────── name: 3 + │ + 10 │ library MyLib { + │ ──┬── + │ ╰──── name: 4 + 11 │ function from_lib() returns (int) { + │ ────┬─── + │ ╰───── name: 5 +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ──────▶ contract Sample { + 2 │ │ ╭───────▶ function test() returns (int) { + ┆ ┆ ┆ + 4 │ │ ├───│ ──▶ } + │ │ │ │ + │ │ ╰───────────────── definiens: 2 + 5 │ │ ╭───▶ function from_sample() returns (int) { + ┆ ┆ ┆ + 7 │ │ ├───▶ } + │ │ │ + │ │ ╰───────────── definiens: 3 + 8 │ ├───│ ────▶ } + │ │ │ + │ ╰─────────────── definiens: 1 + 9 │ ╭─────▶ + ┆ ┆ ┆ + 11 │ │ ╭─▶ function from_lib() returns (int) { + ┆ ┆ ┆ + 13 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 5 + 14 │ ├─────▶ } + │ │ + │ ╰─────────── definiens: 4 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/scoping/functions/generated/0.6.0-failure.txt b/crates/solidity/testing/snapshots/bindings_output/scoping/functions/generated/0.6.0-failure.txt new file mode 100644 index 0000000000..7848f6c1cc --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/scoping/functions/generated/0.6.0-failure.txt @@ -0,0 +1,70 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected ContractKeyword or EnumKeyword or ImportKeyword or InterfaceKeyword or LibraryKeyword or PragmaKeyword or StructKeyword. + ╭─[input.sol:16:1] + │ + 16 │ ╭─▶ function top_level() returns (int) { + ┆ ┆ + 18 │ ├─▶ } + │ │ + │ ╰─────── Error occurred here. +────╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Sample { + │ ───┬── + │ ╰──── name: 1 + 2 │ function test() returns (int) { + │ ──┬─ + │ ╰─── name: 2 + 3 │ return from_sample() + top_level() + MyLib.from_lib(); + │ ─────┬───── ────┬──── ──┬── ────┬─── + │ ╰──────────────────────────────────────── ref: 3 + │ │ │ │ + │ ╰───────────────────────── unresolved + │ │ │ + │ ╰───────────── ref: 4 + │ │ + │ ╰───── ref: 5 + │ + 5 │ function from_sample() returns (int) { + │ ─────┬───── + │ ╰─────── name: 3 + │ + 10 │ library MyLib { + │ ──┬── + │ ╰──── name: 4 + 11 │ function from_lib() returns (int) { + │ ────┬─── + │ ╰───── name: 5 +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ──────▶ contract Sample { + 2 │ │ ╭───────▶ function test() returns (int) { + ┆ ┆ ┆ + 4 │ │ ├───│ ──▶ } + │ │ │ │ + │ │ ╰───────────────── definiens: 2 + 5 │ │ ╭───▶ function from_sample() returns (int) { + ┆ ┆ ┆ + 7 │ │ ├───▶ } + │ │ │ + │ │ ╰───────────── definiens: 3 + 8 │ ├───│ ────▶ } + │ │ │ + │ ╰─────────────── definiens: 1 + 9 │ ╭─────▶ + ┆ ┆ ┆ + 11 │ │ ╭─▶ function from_lib() returns (int) { + ┆ ┆ ┆ + 13 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 5 + 14 │ ├─────▶ } + │ │ + │ ╰─────────── definiens: 4 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/scoping/functions/generated/0.7.1-success.txt b/crates/solidity/testing/snapshots/bindings_output/scoping/functions/generated/0.7.1-success.txt new file mode 100644 index 0000000000..8b0a7b7bfb --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/scoping/functions/generated/0.7.1-success.txt @@ -0,0 +1,69 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Sample { + │ ───┬── + │ ╰──── name: 1 + 2 │ function test() returns (int) { + │ ──┬─ + │ ╰─── name: 2 + 3 │ return from_sample() + top_level() + MyLib.from_lib(); + │ ─────┬───── ────┬──── ──┬── ────┬─── + │ ╰──────────────────────────────────────── ref: 3 + │ │ │ │ + │ ╰───────────────────────── ref: 6 + │ │ │ + │ ╰───────────── ref: 4 + │ │ + │ ╰───── ref: 5 + │ + 5 │ function from_sample() returns (int) { + │ ─────┬───── + │ ╰─────── name: 3 + │ + 10 │ library MyLib { + │ ──┬── + │ ╰──── name: 4 + 11 │ function from_lib() returns (int) { + │ ────┬─── + │ ╰───── name: 5 + │ + 16 │ function top_level() returns (int) { + │ ────┬──── + │ ╰────── name: 6 +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ────────▶ contract Sample { + 2 │ │ ╭─────────▶ function test() returns (int) { + ┆ ┆ ┆ + 4 │ │ ├───│ ────▶ } + │ │ │ │ + │ │ ╰─────────────────── definiens: 2 + 5 │ │ ╭─────▶ function from_sample() returns (int) { + ┆ ┆ ┆ + 7 │ │ ├─────▶ } + │ │ │ + │ │ ╰─────────────── definiens: 3 + 8 │ ├───│ ──────▶ } + │ │ │ + │ ╰───────────────── definiens: 1 + 9 │ ╭───────▶ + ┆ ┆ ┆ + 11 │ │ ╭───▶ function from_lib() returns (int) { + ┆ ┆ ┆ + 13 │ │ ├───▶ } + │ │ │ + │ │ ╰───────────── definiens: 5 + 14 │ ├─────│ ▶ } + │ │ │ + │ ╰───────────── definiens: 4 + 15 │ ╭─▶ + ┆ ┆ + 18 │ ├─▶ } + │ │ + │ ╰─────── definiens: 6 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_assertions/functions/visibility.sol b/crates/solidity/testing/snapshots/bindings_output/scoping/functions/input.sol similarity index 52% rename from crates/solidity/testing/snapshots/bindings_assertions/functions/visibility.sol rename to crates/solidity/testing/snapshots/bindings_output/scoping/functions/input.sol index 5b5d57bf72..0cafd160d8 100644 --- a/crates/solidity/testing/snapshots/bindings_assertions/functions/visibility.sol +++ b/crates/solidity/testing/snapshots/bindings_output/scoping/functions/input.sol @@ -1,27 +1,18 @@ contract Sample { function test() returns (int) { return from_sample() + top_level() + MyLib.from_lib(); - // ^ref:3 - // ^ref:4 - // ^ref:! (<0.7.1) - // ^ref:1 (>=0.7.1) - // ^ref:2 } function from_sample() returns (int) { - // ^def:2 return 1; } } library MyLib { - // ^def:4 function from_lib() returns (int) { - // ^def:3 return 3; } } function top_level() returns (int) { - // ^def:1 return 2; } diff --git a/crates/solidity/testing/snapshots/bindings_output/scoping/hoisting_scopes/generated/0.4.11-success.txt b/crates/solidity/testing/snapshots/bindings_output/scoping/hoisting_scopes/generated/0.4.11-success.txt new file mode 100644 index 0000000000..507c486cd2 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/scoping/hoisting_scopes/generated/0.4.11-success.txt @@ -0,0 +1,53 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Foo { + │ ─┬─ + │ ╰─── name: 1 + │ + 3 │ function bar() returns (int x) { + │ ─┬─ ┬ + │ ╰──────────────────── name: 2 + │ │ + │ ╰── name: 3 + 4 │ x = y + z; + │ ┬ ┬ ┬ + │ ╰────────── ref: 3 + │ │ │ + │ ╰────── ref: 4 + │ │ + │ ╰── ref: 5 + 5 │ int y = 5; + │ ┬ + │ ╰── name: 4 + │ + 7 │ int z = 10; + │ ┬ + │ ╰── name: 5 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Foo { + 2 │ │ ╭─▶ // should resolve all correctly for < 0.5.0 + 3 │ │ │ function bar() returns (int x) { + │ │ │ ──┬── + │ │ │ ╰──── definiens: 3 + ┆ ┆ ┆ + 5 │ │ │ int y = 5; + │ │ │ ───────┬─────── + │ │ │ ╰───────── definiens: 4 + ┆ ┆ ┆ + 7 │ │ │ int z = 10; + │ │ │ ─────────┬──────── + │ │ │ ╰────────── definiens: 5 + ┆ ┆ ┆ + 9 │ │ ├─▶ } + │ │ │ + │ │ ╰───────── definiens: 2 + 10 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/scoping/hoisting_scopes/generated/0.5.0-failure.txt b/crates/solidity/testing/snapshots/bindings_output/scoping/hoisting_scopes/generated/0.5.0-failure.txt new file mode 100644 index 0000000000..4e38c46aac --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/scoping/hoisting_scopes/generated/0.5.0-failure.txt @@ -0,0 +1,53 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Foo { + │ ─┬─ + │ ╰─── name: 1 + │ + 3 │ function bar() returns (int x) { + │ ─┬─ ┬ + │ ╰──────────────────── name: 2 + │ │ + │ ╰── name: 3 + 4 │ x = y + z; + │ ┬ ┬ ┬ + │ ╰────────── ref: 3 + │ │ │ + │ ╰────── unresolved + │ │ + │ ╰── unresolved + 5 │ int y = 5; + │ ┬ + │ ╰── name: 4 + │ + 7 │ int z = 10; + │ ┬ + │ ╰── name: 5 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Foo { + 2 │ │ ╭─▶ // should resolve all correctly for < 0.5.0 + 3 │ │ │ function bar() returns (int x) { + │ │ │ ──┬── + │ │ │ ╰──── definiens: 3 + ┆ ┆ ┆ + 5 │ │ │ int y = 5; + │ │ │ ───────┬─────── + │ │ │ ╰───────── definiens: 4 + ┆ ┆ ┆ + 7 │ │ │ int z = 10; + │ │ │ ─────────┬──────── + │ │ │ ╰────────── definiens: 5 + ┆ ┆ ┆ + 9 │ │ ├─▶ } + │ │ │ + │ │ ╰───────── definiens: 2 + 10 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/scoping/hoisting_scopes/input.sol b/crates/solidity/testing/snapshots/bindings_output/scoping/hoisting_scopes/input.sol new file mode 100644 index 0000000000..24eb18d04e --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/scoping/hoisting_scopes/input.sol @@ -0,0 +1,10 @@ +contract Foo { + // should resolve all correctly for < 0.5.0 + function bar() returns (int x) { + x = y + z; + int y = 5; + { + int z = 10; + } + } +} diff --git a/crates/solidity/testing/snapshots/bindings_output/scoping/shadowing/generated/0.4.11-failure.txt b/crates/solidity/testing/snapshots/bindings_output/scoping/shadowing/generated/0.4.11-failure.txt new file mode 100644 index 0000000000..6821fce4c8 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/scoping/shadowing/generated/0.4.11-failure.txt @@ -0,0 +1,14 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected ContractKeyword or ImportKeyword or InterfaceKeyword or LibraryKeyword or PragmaKeyword. + ╭─[input.sol:1:1] + │ + 1 │ ╭─▶ function foo() {} + ┆ ┆ + 18 │ ├─▶ } + │ │ + │ ╰─────── Error occurred here. +────╯ +References and definitions: +Definiens: diff --git a/crates/solidity/testing/snapshots/bindings_output/scoping/shadowing/generated/0.6.0-failure.txt b/crates/solidity/testing/snapshots/bindings_output/scoping/shadowing/generated/0.6.0-failure.txt new file mode 100644 index 0000000000..aa0b4a8e31 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/scoping/shadowing/generated/0.6.0-failure.txt @@ -0,0 +1,14 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected ContractKeyword or EnumKeyword or ImportKeyword or InterfaceKeyword or LibraryKeyword or PragmaKeyword or StructKeyword. + ╭─[input.sol:1:1] + │ + 1 │ ╭─▶ function foo() {} + ┆ ┆ + 18 │ ├─▶ } + │ │ + │ ╰─────── Error occurred here. +────╯ +References and definitions: +Definiens: diff --git a/crates/solidity/testing/snapshots/bindings_output/scoping/shadowing/generated/0.7.1-success.txt b/crates/solidity/testing/snapshots/bindings_output/scoping/shadowing/generated/0.7.1-success.txt new file mode 100644 index 0000000000..c93237a213 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/scoping/shadowing/generated/0.7.1-success.txt @@ -0,0 +1,85 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ function foo() {} + │ ─┬─ + │ ╰─── name: 1 + 2 │ function bar() {} + │ ─┬─ + │ ╰─── name: 2 + │ + 4 │ contract Base { + │ ──┬─ + │ ╰─── name: 3 + 5 │ function bar() public {} + │ ─┬─ + │ ╰─── name: 4 + │ + 8 │ contract Test is Base { + │ ──┬─ ──┬─ + │ ╰─────────── name: 5 + │ │ + │ ╰─── ref: 3 + 9 │ int x; + │ ┬ + │ ╰── name: 6 + │ + 11 │ function test(int x) public { + │ ──┬─ ┬ + │ ╰───────── name: 7 + │ │ + │ ╰── name: 8 + 12 │ foo(); + │ ─┬─ + │ ╰─── ref: 9 + 13 │ bar(); + │ ─┬─ + │ ╰─── ref: 4 + 14 │ x; + │ ┬ + │ ╰── ref: 8 + │ + 17 │ function foo() internal {} + │ ─┬─ + │ ╰─── name: 9 +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ function foo() {} + │ ─────────┬──────── + │ ╰────────── definiens: 1 + 2 │ │ function bar() {} + │ │ ─────────┬──────── + │ │ ╰────────── definiens: 2 + 3 │ ╭───▶ + ┆ ┆ + 5 │ │ function bar() public {} + │ │ ──────────────┬────────────── + │ │ ╰──────────────── definiens: 4 + 6 │ │ ├───▶ } + │ │ │ + │ │ ╰───────── definiens: 3 + 7 │ ╭───────▶ + ┆ ┆ + 9 │ │ │ int x; + │ │ │ ─────┬───── + │ │ │ ╰─────── definiens: 6 + 10 │ │ ╭─────▶ + 11 │ │ │ function test(int x) public { + │ │ │ ──┬── + │ │ │ ╰──── definiens: 8 + ┆ ┆ ┆ + 15 │ │ ├───│ ▶ } + │ │ │ │ + │ │ ╰─────────────── definiens: 7 + 16 │ │ ╭─▶ + 17 │ │ ├─▶ function foo() internal {} + │ │ │ + │ │ ╰──────────────────────────────────── definiens: 9 + 18 │ ├───────▶ } + │ │ + │ ╰───────────── definiens: 5 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/scoping/shadowing/input.sol b/crates/solidity/testing/snapshots/bindings_output/scoping/shadowing/input.sol new file mode 100644 index 0000000000..914bdc9b1c --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/scoping/shadowing/input.sol @@ -0,0 +1,18 @@ +function foo() {} +function bar() {} + +contract Base { + function bar() public {} +} + +contract Test is Base { + int x; + + function test(int x) public { + foo(); + bar(); + x; + } + + function foo() internal {} +} diff --git a/crates/solidity/testing/snapshots/bindings_output/user_types/in_contract/generated/0.4.11-failure.txt b/crates/solidity/testing/snapshots/bindings_output/user_types/in_contract/generated/0.4.11-failure.txt new file mode 100644 index 0000000000..2e16892373 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/user_types/in_contract/generated/0.4.11-failure.txt @@ -0,0 +1,28 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected AddressKeyword or BoolKeyword or ByteKeyword or BytesKeyword or CloseBrace or EnumKeyword or EventKeyword or FixedKeyword or FunctionKeyword or Identifier or IntKeyword or MappingKeyword or ModifierKeyword or StringKeyword or StructKeyword or UfixedKeyword or UintKeyword or UsingKeyword. + ╭─[input.sol:2:5] + │ + 2 │ ╭─▶ type Internal is uint; + ┆ ┆ + 7 │ ├─▶ } + │ │ + │ ╰─────────── Error occurred here. +───╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─▶ contract Test { + ┆ ┆ + 8 │ ├─▶ } + │ │ + │ ╰─────── definiens: 1 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/user_types/in_contract/generated/0.4.22-failure.txt b/crates/solidity/testing/snapshots/bindings_output/user_types/in_contract/generated/0.4.22-failure.txt new file mode 100644 index 0000000000..3869c1dc06 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/user_types/in_contract/generated/0.4.22-failure.txt @@ -0,0 +1,28 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected AddressKeyword or BoolKeyword or ByteKeyword or BytesKeyword or CloseBrace or ConstructorKeyword or EnumKeyword or EventKeyword or FixedKeyword or FunctionKeyword or Identifier or IntKeyword or MappingKeyword or ModifierKeyword or StringKeyword or StructKeyword or UfixedKeyword or UintKeyword or UsingKeyword. + ╭─[input.sol:2:5] + │ + 2 │ ╭─▶ type Internal is uint; + ┆ ┆ + 7 │ ├─▶ } + │ │ + │ ╰─────────── Error occurred here. +───╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─▶ contract Test { + ┆ ┆ + 8 │ ├─▶ } + │ │ + │ ╰─────── definiens: 1 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/user_types/in_contract/generated/0.6.0-failure.txt b/crates/solidity/testing/snapshots/bindings_output/user_types/in_contract/generated/0.6.0-failure.txt new file mode 100644 index 0000000000..c1790bdaa0 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/user_types/in_contract/generated/0.6.0-failure.txt @@ -0,0 +1,28 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected AddressKeyword or BoolKeyword or ByteKeyword or BytesKeyword or CloseBrace or ConstructorKeyword or EnumKeyword or EventKeyword or FallbackKeyword or FixedKeyword or FunctionKeyword or Identifier or IntKeyword or MappingKeyword or ModifierKeyword or ReceiveKeyword or StringKeyword or StructKeyword or UfixedKeyword or UintKeyword or UsingKeyword. + ╭─[input.sol:2:5] + │ + 2 │ ╭─▶ type Internal is uint; + ┆ ┆ + 7 │ ├─▶ } + │ │ + │ ╰─────────── Error occurred here. +───╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─▶ contract Test { + ┆ ┆ + 8 │ ├─▶ } + │ │ + │ ╰─────── definiens: 1 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/user_types/in_contract/generated/0.8.0-failure.txt b/crates/solidity/testing/snapshots/bindings_output/user_types/in_contract/generated/0.8.0-failure.txt new file mode 100644 index 0000000000..304289cf23 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/user_types/in_contract/generated/0.8.0-failure.txt @@ -0,0 +1,28 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected AddressKeyword or BoolKeyword or BytesKeyword or CloseBrace or ConstructorKeyword or EnumKeyword or EventKeyword or FallbackKeyword or FixedKeyword or FunctionKeyword or Identifier or IntKeyword or MappingKeyword or ModifierKeyword or ReceiveKeyword or StringKeyword or StructKeyword or UfixedKeyword or UintKeyword or UsingKeyword. + ╭─[input.sol:2:5] + │ + 2 │ ╭─▶ type Internal is uint; + ┆ ┆ + 7 │ ├─▶ } + │ │ + │ ╰─────────── Error occurred here. +───╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─▶ contract Test { + ┆ ┆ + 8 │ ├─▶ } + │ │ + │ ╰─────── definiens: 1 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/user_types/in_contract/generated/0.8.4-failure.txt b/crates/solidity/testing/snapshots/bindings_output/user_types/in_contract/generated/0.8.4-failure.txt new file mode 100644 index 0000000000..4171c4dcf3 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/user_types/in_contract/generated/0.8.4-failure.txt @@ -0,0 +1,28 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected AddressKeyword or BoolKeyword or BytesKeyword or CloseBrace or ConstructorKeyword or EnumKeyword or ErrorKeyword or EventKeyword or FallbackKeyword or FixedKeyword or FunctionKeyword or Identifier or IntKeyword or MappingKeyword or ModifierKeyword or ReceiveKeyword or StringKeyword or StructKeyword or UfixedKeyword or UintKeyword or UsingKeyword. + ╭─[input.sol:2:5] + │ + 2 │ ╭─▶ type Internal is uint; + ┆ ┆ + 7 │ ├─▶ } + │ │ + │ ╰─────────── Error occurred here. +───╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─▶ contract Test { + ┆ ┆ + 8 │ ├─▶ } + │ │ + │ ╰─────── definiens: 1 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/user_types/in_contract/generated/0.8.8-success.txt b/crates/solidity/testing/snapshots/bindings_output/user_types/in_contract/generated/0.8.8-success.txt new file mode 100644 index 0000000000..9f09719786 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/user_types/in_contract/generated/0.8.8-success.txt @@ -0,0 +1,52 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ type Internal is uint; + │ ────┬─── + │ ╰───── name: 2 + │ + 4 │ function test() public returns (uint) { + │ ──┬─ + │ ╰─── name: 3 + 5 │ Internal inter = Internal.wrap(10); + │ ────┬─── ──┬── ────┬─── ──┬─ + │ ╰─────────────────────────── ref: 2 + │ │ │ │ + │ ╰──────────────────── name: 4 + │ │ │ + │ ╰────────── ref: 2 + │ │ + │ ╰─── ref: built-in + 6 │ return Internal.unwrap(inter); + │ ────┬─── ───┬── ──┬── + │ ╰────────────────── ref: 2 + │ │ │ + │ ╰────────── ref: built-in + │ │ + │ ╰──── ref: 4 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭───▶ contract Test { + 2 │ │ │ type Internal is uint; + │ │ │ ─────────────┬───────────── + │ │ │ ╰─────────────── definiens: 2 + 3 │ │ ╭─▶ + ┆ ┆ ┆ + 5 │ │ │ Internal inter = Internal.wrap(10); + │ │ │ ──────────────────────┬───────────────────── + │ │ │ ╰─────────────────────── definiens: 4 + ┆ ┆ ┆ + 7 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 3 + 8 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/user_types/in_contract/input.sol b/crates/solidity/testing/snapshots/bindings_output/user_types/in_contract/input.sol new file mode 100644 index 0000000000..d11ee80514 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/user_types/in_contract/input.sol @@ -0,0 +1,8 @@ +contract Test { + type Internal is uint; + + function test() public returns (uint) { + Internal inter = Internal.wrap(10); + return Internal.unwrap(inter); + } +} diff --git a/crates/solidity/testing/snapshots/bindings_output/user_types/in_library/generated/0.4.11-failure.txt b/crates/solidity/testing/snapshots/bindings_output/user_types/in_library/generated/0.4.11-failure.txt new file mode 100644 index 0000000000..6c9bc7a7db --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/user_types/in_library/generated/0.4.11-failure.txt @@ -0,0 +1,55 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected AddressKeyword or BoolKeyword or ByteKeyword or BytesKeyword or CloseBrace or EnumKeyword or EventKeyword or FixedKeyword or FunctionKeyword or Identifier or IntKeyword or MappingKeyword or ModifierKeyword or StringKeyword or StructKeyword or UfixedKeyword or UintKeyword or UsingKeyword. + ╭─[input.sol:8:5] + │ + 8 │ ╭─▶ type LibType is int32; + ┆ ┆ + 12 │ ├─▶ } + │ │ + │ ╰─────────── Error occurred here. +────╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function test() public returns (int32) { + │ ──┬─ + │ ╰─── name: 2 + 3 │ return MyLib.LibType.unwrap(MyLib.create()); + │ ──┬── ───┬─── ───┬── ──┬── ───┬── + │ ╰──────────────────────────────── ref: 3 + │ │ │ │ │ + │ ╰───────────────────────── unresolved + │ │ │ │ + │ ╰───────────────── unresolved + │ │ │ + │ ╰─────────── ref: 3 + │ │ + │ ╰──── unresolved + │ + 7 │ library MyLib { + │ ──┬── + │ ╰──── name: 3 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Test { + 2 │ │ ╭─▶ function test() public returns (int32) { + ┆ ┆ ┆ + 4 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 5 │ │ ├───▶ } + │ │ │ + │ │ ╰───────── definiens: 1 + 6 │ ╭─────▶ + ┆ ┆ + 13 │ ├─────▶ } + │ │ + │ ╰─────────── definiens: 3 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/user_types/in_library/generated/0.4.22-failure.txt b/crates/solidity/testing/snapshots/bindings_output/user_types/in_library/generated/0.4.22-failure.txt new file mode 100644 index 0000000000..0458ed0cc5 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/user_types/in_library/generated/0.4.22-failure.txt @@ -0,0 +1,55 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected AddressKeyword or BoolKeyword or ByteKeyword or BytesKeyword or CloseBrace or ConstructorKeyword or EnumKeyword or EventKeyword or FixedKeyword or FunctionKeyword or Identifier or IntKeyword or MappingKeyword or ModifierKeyword or StringKeyword or StructKeyword or UfixedKeyword or UintKeyword or UsingKeyword. + ╭─[input.sol:8:5] + │ + 8 │ ╭─▶ type LibType is int32; + ┆ ┆ + 12 │ ├─▶ } + │ │ + │ ╰─────────── Error occurred here. +────╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function test() public returns (int32) { + │ ──┬─ + │ ╰─── name: 2 + 3 │ return MyLib.LibType.unwrap(MyLib.create()); + │ ──┬── ───┬─── ───┬── ──┬── ───┬── + │ ╰──────────────────────────────── ref: 3 + │ │ │ │ │ + │ ╰───────────────────────── unresolved + │ │ │ │ + │ ╰───────────────── unresolved + │ │ │ + │ ╰─────────── ref: 3 + │ │ + │ ╰──── unresolved + │ + 7 │ library MyLib { + │ ──┬── + │ ╰──── name: 3 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Test { + 2 │ │ ╭─▶ function test() public returns (int32) { + ┆ ┆ ┆ + 4 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 5 │ │ ├───▶ } + │ │ │ + │ │ ╰───────── definiens: 1 + 6 │ ╭─────▶ + ┆ ┆ + 13 │ ├─────▶ } + │ │ + │ ╰─────────── definiens: 3 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/user_types/in_library/generated/0.6.0-failure.txt b/crates/solidity/testing/snapshots/bindings_output/user_types/in_library/generated/0.6.0-failure.txt new file mode 100644 index 0000000000..bbc8f01427 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/user_types/in_library/generated/0.6.0-failure.txt @@ -0,0 +1,55 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected AddressKeyword or BoolKeyword or ByteKeyword or BytesKeyword or CloseBrace or ConstructorKeyword or EnumKeyword or EventKeyword or FallbackKeyword or FixedKeyword or FunctionKeyword or Identifier or IntKeyword or MappingKeyword or ModifierKeyword or ReceiveKeyword or StringKeyword or StructKeyword or UfixedKeyword or UintKeyword or UsingKeyword. + ╭─[input.sol:8:5] + │ + 8 │ ╭─▶ type LibType is int32; + ┆ ┆ + 12 │ ├─▶ } + │ │ + │ ╰─────────── Error occurred here. +────╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function test() public returns (int32) { + │ ──┬─ + │ ╰─── name: 2 + 3 │ return MyLib.LibType.unwrap(MyLib.create()); + │ ──┬── ───┬─── ───┬── ──┬── ───┬── + │ ╰──────────────────────────────── ref: 3 + │ │ │ │ │ + │ ╰───────────────────────── unresolved + │ │ │ │ + │ ╰───────────────── unresolved + │ │ │ + │ ╰─────────── ref: 3 + │ │ + │ ╰──── unresolved + │ + 7 │ library MyLib { + │ ──┬── + │ ╰──── name: 3 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Test { + 2 │ │ ╭─▶ function test() public returns (int32) { + ┆ ┆ ┆ + 4 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 5 │ │ ├───▶ } + │ │ │ + │ │ ╰───────── definiens: 1 + 6 │ ╭─────▶ + ┆ ┆ + 13 │ ├─────▶ } + │ │ + │ ╰─────────── definiens: 3 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/user_types/in_library/generated/0.8.0-failure.txt b/crates/solidity/testing/snapshots/bindings_output/user_types/in_library/generated/0.8.0-failure.txt new file mode 100644 index 0000000000..1da3485ae6 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/user_types/in_library/generated/0.8.0-failure.txt @@ -0,0 +1,55 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected AddressKeyword or BoolKeyword or BytesKeyword or CloseBrace or ConstructorKeyword or EnumKeyword or EventKeyword or FallbackKeyword or FixedKeyword or FunctionKeyword or Identifier or IntKeyword or MappingKeyword or ModifierKeyword or ReceiveKeyword or StringKeyword or StructKeyword or UfixedKeyword or UintKeyword or UsingKeyword. + ╭─[input.sol:8:5] + │ + 8 │ ╭─▶ type LibType is int32; + ┆ ┆ + 12 │ ├─▶ } + │ │ + │ ╰─────────── Error occurred here. +────╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function test() public returns (int32) { + │ ──┬─ + │ ╰─── name: 2 + 3 │ return MyLib.LibType.unwrap(MyLib.create()); + │ ──┬── ───┬─── ───┬── ──┬── ───┬── + │ ╰──────────────────────────────── ref: 3 + │ │ │ │ │ + │ ╰───────────────────────── unresolved + │ │ │ │ + │ ╰───────────────── unresolved + │ │ │ + │ ╰─────────── ref: 3 + │ │ + │ ╰──── unresolved + │ + 7 │ library MyLib { + │ ──┬── + │ ╰──── name: 3 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Test { + 2 │ │ ╭─▶ function test() public returns (int32) { + ┆ ┆ ┆ + 4 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 5 │ │ ├───▶ } + │ │ │ + │ │ ╰───────── definiens: 1 + 6 │ ╭─────▶ + ┆ ┆ + 13 │ ├─────▶ } + │ │ + │ ╰─────────── definiens: 3 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/user_types/in_library/generated/0.8.4-failure.txt b/crates/solidity/testing/snapshots/bindings_output/user_types/in_library/generated/0.8.4-failure.txt new file mode 100644 index 0000000000..c30d4efa32 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/user_types/in_library/generated/0.8.4-failure.txt @@ -0,0 +1,55 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected AddressKeyword or BoolKeyword or BytesKeyword or CloseBrace or ConstructorKeyword or EnumKeyword or ErrorKeyword or EventKeyword or FallbackKeyword or FixedKeyword or FunctionKeyword or Identifier or IntKeyword or MappingKeyword or ModifierKeyword or ReceiveKeyword or StringKeyword or StructKeyword or UfixedKeyword or UintKeyword or UsingKeyword. + ╭─[input.sol:8:5] + │ + 8 │ ╭─▶ type LibType is int32; + ┆ ┆ + 12 │ ├─▶ } + │ │ + │ ╰─────────── Error occurred here. +────╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function test() public returns (int32) { + │ ──┬─ + │ ╰─── name: 2 + 3 │ return MyLib.LibType.unwrap(MyLib.create()); + │ ──┬── ───┬─── ───┬── ──┬── ───┬── + │ ╰──────────────────────────────── ref: 3 + │ │ │ │ │ + │ ╰───────────────────────── unresolved + │ │ │ │ + │ ╰───────────────── unresolved + │ │ │ + │ ╰─────────── ref: 3 + │ │ + │ ╰──── unresolved + │ + 7 │ library MyLib { + │ ──┬── + │ ╰──── name: 3 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Test { + 2 │ │ ╭─▶ function test() public returns (int32) { + ┆ ┆ ┆ + 4 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 5 │ │ ├───▶ } + │ │ │ + │ │ ╰───────── definiens: 1 + 6 │ ╭─────▶ + ┆ ┆ + 13 │ ├─────▶ } + │ │ + │ ╰─────────── definiens: 3 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/user_types/in_library/generated/0.8.8-success.txt b/crates/solidity/testing/snapshots/bindings_output/user_types/in_library/generated/0.8.8-success.txt new file mode 100644 index 0000000000..80f434fe91 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/user_types/in_library/generated/0.8.8-success.txt @@ -0,0 +1,67 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function test() public returns (int32) { + │ ──┬─ + │ ╰─── name: 2 + 3 │ return MyLib.LibType.unwrap(MyLib.create()); + │ ──┬── ───┬─── ───┬── ──┬── ───┬── + │ ╰──────────────────────────────── ref: 3 + │ │ │ │ │ + │ ╰───────────────────────── ref: 4 + │ │ │ │ + │ ╰───────────────── ref: built-in + │ │ │ + │ ╰─────────── ref: 3 + │ │ + │ ╰──── ref: 5 + │ + 7 │ library MyLib { + │ ──┬── + │ ╰──── name: 3 + 8 │ type LibType is int32; + │ ───┬─── + │ ╰───── name: 4 + │ + 10 │ function create() public returns (LibType) { + │ ───┬── ───┬─── + │ ╰────────────────────────────── name: 5 + │ │ + │ ╰───── ref: 4 + 11 │ return LibType.wrap(30); + │ ───┬─── ──┬─ + │ ╰────────── ref: 4 + │ │ + │ ╰─── ref: built-in +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ──▶ contract Test { + 2 │ │ ╭───▶ function test() public returns (int32) { + ┆ ┆ ┆ + 4 │ │ ├───▶ } + │ │ │ + │ │ ╰───────────── definiens: 2 + 5 │ │ ├─────▶ } + │ │ │ + │ │ ╰─────────── definiens: 1 + 6 │ ╭───────▶ + ┆ ┆ + 8 │ │ │ type LibType is int32; + │ │ │ ─────────────┬───────────── + │ │ │ ╰─────────────── definiens: 4 + 9 │ │ ╭─▶ + ┆ ┆ ┆ + 12 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 5 + 13 │ ├───────▶ } + │ │ + │ ╰───────────── definiens: 3 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/user_types/in_library/input.sol b/crates/solidity/testing/snapshots/bindings_output/user_types/in_library/input.sol new file mode 100644 index 0000000000..db9e99f584 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/user_types/in_library/input.sol @@ -0,0 +1,13 @@ +contract Test { + function test() public returns (int32) { + return MyLib.LibType.unwrap(MyLib.create()); + } +} + +library MyLib { + type LibType is int32; + + function create() public returns (LibType) { + return LibType.wrap(30); + } +} diff --git a/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/generated/0.4.11-failure.txt b/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/generated/0.4.11-failure.txt new file mode 100644 index 0000000000..565b7e733a --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/generated/0.4.11-failure.txt @@ -0,0 +1,41 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected OpenBrace or ReturnsKeyword or Semicolon. + ╭─[input.sol:2:28] + │ + 2 │ ╭─▶ function test() public pure returns (uint) { + ┆ ┆ + 5 │ ├─▶ } + │ │ + │ ╰─────────── Error occurred here. +───╯ +Error: Expected ContractKeyword or ImportKeyword or InterfaceKeyword or LibraryKeyword or PragmaKeyword. + ╭─[input.sol:8:1] + │ + 8 │ type TopLevel is uint256; + │ ─────────────┬──────────── + │ ╰────────────── Error occurred here. +───╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function test() public pure returns (uint) { + │ ──┬─ + │ ╰─── name: 2 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─▶ contract Test { + 2 │ │ function test() public pure returns (uint) { + │ │ ─────────────┬──────────── + │ │ ╰────────────── definiens: 2 + ┆ ┆ + 6 │ ├─▶ } + │ │ + │ ╰─────── definiens: 1 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/generated/0.4.16-failure.txt b/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/generated/0.4.16-failure.txt new file mode 100644 index 0000000000..efc8ca3e3b --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/generated/0.4.16-failure.txt @@ -0,0 +1,52 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected ContractKeyword or ImportKeyword or InterfaceKeyword or LibraryKeyword or PragmaKeyword. + ╭─[input.sol:8:1] + │ + 8 │ type TopLevel is uint256; + │ ─────────────┬──────────── + │ ╰────────────── Error occurred here. +───╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function test() public pure returns (uint) { + │ ──┬─ + │ ╰─── name: 2 + 3 │ TopLevel tl = TopLevel.wrap(20); + │ ────┬─── ─┬ ────┬─── ──┬─ + │ ╰──────────────────────── unresolved + │ │ │ │ + │ ╰────────────────── name: 3 + │ │ │ + │ ╰────────── unresolved + │ │ + │ ╰─── unresolved + 4 │ return TopLevel.unwrap(tl); + │ ────┬─── ───┬── ─┬ + │ ╰─────────────── unresolved + │ │ │ + │ ╰─────── unresolved + │ │ + │ ╰── ref: 3 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Test { + 2 │ │ ╭─▶ function test() public pure returns (uint) { + 3 │ │ │ TopLevel tl = TopLevel.wrap(20); + │ │ │ ────────────────────┬──────────────────── + │ │ │ ╰────────────────────── definiens: 3 + ┆ ┆ ┆ + 5 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 6 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/generated/0.6.0-failure.txt b/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/generated/0.6.0-failure.txt new file mode 100644 index 0000000000..9372d9f9e8 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/generated/0.6.0-failure.txt @@ -0,0 +1,52 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected ContractKeyword or EnumKeyword or ImportKeyword or InterfaceKeyword or LibraryKeyword or PragmaKeyword or StructKeyword. + ╭─[input.sol:8:1] + │ + 8 │ type TopLevel is uint256; + │ ─────────────┬──────────── + │ ╰────────────── Error occurred here. +───╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function test() public pure returns (uint) { + │ ──┬─ + │ ╰─── name: 2 + 3 │ TopLevel tl = TopLevel.wrap(20); + │ ────┬─── ─┬ ────┬─── ──┬─ + │ ╰──────────────────────── unresolved + │ │ │ │ + │ ╰────────────────── name: 3 + │ │ │ + │ ╰────────── unresolved + │ │ + │ ╰─── unresolved + 4 │ return TopLevel.unwrap(tl); + │ ────┬─── ───┬── ─┬ + │ ╰─────────────── unresolved + │ │ │ + │ ╰─────── unresolved + │ │ + │ ╰── ref: 3 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Test { + 2 │ │ ╭─▶ function test() public pure returns (uint) { + 3 │ │ │ TopLevel tl = TopLevel.wrap(20); + │ │ │ ────────────────────┬──────────────────── + │ │ │ ╰────────────────────── definiens: 3 + ┆ ┆ ┆ + 5 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 6 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/generated/0.7.1-failure.txt b/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/generated/0.7.1-failure.txt new file mode 100644 index 0000000000..bf22d0b6b7 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/generated/0.7.1-failure.txt @@ -0,0 +1,52 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected ContractKeyword or EnumKeyword or FunctionKeyword or ImportKeyword or InterfaceKeyword or LibraryKeyword or PragmaKeyword or StructKeyword. + ╭─[input.sol:8:1] + │ + 8 │ type TopLevel is uint256; + │ ─────────────┬──────────── + │ ╰────────────── Error occurred here. +───╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function test() public pure returns (uint) { + │ ──┬─ + │ ╰─── name: 2 + 3 │ TopLevel tl = TopLevel.wrap(20); + │ ────┬─── ─┬ ────┬─── ──┬─ + │ ╰──────────────────────── unresolved + │ │ │ │ + │ ╰────────────────── name: 3 + │ │ │ + │ ╰────────── unresolved + │ │ + │ ╰─── unresolved + 4 │ return TopLevel.unwrap(tl); + │ ────┬─── ───┬── ─┬ + │ ╰─────────────── unresolved + │ │ │ + │ ╰─────── unresolved + │ │ + │ ╰── ref: 3 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Test { + 2 │ │ ╭─▶ function test() public pure returns (uint) { + 3 │ │ │ TopLevel tl = TopLevel.wrap(20); + │ │ │ ────────────────────┬──────────────────── + │ │ │ ╰────────────────────── definiens: 3 + ┆ ┆ ┆ + 5 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 6 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/generated/0.7.4-failure.txt b/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/generated/0.7.4-failure.txt new file mode 100644 index 0000000000..6a4e6fd0f0 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/generated/0.7.4-failure.txt @@ -0,0 +1,52 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected AddressKeyword or BoolKeyword or ByteKeyword or BytesKeyword or ContractKeyword or EnumKeyword or FixedKeyword or FunctionKeyword or Identifier or ImportKeyword or IntKeyword or InterfaceKeyword or LibraryKeyword or MappingKeyword or PragmaKeyword or StringKeyword or StructKeyword or UfixedKeyword or UintKeyword. + ╭─[input.sol:8:1] + │ + 8 │ type TopLevel is uint256; + │ ─────────────┬──────────── + │ ╰────────────── Error occurred here. +───╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function test() public pure returns (uint) { + │ ──┬─ + │ ╰─── name: 2 + 3 │ TopLevel tl = TopLevel.wrap(20); + │ ────┬─── ─┬ ────┬─── ──┬─ + │ ╰──────────────────────── unresolved + │ │ │ │ + │ ╰────────────────── name: 3 + │ │ │ + │ ╰────────── unresolved + │ │ + │ ╰─── unresolved + 4 │ return TopLevel.unwrap(tl); + │ ────┬─── ───┬── ─┬ + │ ╰─────────────── unresolved + │ │ │ + │ ╰─────── unresolved + │ │ + │ ╰── ref: 3 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Test { + 2 │ │ ╭─▶ function test() public pure returns (uint) { + 3 │ │ │ TopLevel tl = TopLevel.wrap(20); + │ │ │ ────────────────────┬──────────────────── + │ │ │ ╰────────────────────── definiens: 3 + ┆ ┆ ┆ + 5 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 6 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/generated/0.8.0-failure.txt b/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/generated/0.8.0-failure.txt new file mode 100644 index 0000000000..3d9899324b --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/generated/0.8.0-failure.txt @@ -0,0 +1,52 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected AddressKeyword or BoolKeyword or BytesKeyword or ContractKeyword or EnumKeyword or FixedKeyword or FunctionKeyword or Identifier or ImportKeyword or IntKeyword or InterfaceKeyword or LibraryKeyword or MappingKeyword or PragmaKeyword or StringKeyword or StructKeyword or UfixedKeyword or UintKeyword. + ╭─[input.sol:8:1] + │ + 8 │ type TopLevel is uint256; + │ ─────────────┬──────────── + │ ╰────────────── Error occurred here. +───╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function test() public pure returns (uint) { + │ ──┬─ + │ ╰─── name: 2 + 3 │ TopLevel tl = TopLevel.wrap(20); + │ ────┬─── ─┬ ────┬─── ──┬─ + │ ╰──────────────────────── unresolved + │ │ │ │ + │ ╰────────────────── name: 3 + │ │ │ + │ ╰────────── unresolved + │ │ + │ ╰─── unresolved + 4 │ return TopLevel.unwrap(tl); + │ ────┬─── ───┬── ─┬ + │ ╰─────────────── unresolved + │ │ │ + │ ╰─────── unresolved + │ │ + │ ╰── ref: 3 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Test { + 2 │ │ ╭─▶ function test() public pure returns (uint) { + 3 │ │ │ TopLevel tl = TopLevel.wrap(20); + │ │ │ ────────────────────┬──────────────────── + │ │ │ ╰────────────────────── definiens: 3 + ┆ ┆ ┆ + 5 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 6 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/generated/0.8.4-failure.txt b/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/generated/0.8.4-failure.txt new file mode 100644 index 0000000000..72bd5d8452 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/generated/0.8.4-failure.txt @@ -0,0 +1,52 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected AddressKeyword or BoolKeyword or BytesKeyword or ContractKeyword or EnumKeyword or ErrorKeyword or FixedKeyword or FunctionKeyword or Identifier or ImportKeyword or IntKeyword or InterfaceKeyword or LibraryKeyword or MappingKeyword or PragmaKeyword or StringKeyword or StructKeyword or UfixedKeyword or UintKeyword. + ╭─[input.sol:8:1] + │ + 8 │ type TopLevel is uint256; + │ ─────────────┬──────────── + │ ╰────────────── Error occurred here. +───╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function test() public pure returns (uint) { + │ ──┬─ + │ ╰─── name: 2 + 3 │ TopLevel tl = TopLevel.wrap(20); + │ ────┬─── ─┬ ────┬─── ──┬─ + │ ╰──────────────────────── unresolved + │ │ │ │ + │ ╰────────────────── name: 3 + │ │ │ + │ ╰────────── unresolved + │ │ + │ ╰─── unresolved + 4 │ return TopLevel.unwrap(tl); + │ ────┬─── ───┬── ─┬ + │ ╰─────────────── unresolved + │ │ │ + │ ╰─────── unresolved + │ │ + │ ╰── ref: 3 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Test { + 2 │ │ ╭─▶ function test() public pure returns (uint) { + 3 │ │ │ TopLevel tl = TopLevel.wrap(20); + │ │ │ ────────────────────┬──────────────────── + │ │ │ ╰────────────────────── definiens: 3 + ┆ ┆ ┆ + 5 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 6 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/generated/0.8.8-success.txt b/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/generated/0.8.8-success.txt new file mode 100644 index 0000000000..039a1e8ce0 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/generated/0.8.8-success.txt @@ -0,0 +1,52 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function test() public pure returns (uint) { + │ ──┬─ + │ ╰─── name: 2 + 3 │ TopLevel tl = TopLevel.wrap(20); + │ ────┬─── ─┬ ────┬─── ──┬─ + │ ╰──────────────────────── ref: 4 + │ │ │ │ + │ ╰────────────────── name: 3 + │ │ │ + │ ╰────────── ref: 4 + │ │ + │ ╰─── ref: built-in + 4 │ return TopLevel.unwrap(tl); + │ ────┬─── ───┬── ─┬ + │ ╰─────────────── ref: 4 + │ │ │ + │ ╰─────── ref: built-in + │ │ + │ ╰── ref: 3 + │ + 8 │ type TopLevel is uint256; + │ ────┬─── + │ ╰───── name: 4 +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ──▶ contract Test { + 2 │ │ ╭───▶ function test() public pure returns (uint) { + 3 │ │ │ TopLevel tl = TopLevel.wrap(20); + │ │ │ ────────────────────┬──────────────────── + │ │ │ ╰────────────────────── definiens: 3 + ┆ ┆ ┆ + 5 │ │ ├───▶ } + │ │ │ + │ │ ╰───────────── definiens: 2 + 6 │ ├───│ ▶ } + │ │ │ + │ ╰─────────── definiens: 1 + 7 │ ╭─▶ + 8 │ ├─▶ type TopLevel is uint256; + │ │ + │ ╰─────────────────────────────── definiens: 4 +───╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/input.sol b/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/input.sol new file mode 100644 index 0000000000..46dbe68b66 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/user_types/top_level/input.sol @@ -0,0 +1,8 @@ +contract Test { + function test() public pure returns (uint) { + TopLevel tl = TopLevel.wrap(20); + return TopLevel.unwrap(tl); + } +} + +type TopLevel is uint256; diff --git a/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.6.0-failure.txt b/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.6.0-failure.txt index 60f13f6d52..79e874b642 100644 --- a/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.6.0-failure.txt +++ b/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.6.0-failure.txt @@ -47,7 +47,7 @@ References and definitions: │ ──┬─ ───┬─── ┬ │ ╰──────────────────── name: 5 │ │ │ - │ ╰────────────── ref: 1 + │ ╰────────────── refs: 3, 1 │ │ │ ╰── name: 6 5 │ c.increment(); diff --git a/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.7.1-failure.txt b/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.7.1-failure.txt index a8ca2070bc..50761a4783 100644 --- a/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.7.1-failure.txt +++ b/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.7.1-failure.txt @@ -60,7 +60,7 @@ References and definitions: │ ──┬─ ───┬─── ┬ │ ╰──────────────────── name: 7 │ │ │ - │ ╰────────────── ref: 1 + │ ╰────────────── refs: 5, 1 │ │ │ ╰── name: 8 5 │ c.increment(); diff --git a/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.7.4-failure.txt b/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.7.4-failure.txt index f3a7e2bd2a..26bbf4f35d 100644 --- a/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.7.4-failure.txt +++ b/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.7.4-failure.txt @@ -60,7 +60,7 @@ References and definitions: │ ──┬─ ───┬─── ┬ │ ╰──────────────────── name: 7 │ │ │ - │ ╰────────────── ref: 1 + │ ╰────────────── refs: 5, 1 │ │ │ ╰── name: 8 5 │ c.increment(); diff --git a/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.8.0-failure.txt b/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.8.0-failure.txt index 5fe86fcc35..edba528b72 100644 --- a/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.8.0-failure.txt +++ b/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.8.0-failure.txt @@ -60,7 +60,7 @@ References and definitions: │ ──┬─ ───┬─── ┬ │ ╰──────────────────── name: 7 │ │ │ - │ ╰────────────── ref: 1 + │ ╰────────────── refs: 5, 1 │ │ │ ╰── name: 8 5 │ c.increment(); diff --git a/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.8.13-success.txt b/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.8.13-success.txt index 908ff33f40..9fe7225926 100644 --- a/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.8.13-success.txt +++ b/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.8.13-success.txt @@ -57,7 +57,7 @@ References and definitions: │ ──┬─ ───┬─── ┬ │ ╰──────────────────── name: 7 │ │ │ - │ ╰────────────── ref: 1 + │ ╰────────────── refs: 5, 1 │ │ │ ╰── name: 8 5 │ c.increment(); diff --git a/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.8.4-failure.txt b/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.8.4-failure.txt index 8ab68f067d..5f9f41adf8 100644 --- a/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.8.4-failure.txt +++ b/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.8.4-failure.txt @@ -60,7 +60,7 @@ References and definitions: │ ──┬─ ───┬─── ┬ │ ╰──────────────────── name: 7 │ │ │ - │ ╰────────────── ref: 1 + │ ╰────────────── refs: 5, 1 │ │ │ ╰── name: 8 5 │ c.increment(); diff --git a/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.8.8-failure.txt b/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.8.8-failure.txt index 3e57b55071..9e5d37a41c 100644 --- a/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.8.8-failure.txt +++ b/crates/solidity/testing/snapshots/bindings_output/using/global/generated/0.8.8-failure.txt @@ -60,7 +60,7 @@ References and definitions: │ ──┬─ ───┬─── ┬ │ ╰──────────────────── name: 7 │ │ │ - │ ╰────────────── ref: 1 + │ ╰────────────── refs: 5, 1 │ │ │ ╰── name: 8 5 │ c.increment(); diff --git a/crates/solidity/testing/snapshots/bindings_output/variables/destructuring/generated/0.4.11-success.txt b/crates/solidity/testing/snapshots/bindings_output/variables/destructuring/generated/0.4.11-success.txt new file mode 100644 index 0000000000..49b11841b9 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/variables/destructuring/generated/0.4.11-success.txt @@ -0,0 +1,102 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ library Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ enum Choice { Yes, No } + │ ───┬── ─┬─ ─┬ + │ ╰────────────── name: 2 + │ │ │ + │ ╰─────── name: 3 + │ │ + │ ╰── name: 4 + │ + 4 │ function test() public { + │ ──┬─ + │ ╰─── name: 5 + 5 │ (int x, int y) = (1, 2); + │ ┬ ┬ + │ ╰───────── name: 6 + │ │ + │ ╰── name: 7 + 6 │ (int z, , int w) = (1, 2, 3); + │ ┬ ┬ + │ ╰─────────── name: 8 + │ │ + │ ╰── name: 9 + 7 │ assert(x == z); + │ ───┬── ┬ ┬ + │ ╰─────────── ref: built-in + │ │ │ + │ ╰─────── ref: 6 + │ │ + │ ╰── ref: 8 + 8 │ assert(y < w); + │ ───┬── ┬ ┬ + │ ╰────────── ref: built-in + │ │ │ + │ ╰────── ref: 7 + │ │ + │ ╰── ref: 9 + 9 │ (, Choice c) = (Choice.Yes, Choice.No); + │ ───┬── ┬ ───┬── ─┬─ ───┬── ─┬ + │ ╰──────────────────────────────── ref: 2 + │ │ │ │ │ │ + │ ╰──────────────────────────── name: 10 + │ │ │ │ │ + │ ╰─────────────────── ref: 2 + │ │ │ │ + │ ╰────────────── ref: 3 + │ │ │ + │ ╰─────── ref: 2 + │ │ + │ ╰── ref: 4 + │ + 11 │ assert(c == Choice.No); + │ ───┬── ┬ ───┬── ─┬ + │ ╰─────────────────── ref: built-in + │ │ │ │ + │ ╰─────────────── ref: 10 + │ │ │ + │ ╰─────── ref: 2 + │ │ + │ ╰── ref: 4 +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭───▶ library Test { + 2 │ │ │ enum Choice { Yes, No } + │ │ │ ──────────────┬────┬────┬─── + │ │ │ ╰─────────────── definiens: 2 + │ │ │ │ │ + │ │ │ ╰────────── definiens: 3 + │ │ │ │ + │ │ │ ╰───── definiens: 4 + 3 │ │ ╭─▶ + ┆ ┆ ┆ + 5 │ │ │ (int x, int y) = (1, 2); + │ │ │ ──┬── ───┬── + │ │ │ ╰─────────── definiens: 6 + │ │ │ │ + │ │ │ ╰──── definiens: 7 + 6 │ │ │ (int z, , int w) = (1, 2, 3); + │ │ │ ──┬── ───┬── + │ │ │ ╰───────────── definiens: 8 + │ │ │ │ + │ │ │ ╰──── definiens: 9 + ┆ ┆ ┆ + 9 │ │ │ (, Choice c) = (Choice.Yes, Choice.No); + │ │ │ ────┬──── + │ │ │ ╰────── definiens: 10 + ┆ ┆ ┆ + 12 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 5 + 13 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/variables/destructuring/input.sol b/crates/solidity/testing/snapshots/bindings_output/variables/destructuring/input.sol new file mode 100644 index 0000000000..c0c3323bb1 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/variables/destructuring/input.sol @@ -0,0 +1,13 @@ +library Test { + enum Choice { Yes, No } + + function test() public { + (int x, int y) = (1, 2); + (int z, , int w) = (1, 2, 3); + assert(x == z); + assert(y < w); + (, Choice c) = (Choice.Yes, Choice.No); + + assert(c == Choice.No); + } +} diff --git a/crates/solidity/testing/snapshots/bindings_output/yul/blocks/generated/0.4.11-success.txt b/crates/solidity/testing/snapshots/bindings_output/yul/blocks/generated/0.4.11-success.txt new file mode 100644 index 0000000000..2b93bb1205 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/yul/blocks/generated/0.4.11-success.txt @@ -0,0 +1,75 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract AssemblyBlocks { + │ ───────┬────── + │ ╰──────── name: 1 + 2 │ function yul_let(uint256 x) public returns (uint256 z) { + │ ───┬─── ┬ ┬ + │ ╰────────────────────────────────────────── name: 2 + │ │ │ + │ ╰───────────────────────────── name: 3 + │ │ + │ ╰── name: 4 + │ + 4 │ let zero := 0 + │ ──┬─ + │ ╰─── name: 5 + 5 │ let v := zero + │ ┬ ──┬─ + │ ╰────────── name: 6 + │ │ + │ ╰─── ref: 5 + │ + 7 │ let y := x + │ ┬ ┬ + │ ╰─────── name: 7 + │ │ + │ ╰── ref: 3 + 8 │ z := v + │ ┬ ┬ + │ ╰─────── ref: 4 + │ │ + │ ╰── ref: 6 + 9 │ v := y + │ ┬ ┬ + │ ╰─────── ref: 6 + │ │ + │ ╰── ref: 7 + │ + 11 │ v := zero + │ ┬ ──┬─ + │ ╰────────── ref: 6 + │ │ + │ ╰─── ref: 5 +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract AssemblyBlocks { + 2 │ │ ╭─▶ function yul_let(uint256 x) public returns (uint256 z) { + │ │ │ ────┬──── ────┬──── + │ │ │ ╰───────────────────────────────── definiens: 3 + │ │ │ │ + │ │ │ ╰────── definiens: 4 + ┆ ┆ ┆ + 4 │ │ │ let zero := 0 + │ │ │ ─────────────┬──────────── + │ │ │ ╰────────────── definiens: 5 + 5 │ │ │ let v := zero + │ │ │ ─────────────┬──────────── + │ │ │ ╰────────────── definiens: 6 + ┆ ┆ ┆ + 7 │ │ │ let y := x + │ │ │ ─────────────┬───────────── + │ │ │ ╰─────────────── definiens: 7 + ┆ ┆ ┆ + 13 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 14 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/yul/blocks/input.sol b/crates/solidity/testing/snapshots/bindings_output/yul/blocks/input.sol new file mode 100644 index 0000000000..e86f82e37e --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/yul/blocks/input.sol @@ -0,0 +1,14 @@ +contract AssemblyBlocks { + function yul_let(uint256 x) public returns (uint256 z) { + assembly { + let zero := 0 + let v := zero + { + let y := x + z := v + v := y + } + v := zero + } + } +} diff --git a/crates/solidity/testing/snapshots/bindings_output/yul/functions/generated/0.4.11-success.txt b/crates/solidity/testing/snapshots/bindings_output/yul/functions/generated/0.4.11-success.txt index 683bf1f819..e4a9d36fcb 100644 --- a/crates/solidity/testing/snapshots/bindings_output/yul/functions/generated/0.4.11-success.txt +++ b/crates/solidity/testing/snapshots/bindings_output/yul/functions/generated/0.4.11-success.txt @@ -14,85 +14,132 @@ References and definitions: │ │ │ ╰── name: 4 │ - 4 │ let y := add(x, 5) + 4 │ function outer1(a) -> b { + │ ───┬── ┬ ┬ + │ ╰──────────── name: 5 + │ │ │ + │ ╰──────── name: 6 + │ │ + │ ╰── name: 7 + 5 │ b := add(a, 1) │ ┬ ┬ - │ ╰─────────── name: 5 + │ ╰─────────── ref: 7 │ │ - │ ╰── ref: 3 - 5 │ x, y := swap(x, y) - │ ┬ ┬ ──┬─ ┬ ┬ - │ ╰────────────────── ref: 3 - │ │ │ │ │ - │ ╰─────────────── ref: 5 - │ │ │ │ - │ ╰──────── ref: 6 - │ │ │ - │ ╰───── ref: 3 - │ │ - │ ╰── ref: 5 - 6 │ r := add(x, y) - │ ┬ ┬ ┬ - │ ╰────────────── ref: 4 - │ │ │ - │ ╰───── ref: 3 - │ │ - │ ╰── ref: 5 + │ ╰── ref: 6 │ - 8 │ function swap(a, b) -> c, d { - │ ──┬─ ┬ ┬ ┬ ┬ - │ ╰───────────────── name: 6 - │ │ │ │ │ - │ ╰────────────── name: 7 - │ │ │ │ - │ ╰─────────── name: 8 - │ │ │ - │ ╰───── name: 9 + 9 │ r := add(outer1(x), inner(x)) + │ ┬ ───┬── ┬ ──┬── ┬ + │ ╰──────────────────────────── ref: 4 + │ │ │ │ │ + │ ╰──────────────── ref: 5 + │ │ │ │ + │ ╰──────────── ref: 3 + │ │ │ + │ ╰────── ref: 8 + │ │ + │ ╰── ref: 3 + 10 │ function inner(f) -> g { + │ ──┬── ┬ ┬ + │ ╰──────────── name: 8 + │ │ │ + │ ╰──────── name: 9 + │ │ + │ ╰── name: 10 + 11 │ g:= mul(f, outer2(f)) + │ ┬ ┬ ───┬── ┬ + │ ╰──────────────────── ref: 10 + │ │ │ │ + │ ╰──────────── ref: 9 + │ │ │ + │ ╰────── ref: 11 │ │ - │ ╰── name: 10 - 9 │ c := b - │ ┬ ┬ - │ ╰─────── ref: 9 - │ │ - │ ╰── ref: 8 - 10 │ d := a - │ ┬ ┬ - │ ╰─────── ref: 10 - │ │ - │ ╰── ref: 7 + │ ╰── ref: 9 + │ + 15 │ function outer2(c) -> d { + │ ───┬── ┬ ┬ + │ ╰──────────── name: 11 + │ │ │ + │ ╰──────── name: 12 + │ │ + │ ╰── name: 13 + 16 │ d := mul(c, outer2_inner(c)) + │ ┬ ┬ ──────┬───── ┬ + │ ╰─────────────────────────── ref: 13 + │ │ │ │ + │ ╰────────────────── ref: 12 + │ │ │ + │ ╰───────── ref: 14 + │ │ + │ ╰── ref: 12 + │ + 18 │ function outer2_inner(e) -> f { + │ ──────┬───── ┬ ┬ + │ ╰─────────────── name: 14 + │ │ │ + │ ╰──────── name: 15 + │ │ + │ ╰── name: 16 + 19 │ f := e + │ ┬ ┬ + │ ╰─────── ref: 16 + │ │ + │ ╰── ref: 15 ────╯ Definiens: ╭─[input.sol:1:1] │ - 1 │ ╭─│ ──▶ contract AssemblyFunctions { - 2 │ │ ╭───▶ function test(uint256 x) public returns (uint256 r) { - │ │ │ ────┬──── ────┬──── - │ │ │ ╰───────────────────────────────── definiens: 3 - │ │ │ │ - │ │ │ ╰────── definiens: 4 - ┆ ┆ ┆ - 4 │ │ │ let y := add(x, 5) - │ │ │ ───────────────┬─────────────── - │ │ │ ╰───────────────── definiens: 5 - ┆ ┆ ┆ - 7 │ │ │ ╭─▶ - 8 │ │ │ │ function swap(a, b) -> c, d { - │ │ │ │ ┬ ┬ ┬ ┬ - │ │ │ │ ╰────────────── definiens: 7 - │ │ │ │ │ │ │ - │ │ │ │ ╰─────────── definiens: 8 - │ │ │ │ │ │ - │ │ │ │ ╰───── definiens: 9 - │ │ │ │ │ - │ │ │ │ ╰── definiens: 10 - ┆ ┆ ┆ ┆ - 11 │ │ │ ├─▶ } - │ │ │ │ - │ │ │ ╰─────────────────── definiens: 6 - ┆ ┆ ┆ - 13 │ │ ├───▶ } - │ │ │ - │ │ ╰───────────── definiens: 2 - 14 │ ├─────▶ } - │ │ - │ ╰─────────── definiens: 1 + 1 │ ╭─│ ────────▶ contract AssemblyFunctions { + 2 │ │ ╭─────────▶ function test(uint256 x) public returns (uint256 r) { + │ │ │ ────┬──── ────┬──── + │ │ │ ╰───────────────────────────────── definiens: 3 + │ │ │ │ + │ │ │ ╰────── definiens: 4 + ┆ ┆ ┆ ┆ + 4 │ │ │ ╭─▶ function outer1(a) -> b { + │ │ │ │ ┬ ┬ + │ │ │ │ ╰──────── definiens: 6 + │ │ │ │ │ + │ │ │ │ ╰── definiens: 7 + ┆ ┆ ┆ ┆ + 6 │ │ │ ├─▶ } + │ │ │ │ + │ │ │ ╰─────────────────── definiens: 5 + ┆ ┆ ┆ + 10 │ │ │ ╭─────▶ function inner(f) -> g { + │ │ │ │ ┬ ┬ + │ │ │ │ ╰──────── definiens: 9 + │ │ │ │ │ + │ │ │ │ ╰── definiens: 10 + ┆ ┆ ┆ ┆ + 12 │ │ │ ├─────▶ } + │ │ │ │ + │ │ │ ╰─────────────────────────── definiens: 8 + ┆ ┆ ┆ ┆ + 14 │ │ │ ╭───────▶ + 15 │ │ │ │ function outer2(c) -> d { + │ │ │ │ ┬ ┬ + │ │ │ │ ╰──────── definiens: 12 + │ │ │ │ │ + │ │ │ │ ╰── definiens: 13 + ┆ ┆ ┆ ┆ ┆ + 17 │ │ │ │ ╭───▶ + 18 │ │ │ │ │ function outer2_inner(e) -> f { + │ │ │ │ │ ┬ ┬ + │ │ │ │ │ ╰──────── definiens: 15 + │ │ │ │ │ │ + │ │ │ │ │ ╰── definiens: 16 + ┆ ┆ ┆ ┆ ┆ + 20 │ │ │ │ ├───▶ } + │ │ │ │ │ + │ │ │ │ ╰───────────────────────── definiens: 14 + 21 │ │ │ ├───────▶ } + │ │ │ │ + │ │ │ ╰───────────────────────── definiens: 11 + ┆ ┆ ┆ + 23 │ │ ├─────────▶ } + │ │ │ + │ │ ╰─────────────────── definiens: 2 + 24 │ ├───────────▶ } + │ │ + │ ╰───────────────── definiens: 1 ────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/yul/functions/input.sol b/crates/solidity/testing/snapshots/bindings_output/yul/functions/input.sol index dab773ceed..92e7665759 100644 --- a/crates/solidity/testing/snapshots/bindings_output/yul/functions/input.sol +++ b/crates/solidity/testing/snapshots/bindings_output/yul/functions/input.sol @@ -1,13 +1,23 @@ contract AssemblyFunctions { function test(uint256 x) public returns (uint256 r) { assembly { - let y := add(x, 5) - x, y := swap(x, y) - r := add(x, y) + function outer1(a) -> b { + b := add(a, 1) + } + + { + r := add(outer1(x), inner(x)) + function inner(f) -> g { + g:= mul(f, outer2(f)) + } + } + + function outer2(c) -> d { + d := mul(c, outer2_inner(c)) - function swap(a, b) -> c, d { - c := b - d := a + function outer2_inner(e) -> f { + f := e + } } } } diff --git a/crates/solidity/testing/snapshots/bindings_output/yul/labels/generated/0.4.11-success.txt b/crates/solidity/testing/snapshots/bindings_output/yul/labels/generated/0.4.11-success.txt new file mode 100644 index 0000000000..4893be3fc7 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/yul/labels/generated/0.4.11-success.txt @@ -0,0 +1,76 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function test() public { + │ ──┬─ + │ ╰─── name: 2 + │ + 4 │ let n := calldataload(4) + │ ┬ + │ ╰── name: 5 + 5 │ let a := 1 + │ ┬ + │ ╰── name: 6 + 6 │ let b := a + │ ┬ ┬ + │ ╰─────── name: 7 + │ │ + │ ╰── ref: 6 + 7 │ loop: + │ ──┬─ + │ ╰─── name: 3 + 8 │ jumpi(loopend, eq(n, 0)) + │ ───┬─── ┬ + │ ╰─────────── ref: 4 + │ │ + │ ╰── ref: 5 + 9 │ n := sub(n, 1) + │ ┬ ┬ + │ ╰─────────── ref: 5 + │ │ + │ ╰── ref: 5 + 10 │ jump(loop) + │ ──┬─ + │ ╰─── ref: 3 + 11 │ loopend: + │ ───┬─── + │ ╰───── name: 4 + 12 │ mstore(0, a) + │ ┬ + │ ╰── ref: 6 +────╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Test { + 2 │ │ ╭─▶ function test() public { + ┆ ┆ ┆ + 4 │ │ │ let n := calldataload(4) + │ │ │ ──────────────────┬────────────────── + │ │ │ ╰──────────────────── definiens: 5 + 5 │ │ │ let a := 1 + │ │ │ ───────────┬─────────── + │ │ │ ╰───────────── definiens: 6 + 6 │ │ │ let b := a + │ │ │ ───────────┬─────────── + │ │ │ ╰───────────── definiens: 7 + 7 │ │ │ loop: + │ │ │ ───────┬────── + │ │ │ ╰──────── definiens: 3 + ┆ ┆ ┆ + 11 │ │ │ loopend: + │ │ │ ────────┬──────── + │ │ │ ╰────────── definiens: 4 + ┆ ┆ ┆ + 15 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 16 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/yul/labels/generated/0.5.0-failure.txt b/crates/solidity/testing/snapshots/bindings_output/yul/labels/generated/0.5.0-failure.txt new file mode 100644 index 0000000000..80dc3bbc05 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/yul/labels/generated/0.5.0-failure.txt @@ -0,0 +1,60 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected CloseBrace or DoubleQuotedHexStringLiteral or DoubleQuotedStringLiteral or OpenBrace or SingleQuotedHexStringLiteral or SingleQuotedStringLiteral or YulAddKeyword or YulAddModKeyword or YulAddressKeyword or YulAndKeyword or YulBalanceKeyword or YulBlockHashKeyword or YulBreakKeyword or YulByteKeyword or YulCallCodeKeyword or YulCallDataCopyKeyword or YulCallDataLoadKeyword or YulCallDataSizeKeyword or YulCallKeyword or YulCallValueKeyword or YulCallerKeyword or YulChainIdKeyword or YulCoinBaseKeyword or YulContinueKeyword or YulCreate2Keyword or YulCreateKeyword or YulDecimalLiteral or YulDelegateCallKeyword or YulDifficultyKeyword or YulDivKeyword or YulEqKeyword or YulExpKeyword or YulExtCodeCopyKeyword or YulExtCodeHashKeyword or YulExtCodeSizeKeyword or YulFalseKeyword or YulForKeyword or YulFunctionKeyword or YulGasKeyword or YulGasLimitKeyword or YulGasPriceKeyword or YulGtKeyword or YulHexLiteral or YulIdentifier or YulIfKeyword or YulInvalidKeyword or YulIsZeroKeyword or YulKeccak256Keyword or YulLetKeyword or YulLog0Keyword or YulLog1Keyword or YulLog2Keyword or YulLog3Keyword or YulLog4Keyword or YulLtKeyword or YulMLoadKeyword or YulMSizeKeyword or YulMStore8Keyword or YulMStoreKeyword or YulModKeyword or YulMulKeyword or YulMulModKeyword or YulNotKeyword or YulNumberKeyword or YulOrKeyword or YulOriginKeyword or YulPopKeyword or YulReturnDataCopyKeyword or YulReturnDataSizeKeyword or YulReturnKeyword or YulRevertKeyword or YulSDivKeyword or YulSLoadKeyword or YulSModKeyword or YulSStoreKeyword or YulSarKeyword or YulSelfBalanceKeyword or YulSelfDestructKeyword or YulSgtKeyword or YulShlKeyword or YulShrKeyword or YulSignExtendKeyword or YulSltKeyword or YulStaticCallKeyword or YulStopKeyword or YulSubKeyword or YulSwitchKeyword or YulTimestampKeyword or YulTrueKeyword or YulXorKeyword. + ╭─[input.sol:7:13] + │ + 7 │ ╭─▶ loop: + ┆ ┆ + 14 │ ├─▶ } + │ │ + │ ╰─────────────── Error occurred here. +────╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function test() public { + │ ──┬─ + │ ╰─── name: 2 + │ + 4 │ let n := calldataload(4) + │ ┬ + │ ╰── name: 3 + 5 │ let a := 1 + │ ┬ + │ ╰── name: 4 + 6 │ let b := a + │ ┬ ┬ + │ ╰─────── name: 5 + │ │ + │ ╰── ref: 4 + 7 │ loop: + │ ──┬─ + │ ╰─── unresolved +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Test { + 2 │ │ ╭─▶ function test() public { + ┆ ┆ ┆ + 4 │ │ │ let n := calldataload(4) + │ │ │ ──────────────────┬────────────────── + │ │ │ ╰──────────────────── definiens: 3 + 5 │ │ │ let a := 1 + │ │ │ ───────────┬─────────── + │ │ │ ╰───────────── definiens: 4 + 6 │ │ │ let b := a + │ │ │ ───────────┬─────────── + │ │ │ ╰───────────── definiens: 5 + ┆ ┆ ┆ + 15 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 16 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/yul/labels/generated/0.6.0-failure.txt b/crates/solidity/testing/snapshots/bindings_output/yul/labels/generated/0.6.0-failure.txt new file mode 100644 index 0000000000..447bef3ca9 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/yul/labels/generated/0.6.0-failure.txt @@ -0,0 +1,60 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected CloseBrace or DoubleQuotedHexStringLiteral or DoubleQuotedStringLiteral or OpenBrace or SingleQuotedHexStringLiteral or SingleQuotedStringLiteral or YulAddKeyword or YulAddModKeyword or YulAddressKeyword or YulAndKeyword or YulBalanceKeyword or YulBlockHashKeyword or YulBreakKeyword or YulByteKeyword or YulCallCodeKeyword or YulCallDataCopyKeyword or YulCallDataLoadKeyword or YulCallDataSizeKeyword or YulCallKeyword or YulCallValueKeyword or YulCallerKeyword or YulChainIdKeyword or YulCoinBaseKeyword or YulContinueKeyword or YulCreate2Keyword or YulCreateKeyword or YulDecimalLiteral or YulDelegateCallKeyword or YulDifficultyKeyword or YulDivKeyword or YulEqKeyword or YulExpKeyword or YulExtCodeCopyKeyword or YulExtCodeHashKeyword or YulExtCodeSizeKeyword or YulFalseKeyword or YulForKeyword or YulFunctionKeyword or YulGasKeyword or YulGasLimitKeyword or YulGasPriceKeyword or YulGtKeyword or YulHexLiteral or YulIdentifier or YulIfKeyword or YulInvalidKeyword or YulIsZeroKeyword or YulKeccak256Keyword or YulLeaveKeyword or YulLetKeyword or YulLog0Keyword or YulLog1Keyword or YulLog2Keyword or YulLog3Keyword or YulLog4Keyword or YulLtKeyword or YulMLoadKeyword or YulMSizeKeyword or YulMStore8Keyword or YulMStoreKeyword or YulModKeyword or YulMulKeyword or YulMulModKeyword or YulNotKeyword or YulNumberKeyword or YulOrKeyword or YulOriginKeyword or YulPopKeyword or YulReturnDataCopyKeyword or YulReturnDataSizeKeyword or YulReturnKeyword or YulRevertKeyword or YulSDivKeyword or YulSLoadKeyword or YulSModKeyword or YulSStoreKeyword or YulSarKeyword or YulSelfBalanceKeyword or YulSelfDestructKeyword or YulSgtKeyword or YulShlKeyword or YulShrKeyword or YulSignExtendKeyword or YulSltKeyword or YulStaticCallKeyword or YulStopKeyword or YulSubKeyword or YulSwitchKeyword or YulTimestampKeyword or YulTrueKeyword or YulXorKeyword. + ╭─[input.sol:7:13] + │ + 7 │ ╭─▶ loop: + ┆ ┆ + 14 │ ├─▶ } + │ │ + │ ╰─────────────── Error occurred here. +────╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function test() public { + │ ──┬─ + │ ╰─── name: 2 + │ + 4 │ let n := calldataload(4) + │ ┬ + │ ╰── name: 3 + 5 │ let a := 1 + │ ┬ + │ ╰── name: 4 + 6 │ let b := a + │ ┬ ┬ + │ ╰─────── name: 5 + │ │ + │ ╰── ref: 4 + 7 │ loop: + │ ──┬─ + │ ╰─── unresolved +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Test { + 2 │ │ ╭─▶ function test() public { + ┆ ┆ ┆ + 4 │ │ │ let n := calldataload(4) + │ │ │ ──────────────────┬────────────────── + │ │ │ ╰──────────────────── definiens: 3 + 5 │ │ │ let a := 1 + │ │ │ ───────────┬─────────── + │ │ │ ╰───────────── definiens: 4 + 6 │ │ │ let b := a + │ │ │ ───────────┬─────────── + │ │ │ ╰───────────── definiens: 5 + ┆ ┆ ┆ + 15 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 16 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/yul/labels/generated/0.8.18-failure.txt b/crates/solidity/testing/snapshots/bindings_output/yul/labels/generated/0.8.18-failure.txt new file mode 100644 index 0000000000..e8fb2b8b55 --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/yul/labels/generated/0.8.18-failure.txt @@ -0,0 +1,60 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected CloseBrace or DoubleQuotedHexStringLiteral or DoubleQuotedStringLiteral or OpenBrace or SingleQuotedHexStringLiteral or SingleQuotedStringLiteral or YulAddKeyword or YulAddModKeyword or YulAddressKeyword or YulAndKeyword or YulBalanceKeyword or YulBaseFeeKeyword or YulBlockHashKeyword or YulBreakKeyword or YulByteKeyword or YulCallCodeKeyword or YulCallDataCopyKeyword or YulCallDataLoadKeyword or YulCallDataSizeKeyword or YulCallKeyword or YulCallValueKeyword or YulCallerKeyword or YulChainIdKeyword or YulCoinBaseKeyword or YulContinueKeyword or YulCreate2Keyword or YulCreateKeyword or YulDecimalLiteral or YulDelegateCallKeyword or YulDivKeyword or YulEqKeyword or YulExpKeyword or YulExtCodeCopyKeyword or YulExtCodeHashKeyword or YulExtCodeSizeKeyword or YulFalseKeyword or YulForKeyword or YulFunctionKeyword or YulGasKeyword or YulGasLimitKeyword or YulGasPriceKeyword or YulGtKeyword or YulHexLiteral or YulIdentifier or YulIfKeyword or YulInvalidKeyword or YulIsZeroKeyword or YulKeccak256Keyword or YulLeaveKeyword or YulLetKeyword or YulLog0Keyword or YulLog1Keyword or YulLog2Keyword or YulLog3Keyword or YulLog4Keyword or YulLtKeyword or YulMLoadKeyword or YulMSizeKeyword or YulMStore8Keyword or YulMStoreKeyword or YulModKeyword or YulMulKeyword or YulMulModKeyword or YulNotKeyword or YulNumberKeyword or YulOrKeyword or YulOriginKeyword or YulPopKeyword or YulPrevRandaoKeyword or YulReturnDataCopyKeyword or YulReturnDataSizeKeyword or YulReturnKeyword or YulRevertKeyword or YulSDivKeyword or YulSLoadKeyword or YulSModKeyword or YulSStoreKeyword or YulSarKeyword or YulSelfBalanceKeyword or YulSelfDestructKeyword or YulSgtKeyword or YulShlKeyword or YulShrKeyword or YulSignExtendKeyword or YulSltKeyword or YulStaticCallKeyword or YulStopKeyword or YulSubKeyword or YulSwitchKeyword or YulTimestampKeyword or YulTrueKeyword or YulXorKeyword. + ╭─[input.sol:7:13] + │ + 7 │ ╭─▶ loop: + ┆ ┆ + 14 │ ├─▶ } + │ │ + │ ╰─────────────── Error occurred here. +────╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function test() public { + │ ──┬─ + │ ╰─── name: 2 + │ + 4 │ let n := calldataload(4) + │ ┬ + │ ╰── name: 3 + 5 │ let a := 1 + │ ┬ + │ ╰── name: 4 + 6 │ let b := a + │ ┬ ┬ + │ ╰─────── name: 5 + │ │ + │ ╰── ref: 4 + 7 │ loop: + │ ──┬─ + │ ╰─── unresolved +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Test { + 2 │ │ ╭─▶ function test() public { + ┆ ┆ ┆ + 4 │ │ │ let n := calldataload(4) + │ │ │ ──────────────────┬────────────────── + │ │ │ ╰──────────────────── definiens: 3 + 5 │ │ │ let a := 1 + │ │ │ ───────────┬─────────── + │ │ │ ╰───────────── definiens: 4 + 6 │ │ │ let b := a + │ │ │ ───────────┬─────────── + │ │ │ ╰───────────── definiens: 5 + ┆ ┆ ┆ + 15 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 16 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/yul/labels/generated/0.8.24-failure.txt b/crates/solidity/testing/snapshots/bindings_output/yul/labels/generated/0.8.24-failure.txt new file mode 100644 index 0000000000..f21db7933a --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/yul/labels/generated/0.8.24-failure.txt @@ -0,0 +1,60 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected CloseBrace or DoubleQuotedHexStringLiteral or DoubleQuotedStringLiteral or OpenBrace or SingleQuotedHexStringLiteral or SingleQuotedStringLiteral or YulAddKeyword or YulAddModKeyword or YulAddressKeyword or YulAndKeyword or YulBalanceKeyword or YulBaseFeeKeyword or YulBlobBaseFeeKeyword or YulBlobHashKeyword or YulBlockHashKeyword or YulBreakKeyword or YulByteKeyword or YulCallCodeKeyword or YulCallDataCopyKeyword or YulCallDataLoadKeyword or YulCallDataSizeKeyword or YulCallKeyword or YulCallValueKeyword or YulCallerKeyword or YulChainIdKeyword or YulCoinBaseKeyword or YulContinueKeyword or YulCreate2Keyword or YulCreateKeyword or YulDecimalLiteral or YulDelegateCallKeyword or YulDivKeyword or YulEqKeyword or YulExpKeyword or YulExtCodeCopyKeyword or YulExtCodeHashKeyword or YulExtCodeSizeKeyword or YulFalseKeyword or YulForKeyword or YulFunctionKeyword or YulGasKeyword or YulGasLimitKeyword or YulGasPriceKeyword or YulGtKeyword or YulHexLiteral or YulIdentifier or YulIfKeyword or YulInvalidKeyword or YulIsZeroKeyword or YulKeccak256Keyword or YulLeaveKeyword or YulLetKeyword or YulLog0Keyword or YulLog1Keyword or YulLog2Keyword or YulLog3Keyword or YulLog4Keyword or YulLtKeyword or YulMCopyKeyword or YulMLoadKeyword or YulMSizeKeyword or YulMStore8Keyword or YulMStoreKeyword or YulModKeyword or YulMulKeyword or YulMulModKeyword or YulNotKeyword or YulNumberKeyword or YulOrKeyword or YulOriginKeyword or YulPopKeyword or YulPrevRandaoKeyword or YulReturnDataCopyKeyword or YulReturnDataSizeKeyword or YulReturnKeyword or YulRevertKeyword or YulSDivKeyword or YulSLoadKeyword or YulSModKeyword or YulSStoreKeyword or YulSarKeyword or YulSelfBalanceKeyword or YulSelfDestructKeyword or YulSgtKeyword or YulShlKeyword or YulShrKeyword or YulSignExtendKeyword or YulSltKeyword or YulStaticCallKeyword or YulStopKeyword or YulSubKeyword or YulSwitchKeyword or YulTLoadKeyword or YulTStoreKeyword or YulTimestampKeyword or YulTrueKeyword or YulXorKeyword. + ╭─[input.sol:7:13] + │ + 7 │ ╭─▶ loop: + ┆ ┆ + 14 │ ├─▶ } + │ │ + │ ╰─────────────── Error occurred here. +────╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function test() public { + │ ──┬─ + │ ╰─── name: 2 + │ + 4 │ let n := calldataload(4) + │ ┬ + │ ╰── name: 3 + 5 │ let a := 1 + │ ┬ + │ ╰── name: 4 + 6 │ let b := a + │ ┬ ┬ + │ ╰─────── name: 5 + │ │ + │ ╰── ref: 4 + 7 │ loop: + │ ──┬─ + │ ╰─── unresolved +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Test { + 2 │ │ ╭─▶ function test() public { + ┆ ┆ ┆ + 4 │ │ │ let n := calldataload(4) + │ │ │ ──────────────────┬────────────────── + │ │ │ ╰──────────────────── definiens: 3 + 5 │ │ │ let a := 1 + │ │ │ ───────────┬─────────── + │ │ │ ╰───────────── definiens: 4 + 6 │ │ │ let b := a + │ │ │ ───────────┬─────────── + │ │ │ ╰───────────── definiens: 5 + ┆ ┆ ┆ + 15 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 16 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_output/yul/labels/generated/0.8.7-failure.txt b/crates/solidity/testing/snapshots/bindings_output/yul/labels/generated/0.8.7-failure.txt new file mode 100644 index 0000000000..2807e18bee --- /dev/null +++ b/crates/solidity/testing/snapshots/bindings_output/yul/labels/generated/0.8.7-failure.txt @@ -0,0 +1,60 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Parse errors: +Error: Expected CloseBrace or DoubleQuotedHexStringLiteral or DoubleQuotedStringLiteral or OpenBrace or SingleQuotedHexStringLiteral or SingleQuotedStringLiteral or YulAddKeyword or YulAddModKeyword or YulAddressKeyword or YulAndKeyword or YulBalanceKeyword or YulBaseFeeKeyword or YulBlockHashKeyword or YulBreakKeyword or YulByteKeyword or YulCallCodeKeyword or YulCallDataCopyKeyword or YulCallDataLoadKeyword or YulCallDataSizeKeyword or YulCallKeyword or YulCallValueKeyword or YulCallerKeyword or YulChainIdKeyword or YulCoinBaseKeyword or YulContinueKeyword or YulCreate2Keyword or YulCreateKeyword or YulDecimalLiteral or YulDelegateCallKeyword or YulDifficultyKeyword or YulDivKeyword or YulEqKeyword or YulExpKeyword or YulExtCodeCopyKeyword or YulExtCodeHashKeyword or YulExtCodeSizeKeyword or YulFalseKeyword or YulForKeyword or YulFunctionKeyword or YulGasKeyword or YulGasLimitKeyword or YulGasPriceKeyword or YulGtKeyword or YulHexLiteral or YulIdentifier or YulIfKeyword or YulInvalidKeyword or YulIsZeroKeyword or YulKeccak256Keyword or YulLeaveKeyword or YulLetKeyword or YulLog0Keyword or YulLog1Keyword or YulLog2Keyword or YulLog3Keyword or YulLog4Keyword or YulLtKeyword or YulMLoadKeyword or YulMSizeKeyword or YulMStore8Keyword or YulMStoreKeyword or YulModKeyword or YulMulKeyword or YulMulModKeyword or YulNotKeyword or YulNumberKeyword or YulOrKeyword or YulOriginKeyword or YulPopKeyword or YulReturnDataCopyKeyword or YulReturnDataSizeKeyword or YulReturnKeyword or YulRevertKeyword or YulSDivKeyword or YulSLoadKeyword or YulSModKeyword or YulSStoreKeyword or YulSarKeyword or YulSelfBalanceKeyword or YulSelfDestructKeyword or YulSgtKeyword or YulShlKeyword or YulShrKeyword or YulSignExtendKeyword or YulSltKeyword or YulStaticCallKeyword or YulStopKeyword or YulSubKeyword or YulSwitchKeyword or YulTimestampKeyword or YulTrueKeyword or YulXorKeyword. + ╭─[input.sol:7:13] + │ + 7 │ ╭─▶ loop: + ┆ ┆ + 14 │ ├─▶ } + │ │ + │ ╰─────────────── Error occurred here. +────╯ +References and definitions: + ╭─[input.sol:1:1] + │ + 1 │ contract Test { + │ ──┬─ + │ ╰─── name: 1 + 2 │ function test() public { + │ ──┬─ + │ ╰─── name: 2 + │ + 4 │ let n := calldataload(4) + │ ┬ + │ ╰── name: 3 + 5 │ let a := 1 + │ ┬ + │ ╰── name: 4 + 6 │ let b := a + │ ┬ ┬ + │ ╰─────── name: 5 + │ │ + │ ╰── ref: 4 + 7 │ loop: + │ ──┬─ + │ ╰─── unresolved +───╯ +Definiens: + ╭─[input.sol:1:1] + │ + 1 │ ╭─│ ▶ contract Test { + 2 │ │ ╭─▶ function test() public { + ┆ ┆ ┆ + 4 │ │ │ let n := calldataload(4) + │ │ │ ──────────────────┬────────────────── + │ │ │ ╰──────────────────── definiens: 3 + 5 │ │ │ let a := 1 + │ │ │ ───────────┬─────────── + │ │ │ ╰───────────── definiens: 4 + 6 │ │ │ let b := a + │ │ │ ───────────┬─────────── + │ │ │ ╰───────────── definiens: 5 + ┆ ┆ ┆ + 15 │ │ ├─▶ } + │ │ │ + │ │ ╰─────────── definiens: 2 + 16 │ ├───▶ } + │ │ + │ ╰───────── definiens: 1 +────╯ diff --git a/crates/solidity/testing/snapshots/bindings_assertions/yul/labels.sol b/crates/solidity/testing/snapshots/bindings_output/yul/labels/input.sol similarity index 58% rename from crates/solidity/testing/snapshots/bindings_assertions/yul/labels.sol rename to crates/solidity/testing/snapshots/bindings_output/yul/labels/input.sol index 624f29f7fc..fc2ff87e10 100644 --- a/crates/solidity/testing/snapshots/bindings_assertions/yul/labels.sol +++ b/crates/solidity/testing/snapshots/bindings_output/yul/labels/input.sol @@ -1,22 +1,14 @@ contract Test { function test() public { - // ^def:dummy assembly { let n := calldataload(4) let a := 1 let b := a loop: - //= 0.5.0) - a add swap1 n := sub(n, 1) jump(loop) - // ^ref:1 (< 0.5.0) - // ^ref:! (>= 0.5.0) loopend: - //