From ebc1b6435cc79d7950ae09eb9e5666923121f15f Mon Sep 17 00:00:00 2001 From: Rustie Lin Date: Tue, 8 Oct 2024 14:31:26 -0700 Subject: [PATCH 1/8] [forge] indexer SuccessCriteria and new test (#14851) * [forge] indexer SuccessCriteria and new test * [forge] optional metrics sample includes indexer --- testsuite/forge-cli/src/main.rs | 104 ++++++++++++++++++ testsuite/forge/src/backend/k8s/mod.rs | 1 + testsuite/forge/src/backend/k8s/swarm.rs | 7 ++ testsuite/forge/src/backend/local/swarm.rs | 4 + .../forge/src/interface/prometheus_metrics.rs | 74 ++++++++++++- testsuite/forge/src/interface/swarm.rs | 4 + testsuite/forge/src/success_criteria.rs | 4 +- testsuite/testcases/src/lib.rs | 5 +- .../testcases/src/load_vs_perf_benchmark.rs | 26 +++-- 9 files changed, 214 insertions(+), 15 deletions(-) diff --git a/testsuite/forge-cli/src/main.rs b/testsuite/forge-cli/src/main.rs index 3deb5ebfa71c4..59c88f4101416 100644 --- a/testsuite/forge-cli/src/main.rs +++ b/testsuite/forge-cli/src/main.rs @@ -603,6 +603,8 @@ fn get_test_suite( return Ok(test_suite); } else if let Some(test_suite) = get_dag_test(test_name, duration, test_cmd) { return Ok(test_suite); + } else if let Some(test_suite) = get_indexer_test(test_name) { + return Ok(test_suite); } // Otherwise, check the test name against the ungrouped test suites @@ -691,6 +693,15 @@ fn get_land_blocking_test( Some(test) } +/// Attempts to match the test name to an indexer test +fn get_indexer_test(test_name: &str) -> Option { + let test = match test_name { + "indexer_test" => indexer_test(), + _ => return None, // The test name does not match an indexer test + }; + Some(test) +} + /// Attempts to match the test name to a network benchmark test fn get_netbench_test(test_name: &str) -> Option { let test = match test_name { @@ -2367,6 +2378,99 @@ fn multiregion_benchmark_test() -> ForgeConfig { ) } +/// Workload sweep with multiple stressful workloads for indexer +fn indexer_test() -> ForgeConfig { + // Define all the workloads and their corresponding success criteria upfront + // The TransactionTypeArg is the workload per phase + // The structure of the success criteria is generally (min_tps, latencies...). See below for the exact definition. + let workloads_and_criteria = vec![ + ( + TransactionWorkload::new(TransactionTypeArg::CoinTransfer, 20000), + (7000, 0.5, 0.5, 0.5), + ), + ( + TransactionWorkload::new(TransactionTypeArg::NoOp, 20000).with_num_modules(100), + (8500, 0.5, 0.5, 0.5), + ), + ( + TransactionWorkload::new(TransactionTypeArg::ModifyGlobalResource, 6000) + .with_transactions_per_account(1), + (2000, 0.5, 0.5, 0.5), + ), + ( + TransactionWorkload::new(TransactionTypeArg::TokenV2AmbassadorMint, 20000) + .with_unique_senders(), + (3200, 0.5, 0.5, 0.5), + ), + ( + TransactionWorkload::new(TransactionTypeArg::PublishPackage, 200) + .with_transactions_per_account(1), + (28, 0.5, 0.5, 0.5), + ), + ( + TransactionWorkload::new(TransactionTypeArg::VectorPicture30k, 100), + (100, 1.0, 1.0, 1.0), + ), + ( + TransactionWorkload::new(TransactionTypeArg::SmartTablePicture30KWith200Change, 100), + (100, 1.0, 1.0, 1.0), + ), + ( + TransactionWorkload::new( + TransactionTypeArg::TokenV1NFTMintAndTransferSequential, + 1000, + ), + (500, 0.5, 0.5, 0.5), + ), + ( + TransactionWorkload::new(TransactionTypeArg::TokenV1FTMintAndTransfer, 1000), + (500, 0.5, 0.5, 0.5), + ), + ]; + let num_sweep = workloads_and_criteria.len(); + + let workloads = Workloads::TRANSACTIONS( + workloads_and_criteria + .iter() + .map(|(w, _)| w.clone()) + .collect(), + ); + let criteria = workloads_and_criteria + .iter() + .map(|(_, c)| { + let ( + min_tps, + indexer_fullnode_processed_batch, + indexer_cache_worker_processed_batch, + indexer_data_service_all_chunks_sent, + ) = c.to_owned(); + SuccessCriteria::new(min_tps).add_latency_breakdown_threshold( + LatencyBreakdownThreshold::new_strict(vec![ + ( + LatencyBreakdownSlice::IndexerFullnodeProcessedBatch, + indexer_fullnode_processed_batch, + ), + ( + LatencyBreakdownSlice::IndexerCacheWorkerProcessedBatch, + indexer_cache_worker_processed_batch, + ), + ( + LatencyBreakdownSlice::IndexerDataServiceAllChunksSent, + indexer_data_service_all_chunks_sent, + ), + ]), + ) + }) + .collect::>(); + + realistic_env_sweep_wrap(4, 4, LoadVsPerfBenchmark { + test: Box::new(PerformanceBenchmark), + workloads, + criteria, + background_traffic: background_traffic_for_sweep(num_sweep), + }) +} + /// This test runs a constant-TPS benchmark where the network includes /// PFNs, and the transactions are submitted to the PFNs. This is useful /// for measuring latencies when the system is not saturated. diff --git a/testsuite/forge/src/backend/k8s/mod.rs b/testsuite/forge/src/backend/k8s/mod.rs index 260887b9145b3..782d9d7aa8749 100644 --- a/testsuite/forge/src/backend/k8s/mod.rs +++ b/testsuite/forge/src/backend/k8s/mod.rs @@ -245,6 +245,7 @@ impl Factory for K8sFactory { self.keep, new_era, self.use_port_forward, + self.enable_indexer, ) .await .unwrap(); diff --git a/testsuite/forge/src/backend/k8s/swarm.rs b/testsuite/forge/src/backend/k8s/swarm.rs index 9c249dc1c6aea..9211bed8a1381 100644 --- a/testsuite/forge/src/backend/k8s/swarm.rs +++ b/testsuite/forge/src/backend/k8s/swarm.rs @@ -62,6 +62,7 @@ pub struct K8sSwarm { era: Option, use_port_forward: bool, chaos_experiment_ops: Box, + has_indexer: bool, } impl K8sSwarm { @@ -75,6 +76,7 @@ impl K8sSwarm { keep: bool, era: Option, use_port_forward: bool, + has_indexer: bool, ) -> Result { let kube_client = create_k8s_client().await?; @@ -123,6 +125,7 @@ impl K8sSwarm { kube_client: kube_client.clone(), kube_namespace: kube_namespace.to_string(), }), + has_indexer, }; // test hitting the configured prometheus endpoint @@ -446,6 +449,10 @@ impl Swarm for K8sSwarm { fn get_default_pfn_node_config(&self) -> NodeConfig { get_default_pfn_node_config() } + + fn has_indexer(&self) -> bool { + self.has_indexer + } } /// Amount of time to wait for genesis to complete diff --git a/testsuite/forge/src/backend/local/swarm.rs b/testsuite/forge/src/backend/local/swarm.rs index cb1f8ba2989f7..eba54ae3c5bf3 100644 --- a/testsuite/forge/src/backend/local/swarm.rs +++ b/testsuite/forge/src/backend/local/swarm.rs @@ -650,6 +650,10 @@ impl Swarm for LocalSwarm { fn get_default_pfn_node_config(&self) -> NodeConfig { todo!() } + + fn has_indexer(&self) -> bool { + false + } } #[derive(Debug)] diff --git a/testsuite/forge/src/interface/prometheus_metrics.rs b/testsuite/forge/src/interface/prometheus_metrics.rs index cce9096aaac75..20283bbdb4e2c 100644 --- a/testsuite/forge/src/interface/prometheus_metrics.rs +++ b/testsuite/forge/src/interface/prometheus_metrics.rs @@ -43,6 +43,12 @@ impl fmt::Debug for MetricSamples { } } +impl Default for MetricSamples { + fn default() -> Self { + Self::new(vec![]) + } +} + #[derive(Clone, Debug)] pub struct SystemMetrics { pub cpu_core_metrics: MetricSamples, @@ -105,6 +111,11 @@ pub enum LatencyBreakdownSlice { ConsensusProposalToOrdered, ConsensusOrderedToCommit, ConsensusProposalToCommit, + // each of the indexer grpc steps in order + IndexerFullnodeProcessedBatch, + IndexerCacheWorkerProcessedBatch, + IndexerDataServiceAllChunksSent, + // TODO: add processor insertion into DB latency } #[derive(Clone, Debug)] @@ -119,10 +130,16 @@ impl LatencyBreakdown { self.0.keys().cloned().collect() } - pub fn get_samples(&self, slice: &LatencyBreakdownSlice) -> &MetricSamples { - self.0 - .get(slice) - .unwrap_or_else(|| panic!("Missing latency breakdown for {:?}", slice)) + pub fn get_samples(&self, slice: &LatencyBreakdownSlice) -> Option<&MetricSamples> { + self.0.get(slice) + } + + pub fn join(&self, other: &LatencyBreakdown) -> LatencyBreakdown { + let mut ret_latency = self.0.clone(); + for (slice, samples) in other.0.iter() { + ret_latency.insert(slice.clone(), samples.clone()); + } + LatencyBreakdown::new(ret_latency) } } @@ -210,5 +227,54 @@ pub async fn fetch_latency_breakdown( MetricSamples::new(consensus_proposal_to_commit_samples), ); + if swarm.has_indexer() { + // These counters are defined in ecosystem/indexer-grpc/indexer-grpc-utils/src/counters.rs + let indexer_fullnode_processed_batch_query = + r#"max(indexer_grpc_duration_in_secs{step="4", service_type="indexer_fullnode"})"#; + let indexer_cache_worker_processed_batch_query = + r#"max(indexer_grpc_duration_in_secs{step="4", service_type="cache_worker"})"#; + let indexer_data_service_all_chunks_sent_query = + r#"max(indexer_grpc_duration_in_secs{step="4", service_type="data_service"})"#; + + let indexer_fullnode_processed_batch_samples = swarm + .query_range_metrics( + indexer_fullnode_processed_batch_query, + start_time as i64, + end_time as i64, + None, + ) + .await?; + + let indexer_cache_worker_processed_batch_samples = swarm + .query_range_metrics( + indexer_cache_worker_processed_batch_query, + start_time as i64, + end_time as i64, + None, + ) + .await?; + + let indexer_data_service_all_chunks_sent_samples = swarm + .query_range_metrics( + indexer_data_service_all_chunks_sent_query, + start_time as i64, + end_time as i64, + None, + ) + .await?; + + samples.insert( + LatencyBreakdownSlice::IndexerFullnodeProcessedBatch, + MetricSamples::new(indexer_fullnode_processed_batch_samples), + ); + samples.insert( + LatencyBreakdownSlice::IndexerCacheWorkerProcessedBatch, + MetricSamples::new(indexer_cache_worker_processed_batch_samples), + ); + samples.insert( + LatencyBreakdownSlice::IndexerDataServiceAllChunksSent, + MetricSamples::new(indexer_data_service_all_chunks_sent_samples), + ); + } Ok(LatencyBreakdown::new(samples)) } diff --git a/testsuite/forge/src/interface/swarm.rs b/testsuite/forge/src/interface/swarm.rs index b2c3f501ba5ec..4f378f37bc9d8 100644 --- a/testsuite/forge/src/interface/swarm.rs +++ b/testsuite/forge/src/interface/swarm.rs @@ -105,6 +105,10 @@ pub trait Swarm: Sync + Send { } fn get_default_pfn_node_config(&self) -> NodeConfig; + + /// Check if the swarm has an indexer. NOTE: in the future we should make this more rich, and include + /// indexer endpoints, similar to how we collect validator and fullnode endpoints. + fn has_indexer(&self) -> bool; } impl SwarmExt for T where T: Swarm {} diff --git a/testsuite/forge/src/success_criteria.rs b/testsuite/forge/src/success_criteria.rs index e1df551b4cfa9..e7383a87d12fe 100644 --- a/testsuite/forge/src/success_criteria.rs +++ b/testsuite/forge/src/success_criteria.rs @@ -150,7 +150,9 @@ impl LatencyBreakdownThreshold { traffic_name_addition: &String, ) -> anyhow::Result<()> { for (slice, threshold) in &self.thresholds { - let samples = metrics.get_samples(slice); + let samples = metrics + .get_samples(slice) + .expect("Could not get metric samples"); threshold.ensure_metrics_threshold( &format!("{:?}{}", slice, traffic_name_addition), samples.get(), diff --git a/testsuite/testcases/src/lib.rs b/testsuite/testcases/src/lib.rs index 1857815437254..92320a3136405 100644 --- a/testsuite/testcases/src/lib.rs +++ b/testsuite/testcases/src/lib.rs @@ -283,7 +283,10 @@ impl NetworkTest for dyn NetworkLoadTest { .keys() .into_iter() .map(|slice| { - let slice_samples = phase_stats.latency_breakdown.get_samples(&slice); + let slice_samples = phase_stats + .latency_breakdown + .get_samples(&slice) + .expect("Could not get samples"); format!( "{:?}: max: {:.3}, avg: {:.3}", slice, diff --git a/testsuite/testcases/src/load_vs_perf_benchmark.rs b/testsuite/testcases/src/load_vs_perf_benchmark.rs index e63ff8bc0ec56..634fda24f2ccb 100644 --- a/testsuite/testcases/src/load_vs_perf_benchmark.rs +++ b/testsuite/testcases/src/load_vs_perf_benchmark.rs @@ -6,7 +6,7 @@ use anyhow::Context; use aptos_forge::{ args::TransactionTypeArg, emitter::NumAccountsMode, - prometheus_metrics::{LatencyBreakdown, LatencyBreakdownSlice}, + prometheus_metrics::{LatencyBreakdown, LatencyBreakdownSlice, MetricSamples}, success_criteria::{SuccessCriteria, SuccessCriteriaChecker}, EmitJob, EmitJobMode, EmitJobRequest, NetworkContext, NetworkContextSynchronizer, NetworkTest, Result, Test, TxnStats, WorkflowProgress, @@ -471,7 +471,7 @@ fn to_table(type_name: String, results: &[Vec]) -> Vec { let mut table = Vec::new(); table.push(format!( - "{: ]) -> Vec { "pos->prop", "prop->order", "order->commit", - "actual dur" + "actual dur", + // optional indexer metrics + "idx_fn", + "idx_cache", + "idx_data", )); for run_results in results { for result in run_results { let rate = result.stats.rate(); table.push(format!( - "{: ]) -> Vec { rate.p50_latency as f64 / 1000.0, rate.p90_latency as f64 / 1000.0, rate.p99_latency as f64 / 1000.0, - result.latency_breakdown.get_samples(&LatencyBreakdownSlice::QsBatchToPos).max_sample(), - result.latency_breakdown.get_samples(&LatencyBreakdownSlice::QsPosToProposal).max_sample(), - result.latency_breakdown.get_samples(&LatencyBreakdownSlice::ConsensusProposalToOrdered).max_sample(), - result.latency_breakdown.get_samples(&LatencyBreakdownSlice::ConsensusOrderedToCommit).max_sample(), - result.actual_duration.as_secs() + result.latency_breakdown.get_samples(&LatencyBreakdownSlice::QsBatchToPos).unwrap_or(&MetricSamples::default()).max_sample(), + result.latency_breakdown.get_samples(&LatencyBreakdownSlice::QsPosToProposal).unwrap_or(&MetricSamples::default()).max_sample(), + result.latency_breakdown.get_samples(&LatencyBreakdownSlice::ConsensusProposalToOrdered).unwrap_or(&MetricSamples::default()).max_sample(), + result.latency_breakdown.get_samples(&LatencyBreakdownSlice::ConsensusOrderedToCommit).unwrap_or(&MetricSamples::default()).max_sample(), + result.actual_duration.as_secs(), + // optional indexer metrics + result.latency_breakdown.get_samples(&LatencyBreakdownSlice::IndexerFullnodeProcessedBatch).unwrap_or(&MetricSamples::default()).max_sample(), + result.latency_breakdown.get_samples(&LatencyBreakdownSlice::IndexerCacheWorkerProcessedBatch).unwrap_or(&MetricSamples::default()).max_sample(), + result.latency_breakdown.get_samples(&LatencyBreakdownSlice::IndexerDataServiceAllChunksSent).unwrap_or(&MetricSamples::default()).max_sample(), )); } } From 749e9bfae79963ba1f13cb8b0e203733a5e04ed1 Mon Sep 17 00:00:00 2001 From: Stelian Ionescu Date: Tue, 8 Oct 2024 13:04:40 -0400 Subject: [PATCH 2/8] Sync Terraform & Helm changes GitOrigin-RevId: 2dc9bb082ddfb35ca3019f2c135c3113702ecbc0 --- terraform/aptos-node/gcp/variables.tf | 2 +- terraform/helm/aptos-node/values.yaml | 16 ++++++++-------- terraform/helm/fullnode/values.yaml | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/terraform/aptos-node/gcp/variables.tf b/terraform/aptos-node/gcp/variables.tf index ca216d400385b..66e2ddba2ce7a 100644 --- a/terraform/aptos-node/gcp/variables.tf +++ b/terraform/aptos-node/gcp/variables.tf @@ -208,7 +208,7 @@ variable "utility_instance_enable_taint" { variable "validator_instance_enable_taint" { description = "Whether to taint instances in the validator nodegroup" type = bool - default = false + default = true } variable "gke_enable_node_autoprovisioning" { diff --git a/terraform/helm/aptos-node/values.yaml b/terraform/helm/aptos-node/values.yaml index 857b8ba504669..30b5b7cf7c698 100644 --- a/terraform/helm/aptos-node/values.yaml +++ b/terraform/helm/aptos-node/values.yaml @@ -68,11 +68,11 @@ validator: pullPolicy: IfNotPresent resources: limits: - cpu: 14 - memory: 56Gi + cpu: 30 + memory: 60Gi requests: - cpu: 14 - memory: 56Gi + cpu: 30 + memory: 60Gi storage: # -- Kubernetes storage class to use for validator persistent storage class: @@ -103,11 +103,11 @@ fullnode: replicas: 1 resources: limits: - cpu: 14 - memory: 56Gi + cpu: 30 + memory: 60Gi requests: - cpu: 14 - memory: 56Gi + cpu: 30 + memory: 60Gi storage: # -- Kubernetes storage class to use for fullnode persistent storage class: diff --git a/terraform/helm/fullnode/values.yaml b/terraform/helm/fullnode/values.yaml index f0f2c712398c9..001abbfecc79d 100644 --- a/terraform/helm/fullnode/values.yaml +++ b/terraform/helm/fullnode/values.yaml @@ -51,11 +51,11 @@ image: resources: limits: - cpu: 14 - memory: 56Gi + cpu: 30 + memory: 60Gi requests: - cpu: 14 - memory: 56Gi + cpu: 30 + memory: 60Gi nodeSelector: {} tolerations: [] From 5150f8317c26973cd2f22fe304cb97b46262b039 Mon Sep 17 00:00:00 2001 From: Bo Wu Date: Mon, 7 Oct 2024 11:47:14 -0700 Subject: [PATCH 3/8] fix_get_right_most_child --- Cargo.lock | 8 +-- storage/aptosdb/src/db/test_helper.rs | 3 +- .../src/pruner/state_merkle_pruner/test.rs | 2 +- storage/aptosdb/src/state_merkle_db.rs | 32 +-------- .../src/state_store/state_store_test.rs | 71 +++++++++++++++++-- 5 files changed, 74 insertions(+), 42 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f24b3244975d2..ff101bc3974dd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12219,9 +12219,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.66" +version = "0.10.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" +checksum = "8cde4d2d9200ad5909f8dac647e29482e07c3a35de8a13fce7c9c7747ad9f671" dependencies = [ "bitflags 2.6.0", "cfg-if", @@ -12251,9 +12251,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.103" +version = "0.9.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" +checksum = "c1665caf8ab2dc9aef43d1c0023bd904633a6a05cb30b0ad59bec2ae986e57a7" dependencies = [ "cc", "libc", diff --git a/storage/aptosdb/src/db/test_helper.rs b/storage/aptosdb/src/db/test_helper.rs index 570bdf8bd4433..68265f72c0e34 100644 --- a/storage/aptosdb/src/db/test_helper.rs +++ b/storage/aptosdb/src/db/test_helper.rs @@ -67,6 +67,7 @@ pub(crate) fn update_store( store: &StateStore, input: impl Iterator)>, first_version: Version, + enable_sharding: bool, ) -> HashValue { use aptos_storage_interface::{jmt_update_refs, jmt_updates}; let mut root_hash = *aptos_crypto::hash::SPARSE_MERKLE_PLACEHOLDER_HASH; @@ -94,7 +95,7 @@ pub(crate) fn update_store( None, &ledger_batch, &sharded_state_kv_batches, - /*put_state_value_indices=*/ false, + /*put_state_value_indices=*/ enable_sharding, /*skip_usage=*/ false, /*last_checkpoint_index=*/ None, ) diff --git a/storage/aptosdb/src/pruner/state_merkle_pruner/test.rs b/storage/aptosdb/src/pruner/state_merkle_pruner/test.rs index a660a6082975e..edf59efde854f 100644 --- a/storage/aptosdb/src/pruner/state_merkle_pruner/test.rs +++ b/storage/aptosdb/src/pruner/state_merkle_pruner/test.rs @@ -375,7 +375,7 @@ fn verify_state_value_pruner(inputs: Vec)>>) { user_pruning_window_offset: 0, }); for batch in inputs { - update_store(store, batch.clone().into_iter(), version); + update_store(store, batch.clone().into_iter(), version, false); for (k, v) in batch.iter() { if let Some((old_version, old_v_opt)) = current_state_values.insert(k.clone(), (version, v.clone())) diff --git a/storage/aptosdb/src/state_merkle_db.rs b/storage/aptosdb/src/state_merkle_db.rs index 4c42a61042712..b1f5e757d9fb5 100644 --- a/storage/aptosdb/src/state_merkle_db.rs +++ b/storage/aptosdb/src/state_merkle_db.rs @@ -19,8 +19,7 @@ use aptos_config::config::{RocksdbConfig, RocksdbConfigs, StorageDirPaths}; use aptos_crypto::{hash::CryptoHash, HashValue}; use aptos_experimental_runtimes::thread_manager::{optimal_min_len, THREAD_MANAGER}; use aptos_jellyfish_merkle::{ - node_type::{NodeKey, NodeType}, - JellyfishMerkleTree, TreeReader, TreeUpdateBatch, TreeWriter, + node_type::NodeKey, JellyfishMerkleTree, TreeReader, TreeUpdateBatch, TreeWriter, }; use aptos_logger::prelude::*; use aptos_rocksdb_options::gen_rocksdb_options; @@ -677,20 +676,6 @@ impl StateMerkleDb { ) -> Result> { let mut ret = None; - if self.enable_sharding { - let mut iter = self.metadata_db().iter::()?; - iter.seek(&(version, 0)).unwrap(); - // early exit if no node is found for the target version - match iter.next().transpose()? { - Some((node_key, node)) => { - if node.node_type() == NodeType::Null || node_key.version() != version { - return Ok(None); - } - }, - None => return Ok(None), - }; - } - // traverse all shards in a naive way let shards = 0..self.hack_num_real_shards(); let start_num_of_nibbles = if self.enable_sharding { 1 } else { 0 }; @@ -822,21 +807,6 @@ impl TreeReader for StateMerkleDb { } fn get_rightmost_leaf(&self, version: Version) -> Result> { - // Since everything has the same version during restore, we seek to the first node and get - // its version. - - let mut iter = self.metadata_db().iter::()?; - // get the root node corresponding to the version - iter.seek(&(version, 0))?; - match iter.next().transpose()? { - Some((node_key, node)) => { - if node.node_type() == NodeType::Null || node_key.version() != version { - return Ok(None); - } - }, - None => return Ok(None), - }; - let ret = None; let shards = 0..self.hack_num_real_shards(); diff --git a/storage/aptosdb/src/state_store/state_store_test.rs b/storage/aptosdb/src/state_store/state_store_test.rs index b76d396b1b630..736e788d443f4 100644 --- a/storage/aptosdb/src/state_store/state_store_test.rs +++ b/storage/aptosdb/src/state_store/state_store_test.rs @@ -465,6 +465,59 @@ proptest! { ); } + #[test] + fn test_get_rightmost_leaf_with_sharding( + (input, batch1_size) in hash_map(any::(), any::(), 2..1000) + .prop_flat_map(|input| { + let len = input.len(); + (Just(input), 1..len) + }) + ) { + let tmp_dir1 = TempPath::new(); + let db1 = AptosDB::new_for_test_with_sharding(&tmp_dir1, 1000); + let store1 = &db1.state_store; + init_sharded_store(store1, input.clone().into_iter()); + + let version = (input.len() - 1) as Version; + let expected_root_hash = store1.get_root_hash(version).unwrap(); + + let tmp_dir2 = TempPath::new(); + let db2 = AptosDB::new_for_test_with_sharding(&tmp_dir2, 1000); + + + let store2 = &db2.state_store; + let mut restore = + StateSnapshotRestore::new(&store2.state_merkle_db, store2, version, expected_root_hash, true, /* async_commit */ StateSnapshotRestoreMode::Default).unwrap(); + let max_hash = HashValue::new([0xff; HashValue::LENGTH]); + let dummy_state_key = StateKey::raw(&[]); + let (top_levels_batch, sharded_batches, _) = store2.state_merkle_db.merklize_value_set(vec![(max_hash, Some(&(HashValue::random(), dummy_state_key)))], 0, None, None).unwrap(); + store2.state_merkle_db.commit(version, top_levels_batch, sharded_batches).unwrap(); + assert!(store2.state_merkle_db.get_rightmost_leaf(version).unwrap().is_none()); + let mut ordered_input: Vec<_> = input + .into_iter() + .collect(); + ordered_input.sort_unstable_by_key(|(key, _value)| key.hash()); + + let batch1: Vec<_> = ordered_input + .into_iter() + .take(batch1_size) + .collect(); + let rightmost_of_batch1 = batch1.last().map(|(key, _value)| key.hash()).unwrap(); + let proof_of_batch1 = store1 + .get_value_range_proof(rightmost_of_batch1, version) + .unwrap(); + + restore.add_chunk(batch1, proof_of_batch1).unwrap(); + restore.wait_for_async_commit().unwrap(); + + let expected = store2.state_merkle_db.get_rightmost_leaf_naive(version).unwrap(); + // When re-initializing the store, the rightmost leaf should exist indicating the progress + let actual = store2.state_merkle_db.get_rightmost_leaf(version).unwrap(); + // ensure the rightmost leaf is not None + prop_assert!(actual.is_some()); + prop_assert_eq!(actual, expected); + } + #[test] fn test_get_rightmost_leaf( (input, batch1_size) in hash_map(any::(), any::(), 2..1000) @@ -484,15 +537,13 @@ proptest! { let tmp_dir2 = TempPath::new(); let db2 = AptosDB::new_for_test(&tmp_dir2); let store2 = &db2.state_store; - let max_hash = HashValue::new([0xff; HashValue::LENGTH]); let mut restore = StateSnapshotRestore::new(&store2.state_merkle_db, store2, version, expected_root_hash, true, /* async_commit */ StateSnapshotRestoreMode::Default).unwrap(); - + let max_hash = HashValue::new([0xff; HashValue::LENGTH]); let dummy_state_key = StateKey::raw(&[]); let (top_levels_batch, sharded_batches, _) = store2.state_merkle_db.merklize_value_set(vec![(max_hash, Some(&(HashValue::random(), dummy_state_key)))], 0, None, None).unwrap(); store2.state_merkle_db.commit(version, top_levels_batch, sharded_batches).unwrap(); assert!(store2.state_merkle_db.get_rightmost_leaf(version).unwrap().is_none()); - let mut ordered_input: Vec<_> = input .into_iter() .collect(); @@ -512,6 +563,7 @@ proptest! { let expected = store2.state_merkle_db.get_rightmost_leaf_naive(version).unwrap(); let actual = store2.state_merkle_db.get_rightmost_leaf(version).unwrap(); + prop_assert_eq!(actual, expected); } @@ -526,7 +578,7 @@ proptest! { let mut version = 0; for batch in input { let next_version = version + batch.len() as Version; - let root_hash = update_store(store, batch.into_iter(), version); + let root_hash = update_store(store, batch.into_iter(), version, false); let last_version = next_version - 1; let snapshot = db @@ -574,5 +626,14 @@ proptest! { // Initializes the state store by inserting one key at each version. fn init_store(store: &StateStore, input: impl Iterator) { - update_store(store, input.into_iter().map(|(k, v)| (k, Some(v))), 0); + update_store( + store, + input.into_iter().map(|(k, v)| (k, Some(v))), + 0, + false, + ); +} + +fn init_sharded_store(store: &StateStore, input: impl Iterator) { + update_store(store, input.into_iter().map(|(k, v)| (k, Some(v))), 0, true); } From 800bacf923b6d8775ea8c539b4fd7d3fa303173c Mon Sep 17 00:00:00 2001 From: Yuun Lim <38443641+yuunlimm@users.noreply.github.com> Date: Tue, 8 Oct 2024 15:50:42 -0700 Subject: [PATCH 4/8] add name mapping function for indexer test transactions (#14880) * dd name mapping function for indexer test transactions * use const var * lint --- .../indexer-test-transactions/README.md | 66 ++++++++ .../indexer-test-transactions/build.rs | 160 ++++++++++++------ 2 files changed, 175 insertions(+), 51 deletions(-) create mode 100644 ecosystem/indexer-grpc/indexer-test-transactions/README.md diff --git a/ecosystem/indexer-grpc/indexer-test-transactions/README.md b/ecosystem/indexer-grpc/indexer-test-transactions/README.md new file mode 100644 index 0000000000000..a26eaff406f3c --- /dev/null +++ b/ecosystem/indexer-grpc/indexer-test-transactions/README.md @@ -0,0 +1,66 @@ +# Transaction Code Generator +This dynamically generates code for constants that represent transactions stored as JSON files. It builds a set of Rust constants that point to these JSON files and optionally creates a function to retrieve the name of a transaction based on its constant value. + +## Features +- Transaction Constants: Automatically generates pub const declarations for each JSON file found in the specified directories. +- Modular Support: The code generation supports different transaction directories, such as imported_mainnet_txns, imported_testnet_txns, and scripted_transactions. +- Name Function Generation (Optional): For certain directories, the project can also generate a function that maps constant data to transaction names. + +## Directories for Transactions +The JSON files must be organized into specific directories within the json_transactions folder. The following directories are supported by default: + +- imported_mainnet_txns: Holds mainnet transaction JSON files. +- imported_testnet_txns: Holds testnet transaction JSON files. +- scripted_transactions: Holds scripted transaction JSON files and has a corresponding name lookup function. + +## How It Works +### Code Generation +The main purpose of this project is to automatically generate Rust code at build time. The generated code includes constants for each transaction JSON file and a function to retrieve transaction names, if applicable. The code is generated by the TransactionCodeBuilder struct and written to the OUT_DIR environment directory at compile time. + +The steps include: + +1. Scanning Directories: The project scans the directories for .json files. +2. Constant Generation: It creates a Rust constant for each JSON file, allowing them to be easily referenced in your code. +3. Name Function (Optional): For certain directories (e.g., scripted_transactions), a function get_transaction_name is generated to map the constant data back to the transaction name. + +### Example generate_transaction.rs Output +``` + + pub const IMPORTED_MAINNET_TXNS_308783012_FA_TRANSFER: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/json_transactions/imported_mainnet_txns/308783012_fa_transfer.json")); + pub const ALL_IMPORTED_MAINNET_TXNS: &[&[u8]] = &[IMPORTED_MAINNET_TXNS_308783012_FA_TRANSFER,]; + + pub const IMPORTED_TESTNET_TXNS_5979639459_COIN_REGISTER: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/json_transactions/imported_testnet_txns/5979639459_coin_register.json")); + + pub const IMPORTED_TESTNET_TXNS_1255836496_V2_FA_METADATA_: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/json_transactions/imported_testnet_txns/1255836496_v2_fa_metadata_.json")); + + pub const IMPORTED_TESTNET_TXNS_5992795934_FA_ACTIVITIES: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/json_transactions/imported_testnet_txns/5992795934_fa_activities.json")); + + pub const IMPORTED_TESTNET_TXNS_278556781_V1_COIN_REGISTER_FA_METADATA: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/json_transactions/imported_testnet_txns/278556781_v1_coin_register_fa_metadata.json")); + + pub const IMPORTED_TESTNET_TXNS_5523474016_VALIDATOR_TXN: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/json_transactions/imported_testnet_txns/5523474016_validator_txn.json")); + + pub const IMPORTED_TESTNET_TXNS_1_GENESIS: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/json_transactions/imported_testnet_txns/1_genesis.json")); + pub const ALL_IMPORTED_TESTNET_TXNS: &[&[u8]] = &[IMPORTED_TESTNET_TXNS_5979639459_COIN_REGISTER,IMPORTED_TESTNET_TXNS_1255836496_V2_FA_METADATA_,IMPORTED_TESTNET_TXNS_5992795934_FA_ACTIVITIES,IMPORTED_TESTNET_TXNS_278556781_V1_COIN_REGISTER_FA_METADATA,IMPORTED_TESTNET_TXNS_5523474016_VALIDATOR_TXN,IMPORTED_TESTNET_TXNS_1_GENESIS,]; + + pub const SCRIPTED_TRANSACTIONS_SIMPLE_USER_SCRIPT4: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/json_transactions/scripted_transactions/simple_user_script4.json")); + + pub const SCRIPTED_TRANSACTIONS_SIMPLE_USER_SCRIPT2: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/json_transactions/scripted_transactions/simple_user_script2.json")); + + pub const SCRIPTED_TRANSACTIONS_SIMPLE_USER_SCRIPT3: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/json_transactions/scripted_transactions/simple_user_script3.json")); + + pub const SCRIPTED_TRANSACTIONS_SIMPLE_USER_SCRIPT1: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/json_transactions/scripted_transactions/simple_user_script1.json")); + pub const ALL_SCRIPTED_TRANSACTIONS: &[&[u8]] = &[SCRIPTED_TRANSACTIONS_SIMPLE_USER_SCRIPT4,SCRIPTED_TRANSACTIONS_SIMPLE_USER_SCRIPT2,SCRIPTED_TRANSACTIONS_SIMPLE_USER_SCRIPT3,SCRIPTED_TRANSACTIONS_SIMPLE_USER_SCRIPT1,]; + + pub fn get_transaction_name(const_data: &[u8]) -> Option<&'static str> { + match const_data { + SCRIPTED_TRANSACTIONS_SIMPLE_USER_SCRIPT4 => Some("simple_user_script4"), + SCRIPTED_TRANSACTIONS_SIMPLE_USER_SCRIPT2 => Some("simple_user_script2"), + SCRIPTED_TRANSACTIONS_SIMPLE_USER_SCRIPT3 => Some("simple_user_script3"), + SCRIPTED_TRANSACTIONS_SIMPLE_USER_SCRIPT1 => Some("simple_user_script1"), + + _ => None, + } + } + + +``` \ No newline at end of file diff --git a/ecosystem/indexer-grpc/indexer-test-transactions/build.rs b/ecosystem/indexer-grpc/indexer-test-transactions/build.rs index 3180e0da35164..b574313a291b0 100644 --- a/ecosystem/indexer-grpc/indexer-test-transactions/build.rs +++ b/ecosystem/indexer-grpc/indexer-test-transactions/build.rs @@ -1,74 +1,132 @@ // Copyright (c) Aptos Foundation // SPDX-License-Identifier: Apache-2.0 -// build.rs use std::{env, fs, path::Path}; -fn main() { - let out_dir = env::var("OUT_DIR").unwrap(); - let dest_path = Path::new(&out_dir).join("generate_transactions.rs"); - - let mut all_transactions_code = String::new(); - - create_directory_if_missing("json_transactions/imported_mainnet_txns"); - create_directory_if_missing("json_transactions/imported_testnet_txns"); - create_directory_if_missing("json_transactions/scripted_transactions"); - - all_transactions_code.push_str(&process_directory( - "imported_mainnet_txns", - "imported_mainnet_txns", - )); - all_transactions_code.push_str(&process_directory( - "imported_testnet_txns", - "imported_testnet_txns", - )); - all_transactions_code.push_str(&process_directory( - "scripted_transactions", - "scripted_transactions", - )); - - fs::write(dest_path, all_transactions_code).unwrap(); +const IMPORTED_MAINNET_TXNS: &str = "imported_mainnet_txns"; +const IMPORTED_TESTNET_TXNS: &str = "imported_testnet_txns"; +const SCRIPTED_TRANSACTIONS_TXNS: &str = "scripted_transactions"; +#[derive(Default)] +pub struct TransactionCodeBuilder { + // Holds the generated Rust code for transaction constants + transactions_code: String, + // Holds the match arms for the name generation function for scripted txns (optional) + name_function_code: String, } -fn process_directory(dir_name: &str, module_name: &str) -> String { - let mut transactions_code = String::new(); - let mut all_constants = String::new(); - let json_dir = Path::new("json_transactions").join(dir_name); +impl TransactionCodeBuilder { + pub fn new() -> Self { + Self::default() + } + + pub fn add_directory( + mut self, + dir_name: &str, + module_name: &str, + generate_name_function: bool, + ) -> Self { + let json_dir = Path::new("json_transactions").join(dir_name); + let mut all_constants = String::new(); + + // Iterates over all files in the directory + for entry in fs::read_dir(json_dir).expect("Failed to read directory") { + let entry = entry.expect("Failed to get directory entry"); + let path = entry.path(); - for entry in fs::read_dir(json_dir).expect("Failed to read directory") { - let entry = entry.expect("Failed to get directory entry"); - let path = entry.path(); + // Checks if the file has a `.json` extension + if path.extension().and_then(|s| s.to_str()) == Some("json") { + let file_name = path.file_stem().unwrap().to_str().unwrap(); + let const_name = format!( + "{}_{}", + module_name.to_uppercase(), + file_name.to_uppercase().replace('-', "_") + ); - if path.extension().and_then(|s| s.to_str()) == Some("json") { - let file_name = path.file_stem().unwrap().to_str().unwrap(); - let const_name = format!( - "{}_{}", + // Generates a constant for the JSON file and appends it to the `transactions_code` string + self.transactions_code.push_str(&format!( + r#" + pub const {const_name}: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/json_transactions/{dir_name}/{file_name}.json")); + "#, + const_name = const_name, + dir_name = dir_name, + file_name = file_name, + )); + + // Adds the constant to the list of all constants + all_constants.push_str(&format!("{},", const_name)); + + // If name function generation is requested, adds the corresponding match arm + if generate_name_function { + self.name_function_code.push_str(&format!( + " {const_name} => Some(\"{file_name}\"),\n", + const_name = const_name, + file_name = file_name + )); + } + } + } + + // If any constants were created, generate an array holding all of them + if !all_constants.is_empty() { + self.transactions_code.push_str(&format!( + "pub const ALL_{}: &[&[u8]] = &[{}];\n", module_name.to_uppercase(), - file_name.to_uppercase().replace('-', "_") - ); + all_constants + )); + } - let json_code = format!( + self + } + + // Adds the transaction name lookup function if any name match arms were created + pub fn add_transaction_name_function(mut self) -> Self { + if !self.name_function_code.is_empty() { + self.transactions_code.push_str( r#" - pub const {const_name}: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/json_transactions/{dir_name}/{file_name}.json")); + pub fn get_transaction_name(const_data: &[u8]) -> Option<&'static str> { + match const_data { "#, - const_name = const_name, - dir_name = dir_name, - file_name = file_name, ); - transactions_code.push_str(&json_code); - all_constants.push_str(&format!("{},", const_name)); + + self.transactions_code.push_str(&self.name_function_code); + + self.transactions_code.push_str( + r#" + _ => None, + } + } + "#, + ); } + self + } + + pub fn build(self) -> String { + self.transactions_code } +} + +fn main() { + let out_dir = env::var("OUT_DIR").unwrap(); + let dest_path = Path::new(&out_dir).join("generate_transactions.rs"); + + // Create necessary directories if missing + create_directory_if_missing(&format!("json_transactions/{}", IMPORTED_MAINNET_TXNS)); + create_directory_if_missing(&format!("json_transactions/{}", IMPORTED_TESTNET_TXNS)); + create_directory_if_missing(&format!("json_transactions/{}", SCRIPTED_TRANSACTIONS_TXNS)); - transactions_code.push_str(&format!( - "pub const ALL_{}: &[&[u8]] = &[{}];", - module_name.to_uppercase(), - all_constants - )); + // Using the builder pattern to construct the code + let code = TransactionCodeBuilder::new() + .add_directory(IMPORTED_MAINNET_TXNS, IMPORTED_MAINNET_TXNS, false) + .add_directory(IMPORTED_TESTNET_TXNS, IMPORTED_TESTNET_TXNS, false) + .add_directory(SCRIPTED_TRANSACTIONS_TXNS, SCRIPTED_TRANSACTIONS_TXNS, true) + .add_transaction_name_function() + .build(); - transactions_code + fs::write(dest_path, code).unwrap(); } +// Helper function to create directories if they are missing fn create_directory_if_missing(dir: &str) { let path = Path::new(dir); if !path.exists() { From 7026a42d6b01fd028d07bf639c0ad59b50ab4342 Mon Sep 17 00:00:00 2001 From: Victor Gao <10379359+vgao1996@users.noreply.github.com> Date: Tue, 8 Oct 2024 17:25:49 -0700 Subject: [PATCH 5/8] [aptos-workspace-server] fix config issue preventing indexer grpc from starting (#14901) --- aptos-move/aptos-workspace-server/src/main.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/aptos-move/aptos-workspace-server/src/main.rs b/aptos-move/aptos-workspace-server/src/main.rs index ddae12ae2d4f9..0a6a5e5334355 100644 --- a/aptos-move/aptos-workspace-server/src/main.rs +++ b/aptos-move/aptos-workspace-server/src/main.rs @@ -3,7 +3,7 @@ use anyhow::Result; use aptos::node::local_testnet::HealthChecker; -use aptos_config::config::NodeConfig; +use aptos_config::config::{NodeConfig, TableInfoServiceMode}; use aptos_faucet_core::server::{FunderKeyEnum, RunConfig}; use aptos_node::{load_node_config, start_and_report_ports}; use aptos_types::network_address::{NetworkAddress, Protocol}; @@ -59,7 +59,8 @@ async fn spawn_node(test_dir: &Path) -> Result<()> { zero_all_ports(&mut node_config); node_config.indexer_grpc.enabled = true; node_config.indexer_grpc.use_data_service_interface = true; - node_config.storage.enable_indexer = true; + + node_config.indexer_table_info.table_info_service_mode = TableInfoServiceMode::IndexingOnly; node_config .api From cbb4431ebfd0c1949ed516eadd71679f7fcb1507 Mon Sep 17 00:00:00 2001 From: Wolfgang Grieskamp Date: Tue, 8 Oct 2024 21:27:05 -0700 Subject: [PATCH 6/8] [compiler-v2] Ast generator from stackless bytecode, Source Gen from Ast (#14494) * [compiler-v2] Ast generator from stackless bytecode, Source gen from Ast Converter from stackless bytecode into Model AST ('astifier'). (We already have one from binary format to stackless.) Also adds a converter from AST to source ('sourcifier'). This adds the major pieces for a working decompiler. However, the pieces are not fully connected to a tool yet, as more sidework needs to be done first. Specifically, this PR adds breaks/continues to labeled outer loops, which are not yet supported by the compiler. There are some tests in a new test crate `ast-generator-tests`. These call the v2 compiler to compile up to file format, then decompile from there into stackless bytecode, into AST, and via sourcifier back to source. However, desired execution roundtrip comparison tests can only be implemented once the full toolchain is ready. Another set of tests for the 'sourcifier' is via compiler-v2 baseline files. Where AST dump is requested in those tests, we dump now also the sourcified AST. This can live side-by-side for a while until we may decide to remove one of the outputs. * Implement positional layouts in sourcifier * Fixing type display context for multiple usage scenarios --- Cargo.lock | 20 + Cargo.toml | 2 + .../move-to-yul/tests/AccountStateMachine.exp | 56 +- .../evm/move-to-yul/tests/ConstructorTest.exp | 8 +- .../evm/move-to-yul/tests/GlobalVectors.exp | 366 +-- .../move/evm/move-to-yul/tests/Resources.exp | 80 +- .../tests/Resources.exp.capture-source-info | 80 +- .../move/evm/move-to-yul/tests/Structs.exp | 90 +- .../move/evm/move-to-yul/tests/Tables.exp | 168 +- .../evm/move-to-yul/tests/TestABIStructs.exp | 68 +- .../move-to-yul/tests/TestExternalResult.exp | 126 +- .../move-to-yul/tests/TestStringLiteral.exp | 16 +- .../move/evm/move-to-yul/tests/Vectors.exp | 132 +- .../DispatcherArrayDecoding.exp | 22 +- .../DispatcherBasicStorage.exp | 12 +- .../DispatcherEncodingStorage.exp | 26 +- .../tests/test-dispatcher/ExternalCall.exp | 90 +- .../tests/test-events/CallEmit.exp | 36 +- .../src/bytecode_generator.rs | 5 +- .../src/env_pipeline/inliner.rs | 4 +- .../tests/ability-check/ability_violation.exp | 6 +- .../ability-check/alive_since_borrowed.exp | 4 +- .../tests/ability-check/assign.exp | 2 +- .../tests/ability-check/bug_14189.exp | 2 +- ...ug_14223_unused_non_droppable_no_abort.exp | 2 +- .../tests/ability-check/bug_14227.exp | 2 +- .../tests/ability-check/explicit_move.exp | 2 +- .../tests/ability-check/index_ability_err.exp | 2 +- .../tests/ability-check/loop_abort.exp | 2 +- .../typing/assign_unpack_references.exp | 4 +- .../typing/bind_unpack_references.exp | 4 +- .../typing/borrow_local_temp_resource.exp | 4 +- .../typing/derefrence_reference.exp | 14 +- .../ability-check/typing/eq_invalid2.exp | 6 +- .../ability-check/typing/mutate_resource.exp | 2 +- .../ability-check/typing/neq_invalid2.exp | 12 +- .../tests/ability-check/typing/pack.exp | 2 +- .../phantom_param_op_abilities_invalid2.exp | 8 +- .../type_variable_join_threaded_unpack.exp | 2 +- ...e_variable_join_threaded_unpack_assign.exp | 2 +- .../ability-check/unused_para_no_drop.exp | 12 +- .../v1-borrow-tests/assign_resource.exp | 4 +- .../ability-check/v1-borrow-tests/no_drop.exp | 2 +- .../v1-locals/drop_conditional.exp | 4 +- .../v1-locals/reassign_parameter.exp | 2 +- .../v1-signer/copy_loc_transitive.exp | 2 +- .../v1-typing/assign_pop_resource.exp | 6 +- .../v1-typing/bind_pop_resource.exp | 8 +- .../borrow_field_non_ref_non_local_root.exp | 2 +- .../v1-typing/conditional_copy_invalid.exp | 20 +- .../v1-typing/conditional_drop_invalid.exp | 22 +- ...plicit_deref_borrow_field_not_copyable.exp | 4 +- .../v1-typing/seq_cannot_ignore_resource.exp | 12 +- .../borrowed_from_one_path.exp | 36 +- .../ability-transform/copy_ability_tuple.exp | 60 +- .../tests/ability-transform/mutate_vector.exp | 96 +- .../tests/abort-analysis/drop_on_abort.exp | 12 +- .../tests/abort-analysis/loop_abort.exp | 24 +- .../tests/bytecode-generator/assign.exp | 56 +- .../bytecode-generator/assign_inline.exp | 10 + .../tests/bytecode-generator/borrow.exp | 51 +- .../borrow_deref_optimize.exp | 54 +- .../bug_14300_update_variant_select.exp | 99 +- .../bug_14300_variant_select_autoref.exp | 29 +- .../bug_14471_receiver_inference.exp | 68 +- .../bytecode-generator/conditional_borrow.exp | 152 +- .../bytecode-generator/escape_autoref.exp | 79 +- .../tests/bytecode-generator/fields.exp | 204 +- .../bytecode-generator/fields_invalid.exp | 22 +- .../bytecode-generator/freeze_mut_ref.exp | 131 +- .../tests/bytecode-generator/globals.exp | 62 +- .../tests/bytecode-generator/if_else.exp | 10 + .../tests/bytecode-generator/inline_specs.exp | 24 + .../tests/bytecode-generator/loop.exp | 29 + .../tests/bytecode-generator/loop_invalid.exp | 14 + .../matching_ability_err.exp | 113 +- .../matching_coverage_err.exp | 140 +- .../tests/bytecode-generator/matching_ok.exp | 412 ++- .../matching_refutable_err.exp | 20 +- .../moved_var_not_simplified3.exp | 10 + .../mutate_immutable_cmp.exp | 60 +- .../tests/bytecode-generator/operators.exp | 26 +- .../tests/bytecode-generator/pack_order.exp | 83 +- .../tests/bytecode-generator/pack_unpack.exp | 42 +- .../reference_conversion.exp | 13 + .../bytecode-generator/spec_construct.exp | 31 +- .../v1-commands/break_outside_loop.exp | 7 + .../break_outside_loop_in_else.exp | 7 + .../v1-commands/break_outside_loop_in_if.exp | 7 + .../v1-commands/continue_outside_loop.exp | 7 + .../continue_outside_loop_in_if.exp | 7 + .../v1-typing/global_invalid.exp | 9 + .../v1-typing/mutate_immutable.exp | 19 +- .../tests/bytecode-generator/vector.exp | 7 + .../tests/bytecode-generator/wildcard2.exp | 8 + .../tests/bytecode-generator/wildcard3.exp | 35 +- .../tests/bytecode-generator/wildcard4.exp | 11 + .../tests/bytecode-generator/wildcard5.exp | 20 +- .../tests/bytecode-generator/wildcard6.exp | 9 + .../tests/bytecode-generator/wildcard7.exp | 10 + .../tests/bytecode-generator/wildcard8.exp | 8 + .../entry_inline_err_no_report.exp | 13 + .../checking-lang-v1/eq_inline_typed.exp | 9 + .../use_struct_overlap_with_module.exp | 15 +- .../tests/checking/abilities/tuple.exp | 18 +- .../abilities/v1/ability_constraints.exp | 229 +- .../v1/phantom_param_op_abilities.exp | 72 +- .../phantom_params_constraint_abilities.exp | 55 +- .../v1/phantom_params_field_abilities.exp | 38 +- .../checking/access_specifiers/access_ok.exp | 90 +- .../acquires_list_generic.exp | 17 +- .../attributes/aptos_stdlib_attributes2.exp | 8 + .../attributes/attribute_placement.exp | 21 + .../attributes/attribute_variants.exp | 4 + .../checking/control_flow/loop_after_loop.exp | 8 + .../tests/checking/dotdot/dotdot_valid.exp | 225 +- .../tests/checking/dotdot/extra_dotdot.exp | 22 +- .../tests/checking/indexing/examples_book.exp | 28 +- .../tests/checking/inlining/bug_11112.exp | 21 + .../tests/checking/inlining/bug_11223.exp | 11 + .../tests/checking/inlining/bug_9717.exp | 75 + .../checking/inlining/bug_9717_looponly.exp | 17 + .../inlining/continue_without_loop.exp | 7 + .../tests/checking/inlining/deep_exp.exp | 2544 +++++++++++++++++ .../checking/inlining/double_nesting.exp | 19 + .../inlining/inline_accessing_constant.exp | 12 + .../tests/checking/inlining/lambda.exp | 71 +- .../tests/checking/inlining/lambda_cast.exp | 40 + .../tests/checking/inlining/lambda_typed.exp | 71 +- .../tests/checking/inlining/nested_mul.exp | 13 + .../checking/inlining/order_sensitive.exp | 94 + .../checking/inlining/recursive_nesting.exp | 30 + .../checking/inlining/resources_valid.exp | 43 +- .../checking/inlining/shadowing_unused.exp | 29 + .../inlining/shadowing_unused_nodecl.exp | 29 + .../shadowing_unused_nodecl_typed.exp | 29 + .../inlining/shadowing_unused_typed.exp | 29 + .../tests/checking/inlining/spec_inlining.exp | 51 + .../checking/inlining/spec_inlining_typed.exp | 51 + .../checking/inlining/temp_shadowing.exp | 32 + .../tests/checking/inlining/test_12670.exp | 31 +- .../tests/checking/inlining/unused_inline.exp | 24 + .../naming/duplicate_acquires_list_item.exp | 44 +- .../checking/naming/generics_shadowing.exp | 13 +- .../global_builtin_one_type_argument.exp | 27 +- .../naming/struct_in_current_module.exp | 16 +- .../naming/unused_type_parameter_struct.exp | 22 +- .../checking/naming/warning_dependency.exp | 6 +- .../positional_fields/assign_field.exp | 127 +- .../bind_anonymous_field.exp | 43 +- .../positional_fields/common_access.exp | 19 +- .../checking/positional_fields/decl_ok.exp | 45 +- .../named_tuple_ability_decl_ok.exp | 29 +- .../named_tuple_construct_ok.exp | 70 +- .../variant_ability_decl_ok.exp | 22 + .../tests/checking/receiver/calls.exp | 48 +- .../checking/receiver/calls_with_freeze.exp | 36 +- .../tests/checking/receiver/decl_errors.exp | 35 +- .../receiver/dont_warn_unused_self.exp | 11 +- .../tests/checking/receiver/generic_calls.exp | 66 +- .../checking/receiver/generic_calls_typed.exp | 66 +- .../tests/checking/receiver/same_names.exp | 38 +- .../checking/receiver/same_names_typed.exp | 38 +- .../tests/checking/receiver/vectors.exp | 21 +- .../specs/assert_skipped_for_spec.exp | 8 + .../tests/checking/specs/conditions_ok.exp | 21 +- .../tests/checking/specs/expressions_ok.exp | 4 + .../checking/specs/inline_fun_in_spec.exp | 66 +- .../specs/inline_fun_in_spec_typed.exp | 66 +- .../checking/specs/inline_fun_spec_ok.exp | 13 + .../checking/specs/inline_spec_inference.exp | 14 + .../specs/inline_spec_inference_bitvector.exp | 18 + .../specs/inline_spec_inference_vector.exp | 14 + .../tests/checking/specs/inline_spec_old.exp | 12 + .../checking/specs/intrinsic_decl_ok.exp | 54 +- .../tests/checking/specs/invariants_ok.exp | 27 +- .../tests/checking/specs/lets_ok.exp | 8 + .../specs/move_function_in_spec_ok.exp | 47 +- .../tests/checking/specs/quantifiers_ok.exp | 15 +- .../tests/checking/specs/schemas_ok.exp | 15 + .../tests/checking/specs/structs_ok.exp | 50 +- .../tests/checking/specs/type_variance_ok.exp | 7 + .../tests/checking/specs/update_field_ok.exp | 21 +- .../tests/checking/typing/annotated_types.exp | 17 +- .../tests/checking/typing/assign_nested2.exp | 19 +- .../tests/checking/typing/assign_tuple_wg.exp | 21 +- .../tests/checking/typing/binary_add.exp | 27 +- .../tests/checking/typing/binary_and.exp | 21 +- .../tests/checking/typing/binary_bit_and.exp | 27 +- .../tests/checking/typing/binary_bit_or.exp | 27 +- .../tests/checking/typing/binary_div.exp | 27 +- .../tests/checking/typing/binary_geq.exp | 27 +- .../tests/checking/typing/binary_gt.exp | 27 +- .../tests/checking/typing/binary_leq.exp | 27 +- .../tests/checking/typing/binary_lt.exp | 27 +- .../tests/checking/typing/binary_mod.exp | 27 +- .../tests/checking/typing/binary_mul.exp | 27 +- .../tests/checking/typing/binary_or.exp | 21 +- .../tests/checking/typing/binary_shl.exp | 27 +- .../tests/checking/typing/binary_shr.exp | 27 +- .../tests/checking/typing/binary_sub.exp | 27 +- .../tests/checking/typing/binary_xor.exp | 27 +- .../checking/typing/bind_with_type_annot.exp | 16 +- .../tests/checking/typing/block_empty.exp | 9 + .../checking/typing/block_single_expr.exp | 13 + .../checking/typing/block_with_statements.exp | 23 +- .../tests/checking/typing/borrow_field.exp | 14 +- .../checking/typing/borrow_field_chain.exp | 48 +- .../typing/borrow_field_complex_root_expr.exp | 34 +- .../typing/borrow_field_non_ref_root.exp | 23 +- .../tests/checking/typing/borrow_local.exp | 42 +- .../checking/typing/borrow_local_temp.exp | 16 + .../tests/checking/typing/break_any_type.exp | 19 +- .../checking/typing/break_outside_loop.exp | 15 + .../tests/checking/typing/cast.exp | 17 + .../typing/constant_all_valid_types.exp | 43 + .../checking/typing/constant_folding.exp | 4 + .../typing/constant_supported_exps.exp | 4 + .../checking/typing/continue_any_type.exp | 19 +- .../checking/typing/continue_outside_loop.exp | 8 + .../typing/decl_unpack_references.exp | 42 +- .../typing/declare_with_type_annot.exp | 12 +- .../tests/checking/typing/derefrence.exp | 44 +- .../tests/checking/typing/dummy_field.exp | 42 +- .../checking/typing/entry_on_any_vis.exp | 10 + .../typing/entry_signature_no_warning.exp | 22 +- .../tests/checking/typing/eq.exp | 64 +- .../tests/checking/typing/eq_inline.exp | 9 + .../tests/checking/typing/eq_inline_typed.exp | 9 + .../tests/checking/typing/eq_ref.exp | 13 + .../tests/checking/typing/exp_list.exp | 21 +- .../tests/checking/typing/explicit_copy.exp | 17 +- .../tests/checking/typing/explicit_move.exp | 20 +- .../tests/checking/typing/global_builtins.exp | 48 +- .../typing/global_builtins_inferred.exp | 18 +- .../typing/hex_and_decimal_address.exp | 23 +- .../checking/typing/if_branches_subtype.exp | 14 + .../tests/checking/typing/if_condition.exp | 12 + .../tests/checking/typing/if_default_else.exp | 11 + .../checking/typing/if_matched_branches.exp | 22 +- .../typing/implicit_deref_borrow_field.exp | 14 +- .../implicit_deref_borrow_field_chain.exp | 33 +- ...t_deref_borrow_field_complex_root_expr.exp | 31 +- ...ef_borrow_field_non_ref_non_local_root.exp | 33 +- ...plicit_deref_borrow_field_non_ref_root.exp | 17 +- .../tests/checking/typing/large_binop.exp | 7 + .../tests/checking/typing/loop_body.exp | 35 + .../checking/typing/loop_result_type.exp | 32 + .../tests/checking/typing/main_arguments.exp | 6 + .../typing/main_arguments_various_caes.exp | 24 +- .../tests/checking/typing/main_call_entry.exp | 11 + .../typing/main_with_type_parameters.exp | 6 + .../typing/module_call_entry_function.exp | 46 + .../typing/move_from_type_argument.exp | 18 +- .../checking/typing/mutable_eq_and_neq.exp | 75 +- .../tests/checking/typing/mutate.exp | 51 +- .../tests/checking/typing/neq.exp | 64 +- .../checking/typing/nested_post_process.exp | 43 +- .../tests/checking/typing/other_builtins.exp | 15 +- .../typing/phantom_param_struct_decl.exp | 27 +- .../tests/checking/typing/return_any_type.exp | 17 +- .../typing/return_type_explicit_exp.exp | 18 +- .../checking/typing/return_type_last_exp.exp | 16 +- .../checking/typing/seq_ignores_value.exp | 18 + .../tests/checking/typing/shadowing.exp | 41 + .../tests/checking/typing/spec_block_ok.exp | 11 + .../checking/typing/struct_no_field_list.exp | 16 +- .../checking/typing/subtype_annotation.exp | 20 + .../tests/checking/typing/subtype_args.exp | 41 +- .../tests/checking/typing/subtype_assign.exp | 25 + .../tests/checking/typing/subtype_bind.exp | 21 + .../tests/checking/typing/subtype_return.exp | 23 +- .../tests/checking/typing/tuple.exp | 18 +- .../typing/type_variable_join_single_pack.exp | 18 +- .../type_variable_join_single_unpack.exp | 23 +- ...ype_variable_join_single_unpack_assign.exp | 31 +- .../type_variable_join_threaded_pack.exp | 40 +- .../tests/checking/typing/unary_not.exp | 20 +- .../tests/checking/typing/unit.exp | 7 + .../checking/typing/unused_lambda_param.exp | 16 + .../typing/unused_lambda_param_typed.exp | 16 + .../tests/checking/typing/unused_local.exp | 34 + .../tests/checking/typing/use_local.exp | 19 +- .../multi_pool_money_market_token.exp | 298 +- .../v1-examples/simple_money_market_token.exp | 263 +- .../tests/checking/typing/values.exp | 11 + .../checking/typing/vector_basic_cases.exp | 31 +- .../tests/checking/typing/while_body.exp | 19 + .../tests/checking/typing/while_condition.exp | 12 + .../tests/checking/unused/local_var.exp | 7 + .../tests/checking/unused/unused_enum.exp | 17 +- .../variants_allow_match_empty_block.exp | 6 + .../variants/variants_allow_match_fun_1.exp | 29 +- .../variants/variants_allow_match_fun_2.exp | 28 +- .../variants/variants_allow_match_fun_3.exp | 29 +- .../variants/variants_allow_match_var.exp | 27 +- .../checking/variants/variants_constants.exp | 53 +- .../tests/checking/variants/variants_ok.exp | 173 +- .../variants_test_no_parenthesis_ok.exp | 46 +- .../checking/variants/variants_test_ok.exp | 46 +- .../variants/variants_test_parse_ok2.exp | 18 +- .../visibility-checker/direct_visibility.exp | 21 + .../module_call_visibility_friend.exp | 48 + .../parser_package_keyword.exp | 8 + .../jump-label.on.exp | 18 +- .../tests/copy-propagation/mut_refs_2.exp | 20 +- .../sequential_assign_struct.exp | 28 +- .../recursive_type_instantiation.exp | 22 +- .../v1-tests/complex_1.exp | 8 +- ...mutually_recursive_just_type_params_ok.exp | 10 + ...mutually_recursive_non_generic_type_ok.exp | 15 +- ...hree_args_just_type_params_shitfing_ok.exp | 13 + ...ree_args_type_con_non_generic_types_ok.exp | 12 +- ...recursive_three_args_type_con_shifting.exp | 12 +- ...rgs_non_generic_type_and_type_param_ok.exp | 10 + ..._two_args_swapping_just_type_params_ok.exp | 10 + ...y_recursive_two_args_swapping_type_con.exp | 6 +- .../v1-tests/mutually_recursive_type_con.exp | 6 +- .../v1-tests/nested_types_1.exp | 2 +- .../v1-tests/nested_types_2.exp | 2 +- .../recursive_infinite_type_terminates.exp | 2 +- .../recursive_one_arg_just_type_params_ok.exp | 9 +- .../recursive_one_arg_non_generic_type_ok.exp | 7 + .../v1-tests/recursive_one_arg_type_con.exp | 2 +- .../recursive_two_args_swapping_type_con.exp | 2 +- .../v1-tests/two_loops.exp | 4 +- .../infinite_instantiations_invalid.exp | 56 +- .../infinite_instantiations_valid.exp | 34 +- .../folding/constant_folding_addresses.exp | 10 + .../tests/folding/constant_values.exp | 22 + .../tests/folding/empty_tvectors.exp | 48 +- .../tests/folding/empty_vectors.exp | 43 + .../tests/folding/empty_vectors2.exp | 45 + .../tests/folding/non_constant_empty_vec.exp | 36 +- .../tests/folding/nonempty_tvectors.exp | 48 +- .../tests/folding/nonempty_vectors.exp | 43 + .../tests/lambda-lifting/pattern.exp | 12 +- .../tests/live-var/mut_ref.exp | 120 +- .../tests/more-v1/liveness/mut_ref2.exp | 18 +- .../locals/assign_partial_resource.exp | 6 +- .../tests/more-v1/locals/assign_resource.exp | 8 +- .../tests/more-v1/locals/unused_resource.exp | 14 +- .../unused_resource_explicit_return.exp | 14 +- .../constant_folding_ristretto.exp | 9 + .../moved_var_not_simplified.exp | 9 + .../moved_var_not_simplified2.exp | 10 + .../tests/op-equal/eval_order.exp | 64 + .../tests/op-equal/invalid1.exp | 14 + .../tests/op-equal/invalid6.exp | 13 + .../tests/op-equal/valid0.exp | 363 ++- .../tests/op-equal/valid1.exp | 217 +- .../tests/op-equal/valid2.exp | 69 +- ...urn_with_borrowed_loc_resource_invalid.exp | 2 +- ...h_borrowed_loc_resource_invalid.no-opt.exp | 2 +- ...with_borrowed_loc_resource_invalid.old.exp | 2 +- .../always_false_branch.exp | 12 + .../assign_unpack_references.exp | 64 +- .../simplifier-elimination/binary_add.exp | 19 +- .../bind_with_type_annot.exp | 12 +- .../constant_all_valid_types.exp | 29 + .../simplifier-elimination/double_nesting.exp | 19 + .../else_assigns_if_doesnt.exp | 15 + .../if_assigns_else_doesnt.exp | 15 + .../if_assigns_no_else.exp | 9 + .../simplifier-elimination/if_condition.exp | 8 + .../moved_var_not_simplified.exp | 9 + .../moved_var_not_simplified2.exp | 10 + .../recursive_nesting.exp | 30 + .../use_before_assign.exp | 8 + .../use_before_assign_loop.exp | 39 + .../use_before_assign_while.exp | 38 + .../tests/simplifier/bug_11112.exp | 21 + .../tests/simplifier/conditional_borrow.exp | 84 +- .../simplifier/constant_folding_addresses.exp | 7 + .../simplifier/constant_folding_ristretto.exp | 7 + .../tests/simplifier/deep_exp.exp | 2544 +++++++++++++++++ .../simplifier/moved_var_not_simplified.exp | 9 + .../simplifier/moved_var_not_simplified2.exp | 10 + .../tests/simplifier/random.exp | 81 +- .../tests/simplifier/simplifier_test1.exp | 18 + .../tests/simplifier/simplifier_test2.exp | 27 + .../tests/simplifier/simplifier_test3.exp | 19 + .../tests/simplifier/simplifier_test4.exp | 51 +- .../move/move-compiler-v2/tests/testsuite.rs | 12 +- .../struct_use_before_assign.exp | 32 +- .../uninit-use-checker/unused_reference.exp | 8 +- .../v1-locals/use_before_assign_simple.exp | 24 +- .../tests/variable-coalescing/consume_1.exp | 50 +- .../variable-coalescing/consume_1.opt.exp | 50 +- .../tests/variable-coalescing/consume_2.exp | 30 +- .../variable-coalescing/consume_2.opt.exp | 30 +- .../tests/variable-coalescing/consume_3.exp | 30 +- .../variable-coalescing/consume_3.opt.exp | 30 +- .../tests/variable-coalescing/consume_4.exp | 40 +- .../variable-coalescing/consume_4.opt.exp | 40 +- .../tests/variable-coalescing/consume_5.exp | 30 +- .../variable-coalescing/consume_5.opt.exp | 30 +- .../tests/variable-coalescing/mut_refs_2.exp | 70 +- .../variable-coalescing/mut_refs_2.opt.exp | 70 +- .../sequential_assign_struct.exp | 70 +- .../sequential_assign_struct.opt.exp | 70 +- .../mix_friend_package_visibility_valid.exp | 12 + .../visibility-checker/package_visibility.exp | 34 + .../module_call_visibility_friend.exp | 48 + .../visibility-checker/visibility_complex.exp | 26 + .../move/move-model/bytecode/Cargo.toml | 1 + .../bytecode/ast-generator-tests/Cargo.toml | 21 + .../bytecode/ast-generator-tests/src/lib.rs | 5 + .../tests/conditionals.exp | 469 +++ .../tests/conditionals.move | 38 + .../ast-generator-tests/tests/loops.exp | 499 ++++ .../ast-generator-tests/tests/loops.move | 34 + .../ast-generator-tests/tests/match.exp | 335 +++ .../ast-generator-tests/tests/match.move | 21 + .../ast-generator-tests/tests/testsuite.rs | 133 + .../move/move-model/bytecode/src/astifier.rs | 1990 +++++++++++++ .../bytecode/src/dataflow_domains.rs | 9 +- .../move/move-model/bytecode/src/lib.rs | 1 + .../bytecode/src/stackless_bytecode.rs | 31 +- .../src/stackless_control_flow_graph.rs | 42 +- .../bytecode/tests/borrow/basic_test.exp | 176 +- .../bytecode/tests/borrow/function_call.exp | 86 +- .../bytecode/tests/borrow/hyper_edge.exp | 70 +- .../tests/borrow_strong/basic_test.exp | 230 +- .../bytecode/tests/borrow_strong/mut_ref.exp | 430 +-- .../regression_generic_and_native_type.exp | 54 +- .../bytecode/tests/from_move/smoke_test.exp | 166 +- .../bytecode/tests/livevar/basic_test.exp | 82 +- .../tests/reaching_def/basic_test.exp | 12 +- .../bytecode/tests/usage_analysis/test.exp | 48 +- third_party/move/move-model/src/ast.rs | 183 +- .../move-model/src/builder/exp_builder.rs | 6 +- .../move-model/src/builder/model_builder.rs | 2 + .../move/move-model/src/exp_builder.rs | 169 ++ .../move/move-model/src/exp_rewriter.rs | 6 +- third_party/move/move-model/src/lib.rs | 2 + third_party/move/move-model/src/model.rs | 74 +- third_party/move/move-model/src/sourcifier.rs | 1072 +++++++ third_party/move/move-model/src/ty.rs | 41 +- .../data_invariant_instrumentation/borrow.exp | 120 +- .../data_invariant_instrumentation/pack.exp | 22 +- .../data_invariant_instrumentation/params.exp | 12 +- .../data_invariant_instrumentation/vector.exp | 6 +- .../tests/eliminate_imm_refs/basic_test.exp | 100 +- .../disable_in_body.exp | 14 +- .../global_invariant_analysis/mutual_inst.exp | 62 +- .../uninst_type_param_in_inv.exp | 44 +- .../borrow.exp | 30 +- .../global_invariant_instrumentation/move.exp | 32 +- .../update.exp | 28 +- .../tests/memory_instr/basic_test.exp | 176 +- .../tests/memory_instr/mut_ref.exp | 262 +- .../tests/mono_analysis/test.exp | 32 +- .../mut_ref_instrumentation/basic_test.exp | 208 +- .../tests/spec_instrumentation/fun_spec.exp | 138 +- .../tests/spec_instrumentation/generics.exp | 52 +- .../tests/spec_instrumentation/modifies.exp | 210 +- .../spec_instrumentation/opaque_call.exp | 108 +- .../verification_analysis/inv_relevance.exp | 12 +- .../verification_analysis/inv_suspension.exp | 12 +- .../move-prover/move-docgen/src/docgen.rs | 33 +- third_party/move/scripts/move_pr.sh | 1 + 462 files changed, 22400 insertions(+), 4678 deletions(-) create mode 100644 third_party/move/move-model/bytecode/ast-generator-tests/Cargo.toml create mode 100644 third_party/move/move-model/bytecode/ast-generator-tests/src/lib.rs create mode 100644 third_party/move/move-model/bytecode/ast-generator-tests/tests/conditionals.exp create mode 100644 third_party/move/move-model/bytecode/ast-generator-tests/tests/conditionals.move create mode 100644 third_party/move/move-model/bytecode/ast-generator-tests/tests/loops.exp create mode 100644 third_party/move/move-model/bytecode/ast-generator-tests/tests/loops.move create mode 100644 third_party/move/move-model/bytecode/ast-generator-tests/tests/match.exp create mode 100644 third_party/move/move-model/bytecode/ast-generator-tests/tests/match.move create mode 100644 third_party/move/move-model/bytecode/ast-generator-tests/tests/testsuite.rs create mode 100644 third_party/move/move-model/bytecode/src/astifier.rs create mode 100644 third_party/move/move-model/src/exp_builder.rs create mode 100644 third_party/move/move-model/src/sourcifier.rs diff --git a/Cargo.lock b/Cargo.lock index ff101bc3974dd..82bd6e543b615 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10839,6 +10839,19 @@ dependencies = [ "tempfile", ] +[[package]] +name = "move-ast-generator-tests" +version = "0.1.0" +dependencies = [ + "anyhow", + "codespan-reporting", + "datatest-stable", + "move-compiler-v2", + "move-model", + "move-prover-test-utils", + "move-stackless-bytecode", +] + [[package]] name = "move-async-vm" version = "0.1.0" @@ -11453,6 +11466,7 @@ dependencies = [ "num 0.4.1", "paste", "petgraph 0.6.5", + "topological-sort", ] [[package]] @@ -16740,6 +16754,12 @@ dependencies = [ "tonic 0.11.0", ] +[[package]] +name = "topological-sort" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea68304e134ecd095ac6c3574494fc62b909f416c4fca77e440530221e549d3d" + [[package]] name = "tower" version = "0.4.13" diff --git a/Cargo.toml b/Cargo.toml index 98659f312410b..d1f271a95416b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -221,6 +221,7 @@ members = [ "third_party/move/move-model", "third_party/move/move-model/bytecode", "third_party/move/move-model/bytecode-test-utils", + "third_party/move/move-model/bytecode/ast-generator-tests", "third_party/move/move-prover", "third_party/move/move-prover/boogie-backend", "third_party/move/move-prover/bytecode-pipeline", @@ -791,6 +792,7 @@ tonic = { version = "0.11.0", features = [ "zstd", ] } tonic-reflection = "0.11.0" +topological-sort = "0.2.2" triomphe = "0.1.9" tui = "0.19.0" typed-arena = "2.0.2" diff --git a/third_party/move/evm/move-to-yul/tests/AccountStateMachine.exp b/third_party/move/evm/move-to-yul/tests/AccountStateMachine.exp index 08f39e05a23f3..19d655cc32931 100644 --- a/third_party/move/evm/move-to-yul/tests/AccountStateMachine.exp +++ b/third_party/move/evm/move-to-yul/tests/AccountStateMachine.exp @@ -48,9 +48,9 @@ object "A3_AccountStateMachine" { $t0 := 0 // $t1 := 0 $t1 := 0 - // $t2 := vector::empty() + // $t2 := vector::empty<0x3::AccountStateMachine::PendingTransfer>() $t2 := A1_vector_empty$A3_AccountStateMachine_PendingTransfer$() - // $t3 := pack AccountStateMachine::Account($t0, $t1, $t2) + // $t3 := pack 0x3::AccountStateMachine::Account($t0, $t1, $t2) { let $mem := $Malloc(48) $MemoryStoreU64(add($mem, 32), $t0) @@ -245,7 +245,7 @@ object "A3_AccountStateMachine" { // label L6 // $t7 := freeze_ref($t5) $t7 := $t5 - // $t8 := vector::length($t7) + // $t8 := vector::length<0x3::AccountStateMachine::PendingTransfer>($t7) $t8 := A1_vector_length$A3_AccountStateMachine_PendingTransfer$($t7) // $t9 := <($t2, $t8) $t9 := $Lt(i, $t8) @@ -255,7 +255,7 @@ object "A3_AccountStateMachine" { default { $block := 4 } } case 3 { - // $t5 := borrow_field.pending($t0) + // $t5 := borrow_field<0x3::AccountStateMachine::Account>.pending($t0) $t5 := this // $t6 := 0 $t6 := 0 @@ -279,11 +279,11 @@ object "A3_AccountStateMachine" { // label L2 // $t10 := freeze_ref($t5) $t10 := $t5 - // $t11 := vector::borrow($t10, $t2) + // $t11 := vector::borrow<0x3::AccountStateMachine::PendingTransfer>($t10, $t2) $t11 := A1_vector_borrow$A3_AccountStateMachine_PendingTransfer$($t10, i) // $t12 := Actor::virtual_time() $t12 := A1_Actor_virtual_time() - // $t13 := borrow_field.initiated_at($t11) + // $t13 := borrow_field<0x3::AccountStateMachine::PendingTransfer>.initiated_at($t11) $t13 := $t11 // $t14 := read_ref($t13) $t14 := $LoadU128($t13) @@ -300,7 +300,7 @@ object "A3_AccountStateMachine" { } case 7 { // label L4 - // $t18 := vector::remove($t5, $t2) + // $t18 := vector::remove<0x3::AccountStateMachine::PendingTransfer>($t5, $t2) $t18 := A1_vector_remove$A3_AccountStateMachine_PendingTransfer$($t5, i) // drop($t18) $Free($t18, 32) @@ -345,7 +345,7 @@ object "A3_AccountStateMachine" { case 4 { // $t2 := 43 $t2 := 43 - // $t3 := borrow_field.value($t0) + // $t3 := borrow_field<0x3::AccountStateMachine::Account>.value($t0) $t3 := $IndexPtr(this, 32) // $t4 := read_ref($t3) $t4 := $LoadU64($t3) @@ -360,13 +360,13 @@ object "A3_AccountStateMachine" { } case 5 { // label L2 - // $t8 := borrow_field.value($t0) + // $t8 := borrow_field<0x3::AccountStateMachine::Account>.value($t0) $t8 := $IndexPtr(this, 32) // $t9 := read_ref($t8) $t9 := $LoadU64($t8) // $t10 := +($t9, $t1) $t10 := $AddU64($t9, v) - // $t11 := borrow_field.value($t0) + // $t11 := borrow_field<0x3::AccountStateMachine::Account>.value($t0) $t11 := $IndexPtr(this, 32) // write_ref($t11, $t10) $StoreU64($t11, $t10) @@ -395,7 +395,7 @@ object "A3_AccountStateMachine" { $Abort($t5) } case 4 { - // $t2 := borrow_field.value($t0) + // $t2 := borrow_field<0x3::AccountStateMachine::Account>.value($t0) $t2 := $IndexPtr(this, 32) // $t3 := read_ref($t2) $t3 := $LoadU64($t2) @@ -408,13 +408,13 @@ object "A3_AccountStateMachine" { } case 5 { // label L2 - // $t6 := borrow_field.value($t0) + // $t6 := borrow_field<0x3::AccountStateMachine::Account>.value($t0) $t6 := $IndexPtr(this, 32) // $t7 := read_ref($t6) $t7 := $LoadU64($t6) // $t8 := -($t7, $t1) $t8 := $Sub($t7, v) - // $t9 := borrow_field.value($t0) + // $t9 := borrow_field<0x3::AccountStateMachine::Account>.value($t0) $t9 := $IndexPtr(this, 32) // write_ref($t9, $t8) $StoreU64($t9, $t8) @@ -443,7 +443,7 @@ object "A3_AccountStateMachine" { $Abort($t7) } case 4 { - // $t4 := borrow_field.value($t0) + // $t4 := borrow_field<0x3::AccountStateMachine::Account>.value($t0) $t4 := $IndexPtr(this, 32) // $t5 := read_ref($t4) $t5 := $LoadU64($t4) @@ -458,11 +458,11 @@ object "A3_AccountStateMachine" { // label L2 // $t8 := AccountStateMachine::new_xfer_id($t0) $t8 := A3_AccountStateMachine_new_xfer_id(this) - // $t9 := borrow_field.pending($t0) + // $t9 := borrow_field<0x3::AccountStateMachine::Account>.pending($t0) $t9 := this // $t10 := Actor::virtual_time() $t10 := A1_Actor_virtual_time() - // $t11 := pack AccountStateMachine::PendingTransfer($t8, $t2, $t10) + // $t11 := pack 0x3::AccountStateMachine::PendingTransfer($t8, $t2, $t10) { let $mem := $Malloc(32) $MemoryStoreU64(add($mem, 16), $t8) @@ -470,7 +470,7 @@ object "A3_AccountStateMachine" { $MemoryStoreU128(add($mem, 0), $t10) $t11 := $mem } - // vector::push_back($t9, $t11) + // vector::push_back<0x3::AccountStateMachine::PendingTransfer>($t9, $t11) A1_vector_push_back$A3_AccountStateMachine_PendingTransfer$($t9, $t11) // $t12 := Actor::self() $t12 := A1_Actor_self() @@ -496,17 +496,17 @@ object "A3_AccountStateMachine" { $t5 := this // $t6 := AccountStateMachine::find_xfer($t5, $t1) $t6 := A3_AccountStateMachine_find_xfer($t5, xfer_id) - // $t7 := borrow_field.pending($t0) + // $t7 := borrow_field<0x3::AccountStateMachine::Account>.pending($t0) $t7 := this - // $t8 := vector::borrow($t7, $t6) + // $t8 := vector::borrow<0x3::AccountStateMachine::PendingTransfer>($t7, $t6) $t8 := A1_vector_borrow$A3_AccountStateMachine_PendingTransfer$($t7, $t6) - // $t9 := borrow_field.amount($t8) + // $t9 := borrow_field<0x3::AccountStateMachine::PendingTransfer>.amount($t8) $t9 := $IndexPtr($t8, 24) // $t10 := read_ref($t9) $t10 := $LoadU64($t9) - // $t11 := borrow_field.pending($t0) + // $t11 := borrow_field<0x3::AccountStateMachine::Account>.pending($t0) $t11 := this - // $t12 := vector::remove($t11, $t6) + // $t12 := vector::remove<0x3::AccountStateMachine::PendingTransfer>($t11, $t6) $t12 := A1_vector_remove$A3_AccountStateMachine_PendingTransfer$($t11, $t6) // drop($t12) $Free($t12, 32) @@ -639,7 +639,7 @@ object "A3_AccountStateMachine" { switch $block case 2 { // label L6 - // $t7 := vector::length($t5) + // $t7 := vector::length<0x3::AccountStateMachine::PendingTransfer>($t5) $t7 := A1_vector_length$A3_AccountStateMachine_PendingTransfer$($t5) // $t8 := <($t3, $t7) $t8 := $Lt(i, $t7) @@ -649,7 +649,7 @@ object "A3_AccountStateMachine" { default { $block := 4 } } case 3 { - // $t5 := borrow_field.pending($t0) + // $t5 := borrow_field<0x3::AccountStateMachine::Account>.pending($t0) $t5 := this // $t6 := 0 $t6 := 0 @@ -674,9 +674,9 @@ object "A3_AccountStateMachine" { } case 6 { // label L2 - // $t9 := vector::borrow($t5, $t3) + // $t9 := vector::borrow<0x3::AccountStateMachine::PendingTransfer>($t5, $t3) $t9 := A1_vector_borrow$A3_AccountStateMachine_PendingTransfer$($t5, i) - // $t10 := borrow_field.xfer_id($t9) + // $t10 := borrow_field<0x3::AccountStateMachine::PendingTransfer>.xfer_id($t9) $t10 := $IndexPtr($t9, 16) // $t11 := read_ref($t10) $t11 := $LoadU64($t10) @@ -703,7 +703,7 @@ object "A3_AccountStateMachine" { } case 9 { // label L4 - // $t14 := vector::length($t5) + // $t14 := vector::length<0x3::AccountStateMachine::PendingTransfer>($t5) $t14 := A1_vector_length$A3_AccountStateMachine_PendingTransfer$($t5) // $t15 := <($t3, $t14) $t15 := $Lt(i, $t14) @@ -782,7 +782,7 @@ object "A3_AccountStateMachine" { } function A3_AccountStateMachine_new_xfer_id(this) -> $result { let counter, xfer_id, $t3, $t4, $t5, $t6, $t7 - // $t3 := borrow_field.xfer_id_counter($t0) + // $t3 := borrow_field<0x3::AccountStateMachine::Account>.xfer_id_counter($t0) $t3 := $IndexPtr(this, 40) // $t4 := read_ref($t3) $t4 := $LoadU64($t3) diff --git a/third_party/move/evm/move-to-yul/tests/ConstructorTest.exp b/third_party/move/evm/move-to-yul/tests/ConstructorTest.exp index b51e33ba8fde2..4666b284b3fcd 100644 --- a/third_party/move/evm/move-to-yul/tests/ConstructorTest.exp +++ b/third_party/move/evm/move-to-yul/tests/ConstructorTest.exp @@ -23,14 +23,14 @@ object "A2_ConstructorTest" { mstore($locals, A2_Evm_sign($t3)) // $t4 := borrow_local($t2) $t4 := $MakePtr(false, $locals) - // $t5 := pack ConstructorTest::Balance($t0, $t1) + // $t5 := pack 0x2::ConstructorTest::Balance($t0, $t1) { let $mem := $Malloc(16) $MemoryStoreU64(add($mem, 0), value) $MemoryStoreU64(add($mem, 8), value2) $t5 := $mem } - // move_to($t5, $t4) + // move_to<0x2::ConstructorTest::Balance>($t5, $t4) { let $base_offset := $MakeTypeStorageBase(0, 0x91d9463a, $LoadU256($t4)) if $AlignedStorageLoad($base_offset) { @@ -212,7 +212,7 @@ object "A2_ConstructorTest" { let $t0, $t1, $t2, $t3 // $t0 := 0x42 $t0 := 0x42 - // $t1 := borrow_global($t0) + // $t1 := borrow_global<0x2::ConstructorTest::Balance>($t0) { let $base_offset := $MakeTypeStorageBase(0, 0x91d9463a, $t0) if iszero($AlignedStorageLoad($base_offset)) { @@ -220,7 +220,7 @@ object "A2_ConstructorTest" { } $t1 := $MakePtr(true, add($base_offset, 32)) } - // $t2 := borrow_field.value($t1) + // $t2 := borrow_field<0x2::ConstructorTest::Balance>.value($t1) $t2 := $t1 // $t3 := read_ref($t2) $t3 := $LoadU64($t2) diff --git a/third_party/move/evm/move-to-yul/tests/GlobalVectors.exp b/third_party/move/evm/move-to-yul/tests/GlobalVectors.exp index fcee1e13c2424..12db22c42d0a0 100644 --- a/third_party/move/evm/move-to-yul/tests/GlobalVectors.exp +++ b/third_party/move/evm/move-to-yul/tests/GlobalVectors.exp @@ -93,13 +93,13 @@ object "test_A2_GlobalVectors_test_borrow_mut_global" { $t10 := $MakePtr(false, add($locals, 32)) // $t11 := move($t2) $t11 := mload($locals) - // $t12 := pack GlobalVectors::T($t11) + // $t12 := pack 0x2::GlobalVectors::T($t11) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t11) $t12 := $mem } - // move_to>($t12, $t10) + // move_to<0x2::GlobalVectors::T>($t12, $t10) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $LoadU256($t10)) if $AlignedStorageLoad($base_offset) { @@ -128,7 +128,7 @@ object "test_A2_GlobalVectors_test_borrow_mut_global" { } // $t13 := 0x42 $t13 := 0x42 - // $t14 := borrow_global>($t13) + // $t14 := borrow_global<0x2::GlobalVectors::T>($t13) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t13) if iszero($AlignedStorageLoad($base_offset)) { @@ -136,7 +136,7 @@ object "test_A2_GlobalVectors_test_borrow_mut_global" { } $t14 := $MakePtr(true, add($base_offset, 32)) } - // $t15 := borrow_field>.v($t14) + // $t15 := borrow_field<0x2::GlobalVectors::T>.v($t14) $t15 := $t14 // $t16 := 0 $t16 := 0 @@ -148,7 +148,7 @@ object "test_A2_GlobalVectors_test_borrow_mut_global" { $StoreU64($t17, $t18) // $t19 := 0x42 $t19 := 0x42 - // $t20 := borrow_global>($t19) + // $t20 := borrow_global<0x2::GlobalVectors::T>($t19) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t19) if iszero($AlignedStorageLoad($base_offset)) { @@ -156,7 +156,7 @@ object "test_A2_GlobalVectors_test_borrow_mut_global" { } $t20 := $MakePtr(true, add($base_offset, 32)) } - // $t21 := borrow_field>.v($t20) + // $t21 := borrow_field<0x2::GlobalVectors::T>.v($t20) $t21 := $t20 // $t22 := 0 $t22 := 0 @@ -502,13 +502,13 @@ object "test_A2_GlobalVectors_test_move_from" { $t10 := $MakePtr(false, add($locals, 32)) // $t11 := move($t1) $t11 := mload($locals) - // $t12 := pack GlobalVectors::T($t11) + // $t12 := pack 0x2::GlobalVectors::T($t11) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t11) $t12 := $mem } - // move_to>($t12, $t10) + // move_to<0x2::GlobalVectors::T>($t12, $t10) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $LoadU256($t10)) if $AlignedStorageLoad($base_offset) { @@ -537,7 +537,7 @@ object "test_A2_GlobalVectors_test_move_from" { } // $t13 := 0x42 $t13 := 0x42 - // $t14 := move_from>($t13) + // $t14 := move_from<0x2::GlobalVectors::T>($t13) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t13) if iszero($AlignedStorageLoad($base_offset)) { @@ -569,7 +569,7 @@ object "test_A2_GlobalVectors_test_move_from" { $t14 := $dst } } - // $t2 := unpack GlobalVectors::T($t14) + // $t2 := unpack 0x2::GlobalVectors::T($t14) mstore(add($locals, 64), $MemoryLoadU256(add($t14, 0))) $Free($t14, 32) // $t15 := borrow_local($t2) @@ -1060,7 +1060,7 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_struct" { $Abort($t25) } case 4 { - // $t2 := vector::empty() + // $t2 := vector::empty<0x2::GlobalVectors::S>() mstore($locals, A1_vector_empty$A2_GlobalVectors_S$()) // $t3 := borrow_local($t2) $t3 := $MakePtr(false, $locals) @@ -1068,14 +1068,14 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_struct" { $t4 := 10 // $t5 := 40 $t5 := 40 - // $t6 := pack GlobalVectors::S($t4, $t5) + // $t6 := pack 0x2::GlobalVectors::S($t4, $t5) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t4) $MemoryStoreU64(add($mem, 16), $t5) $t6 := $mem } - // vector::push_back($t3, $t6) + // vector::push_back<0x2::GlobalVectors::S>($t3, $t6) A1_vector_push_back$A2_GlobalVectors_S$($t3, $t6) // $t7 := borrow_local($t2) $t7 := $MakePtr(false, $locals) @@ -1083,14 +1083,14 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_struct" { $t8 := 11 // $t9 := 41 $t9 := 41 - // $t10 := pack GlobalVectors::S($t8, $t9) + // $t10 := pack 0x2::GlobalVectors::S($t8, $t9) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t8) $MemoryStoreU64(add($mem, 16), $t9) $t10 := $mem } - // vector::push_back($t7, $t10) + // vector::push_back<0x2::GlobalVectors::S>($t7, $t10) A1_vector_push_back$A2_GlobalVectors_S$($t7, $t10) // $t11 := borrow_local($t2) $t11 := $MakePtr(false, $locals) @@ -1098,14 +1098,14 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_struct" { $t12 := 12 // $t13 := 42 $t13 := 42 - // $t14 := pack GlobalVectors::S($t12, $t13) + // $t14 := pack 0x2::GlobalVectors::S($t12, $t13) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t12) $MemoryStoreU64(add($mem, 16), $t13) $t14 := $mem } - // vector::push_back($t11, $t14) + // vector::push_back<0x2::GlobalVectors::S>($t11, $t14) A1_vector_push_back$A2_GlobalVectors_S$($t11, $t14) // $t15 := 0x42 $t15 := 0x42 @@ -1115,13 +1115,13 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_struct" { $t16 := $MakePtr(false, add($locals, 32)) // $t17 := move($t2) $t17 := mload($locals) - // $t18 := pack GlobalVectors::T($t17) + // $t18 := pack 0x2::GlobalVectors::T<0x2::GlobalVectors::S>($t17) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t17) $t18 := $mem } - // move_to>($t18, $t16) + // move_to<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t18, $t16) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $LoadU256($t16)) if $AlignedStorageLoad($base_offset) { @@ -1156,7 +1156,7 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_struct" { } // $t19 := 0x42 $t19 := 0x42 - // $t1 := move_from>($t19) + // $t1 := move_from<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t19) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t19) if iszero($AlignedStorageLoad($base_offset)) { @@ -1197,9 +1197,9 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_struct" { } // $t20 := borrow_local($t1) $t20 := $MakePtr(false, local_t) - // $t21 := borrow_field>.v($t20) + // $t21 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t20) $t21 := $t20 - // $t22 := vector::length($t21) + // $t22 := vector::length<0x2::GlobalVectors::S>($t21) $t22 := A1_vector_length$A2_GlobalVectors_S$($t21) // $t23 := 3 $t23 := 3 @@ -1214,13 +1214,13 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_struct" { // label L2 // $t26 := borrow_local($t1) $t26 := $MakePtr(false, local_t) - // $t27 := borrow_field>.v($t26) + // $t27 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t26) $t27 := $t26 // $t28 := 0 $t28 := 0 - // $t29 := vector::borrow($t27, $t28) + // $t29 := vector::borrow<0x2::GlobalVectors::S>($t27, $t28) $t29 := A1_vector_borrow$A2_GlobalVectors_S$($t27, $t28) - // $t30 := borrow_field.x($t29) + // $t30 := borrow_field<0x2::GlobalVectors::S>.x($t29) $t30 := $t29 // $t31 := read_ref($t30) $t31 := $LoadU128($t30) @@ -1249,13 +1249,13 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_struct" { // label L5 // $t35 := borrow_local($t1) $t35 := $MakePtr(false, local_t) - // $t36 := borrow_field>.v($t35) + // $t36 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t35) $t36 := $t35 // $t37 := 1 $t37 := 1 - // $t38 := vector::borrow($t36, $t37) + // $t38 := vector::borrow<0x2::GlobalVectors::S>($t36, $t37) $t38 := A1_vector_borrow$A2_GlobalVectors_S$($t36, $t37) - // $t39 := borrow_field.x($t38) + // $t39 := borrow_field<0x2::GlobalVectors::S>.x($t38) $t39 := $t38 // $t40 := read_ref($t39) $t40 := $LoadU128($t39) @@ -1284,13 +1284,13 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_struct" { // label L8 // $t44 := borrow_local($t1) $t44 := $MakePtr(false, local_t) - // $t45 := borrow_field>.v($t44) + // $t45 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t44) $t45 := $t44 // $t46 := 2 $t46 := 2 - // $t47 := vector::borrow($t45, $t46) + // $t47 := vector::borrow<0x2::GlobalVectors::S>($t45, $t46) $t47 := A1_vector_borrow$A2_GlobalVectors_S$($t45, $t46) - // $t48 := borrow_field.x($t47) + // $t48 := borrow_field<0x2::GlobalVectors::S>.x($t47) $t48 := $t47 // $t49 := read_ref($t48) $t49 := $LoadU128($t48) @@ -1685,13 +1685,13 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_vector" { $t13 := $MakePtr(false, add($locals, 32)) // $t14 := move($t2) $t14 := mload($locals) - // $t15 := pack GlobalVectors::T>($t14) + // $t15 := pack 0x2::GlobalVectors::T>($t14) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t14) $t15 := $mem } - // move_to>>($t15, $t13) + // move_to<0x2::GlobalVectors::T>>($t15, $t13) { let $base_offset := $MakeTypeStorageBase(0, 0x9947b477, $LoadU256($t13)) if $AlignedStorageLoad($base_offset) { @@ -1733,7 +1733,7 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_vector" { } // $t16 := 0x42 $t16 := 0x42 - // $t1 := move_from>>($t16) + // $t1 := move_from<0x2::GlobalVectors::T>>($t16) { let $base_offset := $MakeTypeStorageBase(0, 0x9947b477, $t16) if iszero($AlignedStorageLoad($base_offset)) { @@ -1783,7 +1783,7 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_vector" { } // $t17 := borrow_local($t1) $t17 := $MakePtr(false, local_t) - // $t18 := borrow_field>>.v($t17) + // $t18 := borrow_field<0x2::GlobalVectors::T>>.v($t17) $t18 := $t17 // $t19 := vector::length>($t18) $t19 := A1_vector_length$vec$u64$$($t18) @@ -1800,7 +1800,7 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_vector" { // label L2 // $t23 := borrow_local($t1) $t23 := $MakePtr(false, local_t) - // $t24 := borrow_field>>.v($t23) + // $t24 := borrow_field<0x2::GlobalVectors::T>>.v($t23) $t24 := $t23 // $t25 := 0 $t25 := 0 @@ -1837,7 +1837,7 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_vector" { // label L5 // $t33 := borrow_local($t1) $t33 := $MakePtr(false, local_t) - // $t34 := borrow_field>>.v($t33) + // $t34 := borrow_field<0x2::GlobalVectors::T>>.v($t33) $t34 := $t33 // $t35 := 1 $t35 := 1 @@ -1874,7 +1874,7 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_vector" { // label L8 // $t43 := borrow_local($t1) $t43 := $MakePtr(false, local_t) - // $t44 := borrow_field>>.v($t43) + // $t44 := borrow_field<0x2::GlobalVectors::T>>.v($t43) $t44 := $t43 // $t45 := 2 $t45 := 2 @@ -2298,13 +2298,13 @@ object "test_A2_GlobalVectors_test_move_to" { $t9 := $MakePtr(false, add($locals, 32)) // $t10 := move($t1) $t10 := mload($locals) - // $t11 := pack GlobalVectors::T($t10) + // $t11 := pack 0x2::GlobalVectors::T($t10) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t10) $t11 := $mem } - // move_to>($t11, $t9) + // move_to<0x2::GlobalVectors::T>($t11, $t9) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $LoadU256($t9)) if $AlignedStorageLoad($base_offset) { @@ -2333,7 +2333,7 @@ object "test_A2_GlobalVectors_test_move_to" { } // $t12 := 0x42 $t12 := 0x42 - // $t13 := borrow_global>($t12) + // $t13 := borrow_global<0x2::GlobalVectors::T>($t12) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t12) if iszero($AlignedStorageLoad($base_offset)) { @@ -2341,7 +2341,7 @@ object "test_A2_GlobalVectors_test_move_to" { } $t13 := $MakePtr(true, add($base_offset, 32)) } - // $t14 := borrow_field>.v($t13) + // $t14 := borrow_field<0x2::GlobalVectors::T>.v($t13) $t14 := $t13 // $t15 := vector::length($t14) $t15 := A1_vector_length$u64$($t14) @@ -2358,7 +2358,7 @@ object "test_A2_GlobalVectors_test_move_to" { // label L2 // $t19 := 0x42 $t19 := 0x42 - // $t20 := borrow_global>($t19) + // $t20 := borrow_global<0x2::GlobalVectors::T>($t19) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t19) if iszero($AlignedStorageLoad($base_offset)) { @@ -2366,7 +2366,7 @@ object "test_A2_GlobalVectors_test_move_to" { } $t20 := $MakePtr(true, add($base_offset, 32)) } - // $t21 := borrow_field>.v($t20) + // $t21 := borrow_field<0x2::GlobalVectors::T>.v($t20) $t21 := $t20 // $t22 := 0 $t22 := 0 @@ -2399,7 +2399,7 @@ object "test_A2_GlobalVectors_test_move_to" { // label L5 // $t28 := 0x42 $t28 := 0x42 - // $t29 := borrow_global>($t28) + // $t29 := borrow_global<0x2::GlobalVectors::T>($t28) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t28) if iszero($AlignedStorageLoad($base_offset)) { @@ -2407,7 +2407,7 @@ object "test_A2_GlobalVectors_test_move_to" { } $t29 := $MakePtr(true, add($base_offset, 32)) } - // $t30 := borrow_field>.v($t29) + // $t30 := borrow_field<0x2::GlobalVectors::T>.v($t29) $t30 := $t29 // $t31 := 1 $t31 := 1 @@ -2440,7 +2440,7 @@ object "test_A2_GlobalVectors_test_move_to" { // label L8 // $t37 := 0x42 $t37 := 0x42 - // $t38 := borrow_global>($t37) + // $t38 := borrow_global<0x2::GlobalVectors::T>($t37) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t37) if iszero($AlignedStorageLoad($base_offset)) { @@ -2448,7 +2448,7 @@ object "test_A2_GlobalVectors_test_move_to" { } $t38 := $MakePtr(true, add($base_offset, 32)) } - // $t39 := borrow_field>.v($t38) + // $t39 := borrow_field<0x2::GlobalVectors::T>.v($t38) $t39 := $t38 // $t40 := 2 $t40 := 2 @@ -2776,7 +2776,7 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_struct" { $Abort($t24) } case 4 { - // $t1 := vector::empty() + // $t1 := vector::empty<0x2::GlobalVectors::S>() mstore($locals, A1_vector_empty$A2_GlobalVectors_S$()) // $t2 := borrow_local($t1) $t2 := $MakePtr(false, $locals) @@ -2784,14 +2784,14 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_struct" { $t3 := 10 // $t4 := 40 $t4 := 40 - // $t5 := pack GlobalVectors::S($t3, $t4) + // $t5 := pack 0x2::GlobalVectors::S($t3, $t4) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t3) $MemoryStoreU64(add($mem, 16), $t4) $t5 := $mem } - // vector::push_back($t2, $t5) + // vector::push_back<0x2::GlobalVectors::S>($t2, $t5) A1_vector_push_back$A2_GlobalVectors_S$($t2, $t5) // $t6 := borrow_local($t1) $t6 := $MakePtr(false, $locals) @@ -2799,14 +2799,14 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_struct" { $t7 := 11 // $t8 := 41 $t8 := 41 - // $t9 := pack GlobalVectors::S($t7, $t8) + // $t9 := pack 0x2::GlobalVectors::S($t7, $t8) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t7) $MemoryStoreU64(add($mem, 16), $t8) $t9 := $mem } - // vector::push_back($t6, $t9) + // vector::push_back<0x2::GlobalVectors::S>($t6, $t9) A1_vector_push_back$A2_GlobalVectors_S$($t6, $t9) // $t10 := borrow_local($t1) $t10 := $MakePtr(false, $locals) @@ -2814,14 +2814,14 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_struct" { $t11 := 12 // $t12 := 42 $t12 := 42 - // $t13 := pack GlobalVectors::S($t11, $t12) + // $t13 := pack 0x2::GlobalVectors::S($t11, $t12) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t11) $MemoryStoreU64(add($mem, 16), $t12) $t13 := $mem } - // vector::push_back($t10, $t13) + // vector::push_back<0x2::GlobalVectors::S>($t10, $t13) A1_vector_push_back$A2_GlobalVectors_S$($t10, $t13) // $t14 := 0x42 $t14 := 0x42 @@ -2831,13 +2831,13 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_struct" { $t15 := $MakePtr(false, add($locals, 32)) // $t16 := move($t1) $t16 := mload($locals) - // $t17 := pack GlobalVectors::T($t16) + // $t17 := pack 0x2::GlobalVectors::T<0x2::GlobalVectors::S>($t16) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t16) $t17 := $mem } - // move_to>($t17, $t15) + // move_to<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t17, $t15) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $LoadU256($t15)) if $AlignedStorageLoad($base_offset) { @@ -2872,7 +2872,7 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_struct" { } // $t18 := 0x42 $t18 := 0x42 - // $t19 := borrow_global>($t18) + // $t19 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t18) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t18) if iszero($AlignedStorageLoad($base_offset)) { @@ -2880,9 +2880,9 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_struct" { } $t19 := $MakePtr(true, add($base_offset, 32)) } - // $t20 := borrow_field>.v($t19) + // $t20 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t19) $t20 := $t19 - // $t21 := vector::length($t20) + // $t21 := vector::length<0x2::GlobalVectors::S>($t20) $t21 := A1_vector_length$A2_GlobalVectors_S$($t20) // $t22 := 3 $t22 := 3 @@ -2897,7 +2897,7 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_struct" { // label L2 // $t25 := 0x42 $t25 := 0x42 - // $t26 := borrow_global>($t25) + // $t26 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t25) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t25) if iszero($AlignedStorageLoad($base_offset)) { @@ -2905,13 +2905,13 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_struct" { } $t26 := $MakePtr(true, add($base_offset, 32)) } - // $t27 := borrow_field>.v($t26) + // $t27 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t26) $t27 := $t26 // $t28 := 0 $t28 := 0 - // $t29 := vector::borrow($t27, $t28) + // $t29 := vector::borrow<0x2::GlobalVectors::S>($t27, $t28) $t29 := A1_vector_borrow$A2_GlobalVectors_S$($t27, $t28) - // $t30 := borrow_field.x($t29) + // $t30 := borrow_field<0x2::GlobalVectors::S>.x($t29) $t30 := $t29 // $t31 := read_ref($t30) $t31 := $LoadU128($t30) @@ -2940,7 +2940,7 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_struct" { // label L5 // $t35 := 0x42 $t35 := 0x42 - // $t36 := borrow_global>($t35) + // $t36 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t35) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t35) if iszero($AlignedStorageLoad($base_offset)) { @@ -2948,13 +2948,13 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_struct" { } $t36 := $MakePtr(true, add($base_offset, 32)) } - // $t37 := borrow_field>.v($t36) + // $t37 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t36) $t37 := $t36 // $t38 := 1 $t38 := 1 - // $t39 := vector::borrow($t37, $t38) + // $t39 := vector::borrow<0x2::GlobalVectors::S>($t37, $t38) $t39 := A1_vector_borrow$A2_GlobalVectors_S$($t37, $t38) - // $t40 := borrow_field.x($t39) + // $t40 := borrow_field<0x2::GlobalVectors::S>.x($t39) $t40 := $t39 // $t41 := read_ref($t40) $t41 := $LoadU128($t40) @@ -2983,7 +2983,7 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_struct" { // label L8 // $t45 := 0x42 $t45 := 0x42 - // $t46 := borrow_global>($t45) + // $t46 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t45) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t45) if iszero($AlignedStorageLoad($base_offset)) { @@ -2991,13 +2991,13 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_struct" { } $t46 := $MakePtr(true, add($base_offset, 32)) } - // $t47 := borrow_field>.v($t46) + // $t47 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t46) $t47 := $t46 // $t48 := 2 $t48 := 2 - // $t49 := vector::borrow($t47, $t48) + // $t49 := vector::borrow<0x2::GlobalVectors::S>($t47, $t48) $t49 := A1_vector_borrow$A2_GlobalVectors_S$($t47, $t48) - // $t50 := borrow_field.x($t49) + // $t50 := borrow_field<0x2::GlobalVectors::S>.x($t49) $t50 := $t49 // $t51 := read_ref($t50) $t51 := $LoadU128($t50) @@ -3383,13 +3383,13 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_vector" { $t12 := $MakePtr(false, add($locals, 32)) // $t13 := move($t1) $t13 := mload($locals) - // $t14 := pack GlobalVectors::T>($t13) + // $t14 := pack 0x2::GlobalVectors::T>($t13) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t13) $t14 := $mem } - // move_to>>($t14, $t12) + // move_to<0x2::GlobalVectors::T>>($t14, $t12) { let $base_offset := $MakeTypeStorageBase(0, 0x9947b477, $LoadU256($t12)) if $AlignedStorageLoad($base_offset) { @@ -3431,7 +3431,7 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_vector" { } // $t15 := 0x42 $t15 := 0x42 - // $t16 := borrow_global>>($t15) + // $t16 := borrow_global<0x2::GlobalVectors::T>>($t15) { let $base_offset := $MakeTypeStorageBase(0, 0x9947b477, $t15) if iszero($AlignedStorageLoad($base_offset)) { @@ -3439,7 +3439,7 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_vector" { } $t16 := $MakePtr(true, add($base_offset, 32)) } - // $t17 := borrow_field>>.v($t16) + // $t17 := borrow_field<0x2::GlobalVectors::T>>.v($t16) $t17 := $t16 // $t18 := vector::length>($t17) $t18 := A1_vector_length$vec$u64$$($t17) @@ -3456,7 +3456,7 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_vector" { // label L2 // $t22 := 0x42 $t22 := 0x42 - // $t23 := borrow_global>>($t22) + // $t23 := borrow_global<0x2::GlobalVectors::T>>($t22) { let $base_offset := $MakeTypeStorageBase(0, 0x9947b477, $t22) if iszero($AlignedStorageLoad($base_offset)) { @@ -3464,7 +3464,7 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_vector" { } $t23 := $MakePtr(true, add($base_offset, 32)) } - // $t24 := borrow_field>>.v($t23) + // $t24 := borrow_field<0x2::GlobalVectors::T>>.v($t23) $t24 := $t23 // $t25 := 0 $t25 := 0 @@ -3501,7 +3501,7 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_vector" { // label L5 // $t33 := 0x42 $t33 := 0x42 - // $t34 := borrow_global>>($t33) + // $t34 := borrow_global<0x2::GlobalVectors::T>>($t33) { let $base_offset := $MakeTypeStorageBase(0, 0x9947b477, $t33) if iszero($AlignedStorageLoad($base_offset)) { @@ -3509,7 +3509,7 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_vector" { } $t34 := $MakePtr(true, add($base_offset, 32)) } - // $t35 := borrow_field>>.v($t34) + // $t35 := borrow_field<0x2::GlobalVectors::T>>.v($t34) $t35 := $t34 // $t36 := 1 $t36 := 1 @@ -3546,7 +3546,7 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_vector" { // label L8 // $t44 := 0x42 $t44 := 0x42 - // $t45 := borrow_global>>($t44) + // $t45 := borrow_global<0x2::GlobalVectors::T>>($t44) { let $base_offset := $MakeTypeStorageBase(0, 0x9947b477, $t44) if iszero($AlignedStorageLoad($base_offset)) { @@ -3554,7 +3554,7 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_vector" { } $t45 := $MakePtr(true, add($base_offset, 32)) } - // $t46 := borrow_field>>.v($t45) + // $t46 := borrow_field<0x2::GlobalVectors::T>>.v($t45) $t46 := $t45 // $t47 := 2 $t47 := 2 @@ -3969,13 +3969,13 @@ object "test_A2_GlobalVectors_test_pop_back_global" { $t9 := $MakePtr(false, add($locals, 32)) // $t10 := move($t1) $t10 := mload($locals) - // $t11 := pack GlobalVectors::T($t10) + // $t11 := pack 0x2::GlobalVectors::T($t10) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t10) $t11 := $mem } - // move_to>($t11, $t9) + // move_to<0x2::GlobalVectors::T>($t11, $t9) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $LoadU256($t9)) if $AlignedStorageLoad($base_offset) { @@ -4004,7 +4004,7 @@ object "test_A2_GlobalVectors_test_pop_back_global" { } // $t12 := 0x42 $t12 := 0x42 - // $t13 := borrow_global>($t12) + // $t13 := borrow_global<0x2::GlobalVectors::T>($t12) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t12) if iszero($AlignedStorageLoad($base_offset)) { @@ -4012,7 +4012,7 @@ object "test_A2_GlobalVectors_test_pop_back_global" { } $t13 := $MakePtr(true, add($base_offset, 32)) } - // $t14 := borrow_field>.v($t13) + // $t14 := borrow_field<0x2::GlobalVectors::T>.v($t13) $t14 := $t13 // $t15 := vector::pop_back($t14) $t15 := A1_vector_pop_back$u64$($t14) @@ -4029,7 +4029,7 @@ object "test_A2_GlobalVectors_test_pop_back_global" { // label L2 // $t19 := 0x42 $t19 := 0x42 - // $t20 := borrow_global>($t19) + // $t20 := borrow_global<0x2::GlobalVectors::T>($t19) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t19) if iszero($AlignedStorageLoad($base_offset)) { @@ -4037,7 +4037,7 @@ object "test_A2_GlobalVectors_test_pop_back_global" { } $t20 := $MakePtr(true, add($base_offset, 32)) } - // $t21 := borrow_field>.v($t20) + // $t21 := borrow_field<0x2::GlobalVectors::T>.v($t20) $t21 := $t20 // $t22 := vector::length($t21) $t22 := A1_vector_length$u64$($t21) @@ -4066,7 +4066,7 @@ object "test_A2_GlobalVectors_test_pop_back_global" { // label L5 // $t26 := 0x42 $t26 := 0x42 - // $t27 := borrow_global>($t26) + // $t27 := borrow_global<0x2::GlobalVectors::T>($t26) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t26) if iszero($AlignedStorageLoad($base_offset)) { @@ -4074,7 +4074,7 @@ object "test_A2_GlobalVectors_test_pop_back_global" { } $t27 := $MakePtr(true, add($base_offset, 32)) } - // $t28 := borrow_field>.v($t27) + // $t28 := borrow_field<0x2::GlobalVectors::T>.v($t27) $t28 := $t27 // $t29 := vector::pop_back($t28) $t29 := A1_vector_pop_back$u64$($t28) @@ -4103,7 +4103,7 @@ object "test_A2_GlobalVectors_test_pop_back_global" { // label L8 // $t33 := 0x42 $t33 := 0x42 - // $t34 := borrow_global>($t33) + // $t34 := borrow_global<0x2::GlobalVectors::T>($t33) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t33) if iszero($AlignedStorageLoad($base_offset)) { @@ -4111,7 +4111,7 @@ object "test_A2_GlobalVectors_test_pop_back_global" { } $t34 := $MakePtr(true, add($base_offset, 32)) } - // $t35 := borrow_field>.v($t34) + // $t35 := borrow_field<0x2::GlobalVectors::T>.v($t34) $t35 := $t34 // $t36 := vector::length($t35) $t36 := A1_vector_length$u64$($t35) @@ -4425,7 +4425,7 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { // label L1 // $t29 := borrow_local($t3) $t29 := $MakePtr(false, e) - // $t30 := borrow_field.y($t29) + // $t30 := borrow_field<0x2::GlobalVectors::S>.y($t29) $t30 := $IndexPtr($t29, 16) // $t31 := read_ref($t30) $t31 := $LoadU64($t30) @@ -4446,7 +4446,7 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { $block := 5 } case 4 { - // $t4 := vector::empty() + // $t4 := vector::empty<0x2::GlobalVectors::S>() mstore($locals, A1_vector_empty$A2_GlobalVectors_S$()) // $t5 := borrow_local($t4) $t5 := $MakePtr(false, $locals) @@ -4454,14 +4454,14 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { $t6 := 10 // $t7 := 40 $t7 := 40 - // $t8 := pack GlobalVectors::S($t6, $t7) + // $t8 := pack 0x2::GlobalVectors::S($t6, $t7) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t6) $MemoryStoreU64(add($mem, 16), $t7) $t8 := $mem } - // vector::push_back($t5, $t8) + // vector::push_back<0x2::GlobalVectors::S>($t5, $t8) A1_vector_push_back$A2_GlobalVectors_S$($t5, $t8) // $t9 := borrow_local($t4) $t9 := $MakePtr(false, $locals) @@ -4469,14 +4469,14 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { $t10 := 11 // $t11 := 41 $t11 := 41 - // $t12 := pack GlobalVectors::S($t10, $t11) + // $t12 := pack 0x2::GlobalVectors::S($t10, $t11) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t10) $MemoryStoreU64(add($mem, 16), $t11) $t12 := $mem } - // vector::push_back($t9, $t12) + // vector::push_back<0x2::GlobalVectors::S>($t9, $t12) A1_vector_push_back$A2_GlobalVectors_S$($t9, $t12) // $t13 := borrow_local($t4) $t13 := $MakePtr(false, $locals) @@ -4484,14 +4484,14 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { $t14 := 12 // $t15 := 42 $t15 := 42 - // $t16 := pack GlobalVectors::S($t14, $t15) + // $t16 := pack 0x2::GlobalVectors::S($t14, $t15) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t14) $MemoryStoreU64(add($mem, 16), $t15) $t16 := $mem } - // vector::push_back($t13, $t16) + // vector::push_back<0x2::GlobalVectors::S>($t13, $t16) A1_vector_push_back$A2_GlobalVectors_S$($t13, $t16) // $t17 := 0x42 $t17 := 0x42 @@ -4501,13 +4501,13 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { $t18 := $MakePtr(false, add($locals, 32)) // $t19 := move($t4) $t19 := mload($locals) - // $t20 := pack GlobalVectors::T($t19) + // $t20 := pack 0x2::GlobalVectors::T<0x2::GlobalVectors::S>($t19) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t19) $t20 := $mem } - // move_to>($t20, $t18) + // move_to<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t20, $t18) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $LoadU256($t18)) if $AlignedStorageLoad($base_offset) { @@ -4542,7 +4542,7 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { } // $t21 := 0x42 $t21 := 0x42 - // $t22 := borrow_global>($t21) + // $t22 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t21) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t21) if iszero($AlignedStorageLoad($base_offset)) { @@ -4550,13 +4550,13 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { } $t22 := $MakePtr(true, add($base_offset, 32)) } - // $t23 := borrow_field>.v($t22) + // $t23 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t22) $t23 := $t22 - // $t3 := vector::pop_back($t23) + // $t3 := vector::pop_back<0x2::GlobalVectors::S>($t23) e := A1_vector_pop_back$A2_GlobalVectors_S$($t23) // $t24 := borrow_local($t3) $t24 := $MakePtr(false, e) - // $t25 := borrow_field.x($t24) + // $t25 := borrow_field<0x2::GlobalVectors::S>.x($t24) $t25 := $t24 // $t26 := read_ref($t25) $t26 := $LoadU128($t25) @@ -4592,7 +4592,7 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { // label L5 // $t35 := 0x42 $t35 := 0x42 - // $t36 := borrow_global>($t35) + // $t36 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t35) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t35) if iszero($AlignedStorageLoad($base_offset)) { @@ -4600,9 +4600,9 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { } $t36 := $MakePtr(true, add($base_offset, 32)) } - // $t37 := borrow_field>.v($t36) + // $t37 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t36) $t37 := $t36 - // $t38 := vector::length($t37) + // $t38 := vector::length<0x2::GlobalVectors::S>($t37) $t38 := A1_vector_length$A2_GlobalVectors_S$($t37) // $t39 := 2 $t39 := 2 @@ -4629,7 +4629,7 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { // label L8 // $t42 := 0x42 $t42 := 0x42 - // $t43 := borrow_global>($t42) + // $t43 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t42) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t42) if iszero($AlignedStorageLoad($base_offset)) { @@ -4637,13 +4637,13 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { } $t43 := $MakePtr(true, add($base_offset, 32)) } - // $t44 := borrow_field>.v($t43) + // $t44 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t43) $t44 := $t43 - // $t3 := vector::pop_back($t44) + // $t3 := vector::pop_back<0x2::GlobalVectors::S>($t44) e := A1_vector_pop_back$A2_GlobalVectors_S$($t44) // $t45 := borrow_local($t3) $t45 := $MakePtr(false, e) - // $t46 := borrow_field.x($t45) + // $t46 := borrow_field<0x2::GlobalVectors::S>.x($t45) $t46 := $t45 // $t47 := read_ref($t46) $t47 := $LoadU128($t46) @@ -4660,7 +4660,7 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { // label L10 // $t50 := borrow_local($t3) $t50 := $MakePtr(false, e) - // $t51 := borrow_field.y($t50) + // $t51 := borrow_field<0x2::GlobalVectors::S>.y($t50) $t51 := $IndexPtr($t50, 16) // $t52 := read_ref($t51) $t52 := $LoadU64($t51) @@ -4703,7 +4703,7 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { // label L14 // $t56 := 0x42 $t56 := 0x42 - // $t57 := borrow_global>($t56) + // $t57 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t56) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t56) if iszero($AlignedStorageLoad($base_offset)) { @@ -4711,9 +4711,9 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { } $t57 := $MakePtr(true, add($base_offset, 32)) } - // $t58 := borrow_field>.v($t57) + // $t58 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t57) $t58 := $t57 - // $t59 := vector::length($t58) + // $t59 := vector::length<0x2::GlobalVectors::S>($t58) $t59 := A1_vector_length$A2_GlobalVectors_S$($t58) // $t60 := 1 $t60 := 1 @@ -5096,13 +5096,13 @@ object "test_A2_GlobalVectors_test_push_back_global" { $t9 := $MakePtr(false, add($locals, 32)) // $t10 := copy($t1) $t10 := mload($locals) - // $t11 := pack GlobalVectors::T($t10) + // $t11 := pack 0x2::GlobalVectors::T($t10) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t10) $t11 := $mem } - // move_to>($t11, $t9) + // move_to<0x2::GlobalVectors::T>($t11, $t9) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $LoadU256($t9)) if $AlignedStorageLoad($base_offset) { @@ -5131,7 +5131,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { } // $t12 := 0x42 $t12 := 0x42 - // $t13 := borrow_global>($t12) + // $t13 := borrow_global<0x2::GlobalVectors::T>($t12) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t12) if iszero($AlignedStorageLoad($base_offset)) { @@ -5139,7 +5139,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { } $t13 := $MakePtr(true, add($base_offset, 32)) } - // $t14 := borrow_field>.v($t13) + // $t14 := borrow_field<0x2::GlobalVectors::T>.v($t13) $t14 := $t13 // $t15 := 13 $t15 := 13 @@ -5147,7 +5147,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { A1_vector_push_back$u64$($t14, $t15) // $t16 := 0x42 $t16 := 0x42 - // $t17 := borrow_global>($t16) + // $t17 := borrow_global<0x2::GlobalVectors::T>($t16) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t16) if iszero($AlignedStorageLoad($base_offset)) { @@ -5155,7 +5155,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { } $t17 := $MakePtr(true, add($base_offset, 32)) } - // $t18 := borrow_field>.v($t17) + // $t18 := borrow_field<0x2::GlobalVectors::T>.v($t17) $t18 := $t17 // $t19 := 14 $t19 := 14 @@ -5163,7 +5163,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { A1_vector_push_back$u64$($t18, $t19) // $t20 := 0x42 $t20 := 0x42 - // $t21 := borrow_global>($t20) + // $t21 := borrow_global<0x2::GlobalVectors::T>($t20) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t20) if iszero($AlignedStorageLoad($base_offset)) { @@ -5171,7 +5171,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { } $t21 := $MakePtr(true, add($base_offset, 32)) } - // $t22 := borrow_field>.v($t21) + // $t22 := borrow_field<0x2::GlobalVectors::T>.v($t21) $t22 := $t21 // $t23 := vector::length($t22) $t23 := A1_vector_length$u64$($t22) @@ -5188,7 +5188,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { // label L2 // $t27 := 0x42 $t27 := 0x42 - // $t28 := borrow_global>($t27) + // $t28 := borrow_global<0x2::GlobalVectors::T>($t27) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t27) if iszero($AlignedStorageLoad($base_offset)) { @@ -5196,7 +5196,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { } $t28 := $MakePtr(true, add($base_offset, 32)) } - // $t29 := borrow_field>.v($t28) + // $t29 := borrow_field<0x2::GlobalVectors::T>.v($t28) $t29 := $t28 // $t30 := 0 $t30 := 0 @@ -5229,7 +5229,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { // label L5 // $t36 := 0x42 $t36 := 0x42 - // $t37 := borrow_global>($t36) + // $t37 := borrow_global<0x2::GlobalVectors::T>($t36) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t36) if iszero($AlignedStorageLoad($base_offset)) { @@ -5237,7 +5237,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { } $t37 := $MakePtr(true, add($base_offset, 32)) } - // $t38 := borrow_field>.v($t37) + // $t38 := borrow_field<0x2::GlobalVectors::T>.v($t37) $t38 := $t37 // $t39 := 1 $t39 := 1 @@ -5270,7 +5270,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { // label L8 // $t45 := 0x42 $t45 := 0x42 - // $t46 := borrow_global>($t45) + // $t46 := borrow_global<0x2::GlobalVectors::T>($t45) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t45) if iszero($AlignedStorageLoad($base_offset)) { @@ -5278,7 +5278,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { } $t46 := $MakePtr(true, add($base_offset, 32)) } - // $t47 := borrow_field>.v($t46) + // $t47 := borrow_field<0x2::GlobalVectors::T>.v($t46) $t47 := $t46 // $t48 := 2 $t48 := 2 @@ -5311,7 +5311,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { // label L11 // $t54 := 0x42 $t54 := 0x42 - // $t55 := borrow_global>($t54) + // $t55 := borrow_global<0x2::GlobalVectors::T>($t54) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t54) if iszero($AlignedStorageLoad($base_offset)) { @@ -5319,7 +5319,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { } $t55 := $MakePtr(true, add($base_offset, 32)) } - // $t56 := borrow_field>.v($t55) + // $t56 := borrow_field<0x2::GlobalVectors::T>.v($t55) $t56 := $t55 // $t57 := 3 $t57 := 3 @@ -5352,7 +5352,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { // label L14 // $t63 := 0x42 $t63 := 0x42 - // $t64 := borrow_global>($t63) + // $t64 := borrow_global<0x2::GlobalVectors::T>($t63) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t63) if iszero($AlignedStorageLoad($base_offset)) { @@ -5360,7 +5360,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { } $t64 := $MakePtr(true, add($base_offset, 32)) } - // $t65 := borrow_field>.v($t64) + // $t65 := borrow_field<0x2::GlobalVectors::T>.v($t64) $t65 := $t64 // $t66 := 4 $t66 := 4 @@ -5688,7 +5688,7 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { $Abort($t36) } case 4 { - // $t1 := vector::empty() + // $t1 := vector::empty<0x2::GlobalVectors::S>() mstore($locals, A1_vector_empty$A2_GlobalVectors_S$()) // $t2 := borrow_local($t1) $t2 := $MakePtr(false, $locals) @@ -5696,14 +5696,14 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { $t3 := 10 // $t4 := 40 $t4 := 40 - // $t5 := pack GlobalVectors::S($t3, $t4) + // $t5 := pack 0x2::GlobalVectors::S($t3, $t4) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t3) $MemoryStoreU64(add($mem, 16), $t4) $t5 := $mem } - // vector::push_back($t2, $t5) + // vector::push_back<0x2::GlobalVectors::S>($t2, $t5) A1_vector_push_back$A2_GlobalVectors_S$($t2, $t5) // $t6 := borrow_local($t1) $t6 := $MakePtr(false, $locals) @@ -5711,14 +5711,14 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { $t7 := 11 // $t8 := 41 $t8 := 41 - // $t9 := pack GlobalVectors::S($t7, $t8) + // $t9 := pack 0x2::GlobalVectors::S($t7, $t8) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t7) $MemoryStoreU64(add($mem, 16), $t8) $t9 := $mem } - // vector::push_back($t6, $t9) + // vector::push_back<0x2::GlobalVectors::S>($t6, $t9) A1_vector_push_back$A2_GlobalVectors_S$($t6, $t9) // $t10 := borrow_local($t1) $t10 := $MakePtr(false, $locals) @@ -5726,14 +5726,14 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { $t11 := 12 // $t12 := 42 $t12 := 42 - // $t13 := pack GlobalVectors::S($t11, $t12) + // $t13 := pack 0x2::GlobalVectors::S($t11, $t12) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t11) $MemoryStoreU64(add($mem, 16), $t12) $t13 := $mem } - // vector::push_back($t10, $t13) + // vector::push_back<0x2::GlobalVectors::S>($t10, $t13) A1_vector_push_back$A2_GlobalVectors_S$($t10, $t13) // $t14 := 0x42 $t14 := 0x42 @@ -5743,13 +5743,13 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { $t15 := $MakePtr(false, add($locals, 32)) // $t16 := move($t1) $t16 := mload($locals) - // $t17 := pack GlobalVectors::T($t16) + // $t17 := pack 0x2::GlobalVectors::T<0x2::GlobalVectors::S>($t16) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t16) $t17 := $mem } - // move_to>($t17, $t15) + // move_to<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t17, $t15) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $LoadU256($t15)) if $AlignedStorageLoad($base_offset) { @@ -5784,7 +5784,7 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { } // $t18 := 0x42 $t18 := 0x42 - // $t19 := borrow_global>($t18) + // $t19 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t18) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t18) if iszero($AlignedStorageLoad($base_offset)) { @@ -5792,24 +5792,24 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { } $t19 := $MakePtr(true, add($base_offset, 32)) } - // $t20 := borrow_field>.v($t19) + // $t20 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t19) $t20 := $t19 // $t21 := 13 $t21 := 13 // $t22 := 43 $t22 := 43 - // $t23 := pack GlobalVectors::S($t21, $t22) + // $t23 := pack 0x2::GlobalVectors::S($t21, $t22) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t21) $MemoryStoreU64(add($mem, 16), $t22) $t23 := $mem } - // vector::push_back($t20, $t23) + // vector::push_back<0x2::GlobalVectors::S>($t20, $t23) A1_vector_push_back$A2_GlobalVectors_S$($t20, $t23) // $t24 := 0x42 $t24 := 0x42 - // $t25 := borrow_global>($t24) + // $t25 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t24) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t24) if iszero($AlignedStorageLoad($base_offset)) { @@ -5817,24 +5817,24 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { } $t25 := $MakePtr(true, add($base_offset, 32)) } - // $t26 := borrow_field>.v($t25) + // $t26 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t25) $t26 := $t25 // $t27 := 14 $t27 := 14 // $t28 := 44 $t28 := 44 - // $t29 := pack GlobalVectors::S($t27, $t28) + // $t29 := pack 0x2::GlobalVectors::S($t27, $t28) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t27) $MemoryStoreU64(add($mem, 16), $t28) $t29 := $mem } - // vector::push_back($t26, $t29) + // vector::push_back<0x2::GlobalVectors::S>($t26, $t29) A1_vector_push_back$A2_GlobalVectors_S$($t26, $t29) // $t30 := 0x42 $t30 := 0x42 - // $t31 := borrow_global>($t30) + // $t31 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t30) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t30) if iszero($AlignedStorageLoad($base_offset)) { @@ -5842,9 +5842,9 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { } $t31 := $MakePtr(true, add($base_offset, 32)) } - // $t32 := borrow_field>.v($t31) + // $t32 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t31) $t32 := $t31 - // $t33 := vector::length($t32) + // $t33 := vector::length<0x2::GlobalVectors::S>($t32) $t33 := A1_vector_length$A2_GlobalVectors_S$($t32) // $t34 := 5 $t34 := 5 @@ -5859,7 +5859,7 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { // label L2 // $t37 := 0x42 $t37 := 0x42 - // $t38 := borrow_global>($t37) + // $t38 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t37) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t37) if iszero($AlignedStorageLoad($base_offset)) { @@ -5867,13 +5867,13 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { } $t38 := $MakePtr(true, add($base_offset, 32)) } - // $t39 := borrow_field>.v($t38) + // $t39 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t38) $t39 := $t38 // $t40 := 0 $t40 := 0 - // $t41 := vector::borrow($t39, $t40) + // $t41 := vector::borrow<0x2::GlobalVectors::S>($t39, $t40) $t41 := A1_vector_borrow$A2_GlobalVectors_S$($t39, $t40) - // $t42 := borrow_field.x($t41) + // $t42 := borrow_field<0x2::GlobalVectors::S>.x($t41) $t42 := $t41 // $t43 := read_ref($t42) $t43 := $LoadU128($t42) @@ -5902,7 +5902,7 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { // label L5 // $t47 := 0x42 $t47 := 0x42 - // $t48 := borrow_global>($t47) + // $t48 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t47) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t47) if iszero($AlignedStorageLoad($base_offset)) { @@ -5910,13 +5910,13 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { } $t48 := $MakePtr(true, add($base_offset, 32)) } - // $t49 := borrow_field>.v($t48) + // $t49 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t48) $t49 := $t48 // $t50 := 1 $t50 := 1 - // $t51 := vector::borrow($t49, $t50) + // $t51 := vector::borrow<0x2::GlobalVectors::S>($t49, $t50) $t51 := A1_vector_borrow$A2_GlobalVectors_S$($t49, $t50) - // $t52 := borrow_field.x($t51) + // $t52 := borrow_field<0x2::GlobalVectors::S>.x($t51) $t52 := $t51 // $t53 := read_ref($t52) $t53 := $LoadU128($t52) @@ -5945,7 +5945,7 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { // label L8 // $t57 := 0x42 $t57 := 0x42 - // $t58 := borrow_global>($t57) + // $t58 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t57) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t57) if iszero($AlignedStorageLoad($base_offset)) { @@ -5953,13 +5953,13 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { } $t58 := $MakePtr(true, add($base_offset, 32)) } - // $t59 := borrow_field>.v($t58) + // $t59 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t58) $t59 := $t58 // $t60 := 2 $t60 := 2 - // $t61 := vector::borrow($t59, $t60) + // $t61 := vector::borrow<0x2::GlobalVectors::S>($t59, $t60) $t61 := A1_vector_borrow$A2_GlobalVectors_S$($t59, $t60) - // $t62 := borrow_field.x($t61) + // $t62 := borrow_field<0x2::GlobalVectors::S>.x($t61) $t62 := $t61 // $t63 := read_ref($t62) $t63 := $LoadU128($t62) @@ -6327,13 +6327,13 @@ object "test_A2_GlobalVectors_test_read_ref_copy" { $t6 := $MakePtr(false, add($locals, 32)) // $t7 := move($t1) $t7 := mload($locals) - // $t8 := pack GlobalVectors::T($t7) + // $t8 := pack 0x2::GlobalVectors::T($t7) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t7) $t8 := $mem } - // move_to>($t8, $t6) + // move_to<0x2::GlobalVectors::T>($t8, $t6) { let $base_offset := $MakeTypeStorageBase(0, 0x10b7746c, $LoadU256($t6)) if $AlignedStorageLoad($base_offset) { @@ -6362,7 +6362,7 @@ object "test_A2_GlobalVectors_test_read_ref_copy" { } // $t9 := 0x42 $t9 := 0x42 - // $t10 := borrow_global>($t9) + // $t10 := borrow_global<0x2::GlobalVectors::T>($t9) { let $base_offset := $MakeTypeStorageBase(0, 0x10b7746c, $t9) if iszero($AlignedStorageLoad($base_offset)) { @@ -6370,7 +6370,7 @@ object "test_A2_GlobalVectors_test_read_ref_copy" { } $t10 := $MakePtr(true, add($base_offset, 32)) } - // $t11 := borrow_field>.v($t10) + // $t11 := borrow_field<0x2::GlobalVectors::T>.v($t10) $t11 := $t10 // $t2 := read_ref($t11) mstore(add($locals, 64), $LoadU256($t11)) @@ -6802,13 +6802,13 @@ object "test_A2_GlobalVectors_test_swap_global" { $t9 := $MakePtr(false, add($locals, 32)) // $t10 := move($t1) $t10 := mload($locals) - // $t11 := pack GlobalVectors::T($t10) + // $t11 := pack 0x2::GlobalVectors::T($t10) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t10) $t11 := $mem } - // move_to>($t11, $t9) + // move_to<0x2::GlobalVectors::T>($t11, $t9) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $LoadU256($t9)) if $AlignedStorageLoad($base_offset) { @@ -6837,7 +6837,7 @@ object "test_A2_GlobalVectors_test_swap_global" { } // $t12 := 0x42 $t12 := 0x42 - // $t13 := borrow_global>($t12) + // $t13 := borrow_global<0x2::GlobalVectors::T>($t12) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t12) if iszero($AlignedStorageLoad($base_offset)) { @@ -6845,7 +6845,7 @@ object "test_A2_GlobalVectors_test_swap_global" { } $t13 := $MakePtr(true, add($base_offset, 32)) } - // $t14 := borrow_field>.v($t13) + // $t14 := borrow_field<0x2::GlobalVectors::T>.v($t13) $t14 := $t13 // $t15 := 0 $t15 := 0 @@ -6855,7 +6855,7 @@ object "test_A2_GlobalVectors_test_swap_global" { A1_vector_swap$u64$($t14, $t15, $t16) // $t17 := 0x42 $t17 := 0x42 - // $t18 := borrow_global>($t17) + // $t18 := borrow_global<0x2::GlobalVectors::T>($t17) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t17) if iszero($AlignedStorageLoad($base_offset)) { @@ -6863,7 +6863,7 @@ object "test_A2_GlobalVectors_test_swap_global" { } $t18 := $MakePtr(true, add($base_offset, 32)) } - // $t19 := borrow_field>.v($t18) + // $t19 := borrow_field<0x2::GlobalVectors::T>.v($t18) $t19 := $t18 // $t20 := vector::length($t19) $t20 := A1_vector_length$u64$($t19) @@ -6880,7 +6880,7 @@ object "test_A2_GlobalVectors_test_swap_global" { // label L2 // $t24 := 0x42 $t24 := 0x42 - // $t25 := borrow_global>($t24) + // $t25 := borrow_global<0x2::GlobalVectors::T>($t24) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t24) if iszero($AlignedStorageLoad($base_offset)) { @@ -6888,7 +6888,7 @@ object "test_A2_GlobalVectors_test_swap_global" { } $t25 := $MakePtr(true, add($base_offset, 32)) } - // $t26 := borrow_field>.v($t25) + // $t26 := borrow_field<0x2::GlobalVectors::T>.v($t25) $t26 := $t25 // $t27 := 0 $t27 := 0 @@ -6921,7 +6921,7 @@ object "test_A2_GlobalVectors_test_swap_global" { // label L5 // $t33 := 0x42 $t33 := 0x42 - // $t34 := borrow_global>($t33) + // $t34 := borrow_global<0x2::GlobalVectors::T>($t33) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t33) if iszero($AlignedStorageLoad($base_offset)) { @@ -6929,7 +6929,7 @@ object "test_A2_GlobalVectors_test_swap_global" { } $t34 := $MakePtr(true, add($base_offset, 32)) } - // $t35 := borrow_field>.v($t34) + // $t35 := borrow_field<0x2::GlobalVectors::T>.v($t34) $t35 := $t34 // $t36 := 1 $t36 := 1 @@ -6962,7 +6962,7 @@ object "test_A2_GlobalVectors_test_swap_global" { // label L8 // $t42 := 0x42 $t42 := 0x42 - // $t43 := borrow_global>($t42) + // $t43 := borrow_global<0x2::GlobalVectors::T>($t42) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t42) if iszero($AlignedStorageLoad($base_offset)) { @@ -6970,7 +6970,7 @@ object "test_A2_GlobalVectors_test_swap_global" { } $t43 := $MakePtr(true, add($base_offset, 32)) } - // $t44 := borrow_field>.v($t43) + // $t44 := borrow_field<0x2::GlobalVectors::T>.v($t43) $t44 := $t43 // $t45 := 2 $t45 := 2 diff --git a/third_party/move/evm/move-to-yul/tests/Resources.exp b/third_party/move/evm/move-to-yul/tests/Resources.exp index e75268ee3b854..d28737892fc66 100644 --- a/third_party/move/evm/move-to-yul/tests/Resources.exp +++ b/third_party/move/evm/move-to-yul/tests/Resources.exp @@ -81,7 +81,7 @@ object "test_A2_M_test_increment_a" { A2_M_increment_a($t4) // $t5 := 0x3 $t5 := 0x3 - // $t6 := borrow_global($t5) + // $t6 := borrow_global<0x2::M::S>($t5) { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $t5) if iszero($AlignedStorageLoad($base_offset)) { @@ -89,7 +89,7 @@ object "test_A2_M_test_increment_a" { } $t6 := $MakePtr(true, add($base_offset, 32)) } - // $t7 := borrow_field.a($t6) + // $t7 := borrow_field<0x2::M::S>.a($t6) $t7 := $IndexPtr($t6, 32) // $t8 := read_ref($t7) $t8 := $LoadU64($t7) @@ -113,7 +113,7 @@ object "test_A2_M_test_increment_a" { function A2_M_increment_a(addr) { let r, $t2, $t3, $t4, $t5, $t6, $t7 - // $t2 := borrow_global($t0) + // $t2 := borrow_global<0x2::M::S>($t0) { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, addr) if iszero($AlignedStorageLoad($base_offset)) { @@ -121,7 +121,7 @@ object "test_A2_M_test_increment_a" { } $t2 := $MakePtr(true, add($base_offset, 32)) } - // $t3 := borrow_field.a($t2) + // $t3 := borrow_field<0x2::M::S>.a($t2) $t3 := $IndexPtr($t2, 32) // $t4 := read_ref($t3) $t4 := $LoadU64($t3) @@ -129,7 +129,7 @@ object "test_A2_M_test_increment_a" { $t5 := 1 // $t6 := +($t4, $t5) $t6 := $AddU64($t4, $t5) - // $t7 := borrow_field.a($t2) + // $t7 := borrow_field<0x2::M::S>.a($t2) $t7 := $IndexPtr($t2, 32) // write_ref($t7, $t6) $StoreU64($t7, $t6) @@ -148,13 +148,13 @@ object "test_A2_M_test_increment_a" { $t6 := $AddU64(a, a) // $t7 := (u128)($t6) $t7 := $CastU128($t6) - // $t8 := pack M::S2($t7) + // $t8 := pack 0x2::M::S2($t7) { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), $t7) $t8 := $mem } - // $t9 := pack M::S($t1, $t5, $t8) + // $t9 := pack 0x2::M::S($t1, $t5, $t8) { let $mem := $Malloc(41) $MemoryStoreU64(add($mem, 32), a) @@ -162,7 +162,7 @@ object "test_A2_M_test_increment_a" { $MemoryStoreU256(add($mem, 0), $t8) $t9 := $mem } - // move_to($t9, $t0) + // move_to<0x2::M::S>($t9, $t0) { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $LoadU256(sg)) if $AlignedStorageLoad($base_offset) { @@ -441,7 +441,7 @@ object "test_A2_M_test_publish" { A2_M_publish($t2, $t3) // $t4 := 0x3 $t4 := 0x3 - // $t5 := exists($t4) + // $t5 := exists<0x2::M::S>($t4) $t5 := $AlignedStorageLoad($MakeTypeStorageBase(0, 0x698265eb, $t4)) // if ($t5) goto L1 else goto L0 switch $t5 @@ -452,7 +452,7 @@ object "test_A2_M_test_publish" { // label L2 // $t7 := 0x3 $t7 := 0x3 - // $t8 := borrow_global($t7) + // $t8 := borrow_global<0x2::M::S>($t7) { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $t7) if iszero($AlignedStorageLoad($base_offset)) { @@ -460,7 +460,7 @@ object "test_A2_M_test_publish" { } $t8 := $MakePtr(true, add($base_offset, 32)) } - // $t9 := borrow_field.a($t8) + // $t9 := borrow_field<0x2::M::S>.a($t8) $t9 := $IndexPtr($t8, 32) // $t10 := read_ref($t9) $t10 := $LoadU64($t9) @@ -489,7 +489,7 @@ object "test_A2_M_test_publish" { // label L5 // $t14 := 0x3 $t14 := 0x3 - // $t15 := borrow_global($t14) + // $t15 := borrow_global<0x2::M::S>($t14) { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $t14) if iszero($AlignedStorageLoad($base_offset)) { @@ -497,7 +497,7 @@ object "test_A2_M_test_publish" { } $t15 := $MakePtr(true, add($base_offset, 32)) } - // $t16 := borrow_field.b($t15) + // $t16 := borrow_field<0x2::M::S>.b($t15) $t16 := $IndexPtr($t15, 40) // $t17 := read_ref($t16) $t17 := $LoadU8($t16) @@ -526,7 +526,7 @@ object "test_A2_M_test_publish" { // label L8 // $t21 := 0x3 $t21 := 0x3 - // $t22 := borrow_global($t21) + // $t22 := borrow_global<0x2::M::S>($t21) { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $t21) if iszero($AlignedStorageLoad($base_offset)) { @@ -534,11 +534,11 @@ object "test_A2_M_test_publish" { } $t22 := $MakePtr(true, add($base_offset, 32)) } - // $t23 := borrow_field.c($t22) + // $t23 := borrow_field<0x2::M::S>.c($t22) { $t23 := $MakePtr($IsStoragePtr($t22), $LoadU256($t22)) } - // $t24 := borrow_field.x($t23) + // $t24 := borrow_field<0x2::M::S2>.x($t23) $t24 := $t23 // $t25 := read_ref($t24) $t25 := $LoadU128($t24) @@ -584,13 +584,13 @@ object "test_A2_M_test_publish" { $t6 := $AddU64(a, a) // $t7 := (u128)($t6) $t7 := $CastU128($t6) - // $t8 := pack M::S2($t7) + // $t8 := pack 0x2::M::S2($t7) { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), $t7) $t8 := $mem } - // $t9 := pack M::S($t1, $t5, $t8) + // $t9 := pack 0x2::M::S($t1, $t5, $t8) { let $mem := $Malloc(41) $MemoryStoreU64(add($mem, 32), a) @@ -598,7 +598,7 @@ object "test_A2_M_test_publish" { $MemoryStoreU256(add($mem, 0), $t8) $t9 := $mem } - // move_to($t9, $t0) + // move_to<0x2::M::S>($t9, $t0) { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $LoadU256(sg)) if $AlignedStorageLoad($base_offset) { @@ -870,7 +870,7 @@ object "test_A2_M_test_publish_t" { A2_M_publish_t($t2, $t3) // $t4 := 0x3 $t4 := 0x3 - // $t5 := exists($t4) + // $t5 := exists<0x2::M::T>($t4) $t5 := $AlignedStorageLoad($MakeTypeStorageBase(0, 0x3948ca0a, $t4)) // if ($t5) goto L1 else goto L0 switch $t5 @@ -881,7 +881,7 @@ object "test_A2_M_test_publish_t" { // label L2 // $t7 := 0x3 $t7 := 0x3 - // $t8 := borrow_global($t7) + // $t8 := borrow_global<0x2::M::T>($t7) { let $base_offset := $MakeTypeStorageBase(0, 0x3948ca0a, $t7) if iszero($AlignedStorageLoad($base_offset)) { @@ -889,11 +889,11 @@ object "test_A2_M_test_publish_t" { } $t8 := $MakePtr(true, add($base_offset, 32)) } - // $t9 := borrow_field.s($t8) + // $t9 := borrow_field<0x2::M::T>.s($t8) { $t9 := $MakePtr($IsStoragePtr($t8), $LoadU256($t8)) } - // $t10 := borrow_field.a($t9) + // $t10 := borrow_field<0x2::M::S>.a($t9) $t10 := $IndexPtr($t9, 32) // $t11 := read_ref($t10) $t11 := $LoadU64($t10) @@ -922,7 +922,7 @@ object "test_A2_M_test_publish_t" { // label L5 // $t15 := 0x3 $t15 := 0x3 - // $t16 := borrow_global($t15) + // $t16 := borrow_global<0x2::M::T>($t15) { let $base_offset := $MakeTypeStorageBase(0, 0x3948ca0a, $t15) if iszero($AlignedStorageLoad($base_offset)) { @@ -930,11 +930,11 @@ object "test_A2_M_test_publish_t" { } $t16 := $MakePtr(true, add($base_offset, 32)) } - // $t17 := borrow_field.s($t16) + // $t17 := borrow_field<0x2::M::T>.s($t16) { $t17 := $MakePtr($IsStoragePtr($t16), $LoadU256($t16)) } - // $t18 := borrow_field.b($t17) + // $t18 := borrow_field<0x2::M::S>.b($t17) $t18 := $IndexPtr($t17, 40) // $t19 := read_ref($t18) $t19 := $LoadU8($t18) @@ -963,7 +963,7 @@ object "test_A2_M_test_publish_t" { // label L8 // $t23 := 0x3 $t23 := 0x3 - // $t24 := borrow_global($t23) + // $t24 := borrow_global<0x2::M::T>($t23) { let $base_offset := $MakeTypeStorageBase(0, 0x3948ca0a, $t23) if iszero($AlignedStorageLoad($base_offset)) { @@ -971,15 +971,15 @@ object "test_A2_M_test_publish_t" { } $t24 := $MakePtr(true, add($base_offset, 32)) } - // $t25 := borrow_field.s($t24) + // $t25 := borrow_field<0x2::M::T>.s($t24) { $t25 := $MakePtr($IsStoragePtr($t24), $LoadU256($t24)) } - // $t26 := borrow_field.c($t25) + // $t26 := borrow_field<0x2::M::S>.c($t25) { $t26 := $MakePtr($IsStoragePtr($t25), $LoadU256($t25)) } - // $t27 := borrow_field.x($t26) + // $t27 := borrow_field<0x2::M::S2>.x($t26) $t27 := $t26 // $t28 := read_ref($t27) $t28 := $LoadU128($t27) @@ -1025,13 +1025,13 @@ object "test_A2_M_test_publish_t" { $t6 := $AddU64(a, a) // $t7 := (u128)($t6) $t7 := $CastU128($t6) - // $t8 := pack M::S2($t7) + // $t8 := pack 0x2::M::S2($t7) { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), $t7) $t8 := $mem } - // $t9 := pack M::S($t1, $t5, $t8) + // $t9 := pack 0x2::M::S($t1, $t5, $t8) { let $mem := $Malloc(41) $MemoryStoreU64(add($mem, 32), a) @@ -1039,13 +1039,13 @@ object "test_A2_M_test_publish_t" { $MemoryStoreU256(add($mem, 0), $t8) $t9 := $mem } - // $t10 := pack M::T($t9) + // $t10 := pack 0x2::M::T($t9) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t9) $t10 := $mem } - // move_to($t10, $t0) + // move_to<0x2::M::T>($t10, $t0) { let $base_offset := $MakeTypeStorageBase(0, 0x3948ca0a, $LoadU256(sg)) if $AlignedStorageLoad($base_offset) { @@ -1325,12 +1325,12 @@ object "test_A2_M_test_unpublish" { $t6 := 0x3 // $t7 := M::unpublish($t6) $t7 := A2_M_unpublish($t6) - // ($t8, $t9, $t10) := unpack M::S($t7) + // ($t8, $t9, $t10) := unpack 0x2::M::S($t7) $t8 := $MemoryLoadU64(add($t7, 32)) $t9 := $MemoryLoadU8(add($t7, 40)) $t10 := $MemoryLoadU256(add($t7, 0)) $Free($t7, 41) - // $t11 := unpack M::S2($t10) + // $t11 := unpack 0x2::M::S2($t10) $t11 := $MemoryLoadU128(add($t10, 0)) $Free($t10, 16) // $t12 := 33 @@ -1399,7 +1399,7 @@ object "test_A2_M_test_unpublish" { function A2_M_unpublish(a) -> $result { let $t1 - // $t1 := move_from($t0) + // $t1 := move_from<0x2::M::S>($t0) { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, a) if iszero($AlignedStorageLoad($base_offset)) { @@ -1440,13 +1440,13 @@ object "test_A2_M_test_unpublish" { $t6 := $AddU64(a, a) // $t7 := (u128)($t6) $t7 := $CastU128($t6) - // $t8 := pack M::S2($t7) + // $t8 := pack 0x2::M::S2($t7) { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), $t7) $t8 := $mem } - // $t9 := pack M::S($t1, $t5, $t8) + // $t9 := pack 0x2::M::S($t1, $t5, $t8) { let $mem := $Malloc(41) $MemoryStoreU64(add($mem, 32), a) @@ -1454,7 +1454,7 @@ object "test_A2_M_test_unpublish" { $MemoryStoreU256(add($mem, 0), $t8) $t9 := $mem } - // move_to($t9, $t0) + // move_to<0x2::M::S>($t9, $t0) { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $LoadU256(sg)) if $AlignedStorageLoad($base_offset) { diff --git a/third_party/move/evm/move-to-yul/tests/Resources.exp.capture-source-info b/third_party/move/evm/move-to-yul/tests/Resources.exp.capture-source-info index c04def6d750e5..9832954c64548 100644 --- a/third_party/move/evm/move-to-yul/tests/Resources.exp.capture-source-info +++ b/third_party/move/evm/move-to-yul/tests/Resources.exp.capture-source-info @@ -96,7 +96,7 @@ object "test_A2_M_test_increment_a" { // $t5 := 0x3 /// @src 1:1309:1311 $t5 := 0x3 - // $t6 := borrow_global($t5) + // $t6 := borrow_global<0x2::M::S>($t5) /// @src 1:1292:1305 { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $t5) @@ -105,7 +105,7 @@ object "test_A2_M_test_increment_a" { } $t6 := $MakePtr(true, add($base_offset, 32)) } - // $t7 := borrow_field.a($t6) + // $t7 := borrow_field<0x2::M::S>.a($t6) /// @src 1:1292:1314 $t7 := $IndexPtr($t6, 32) // $t8 := read_ref($t7) @@ -135,7 +135,7 @@ object "test_A2_M_test_increment_a" { function A2_M_increment_a(addr) { let r, $t2, $t3, $t4, $t5, $t6, $t7 - // $t2 := borrow_global($t0) + // $t2 := borrow_global<0x2::M::S>($t0) /// @src 1:1106:1123 { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, addr) @@ -144,7 +144,7 @@ object "test_A2_M_test_increment_a" { } $t2 := $MakePtr(true, add($base_offset, 32)) } - // $t3 := borrow_field.a($t2) + // $t3 := borrow_field<0x2::M::S>.a($t2) /// @src 1:1148:1151 $t3 := $IndexPtr($t2, 32) // $t4 := read_ref($t3) @@ -156,7 +156,7 @@ object "test_A2_M_test_increment_a" { // $t6 := +($t4, $t5) /// @src 1:1152:1153 $t6 := $AddU64($t4, $t5) - // $t7 := borrow_field.a($t2) + // $t7 := borrow_field<0x2::M::S>.a($t2) /// @src 1:1142:1145 $t7 := $IndexPtr($t2, 32) // write_ref($t7, $t6) @@ -183,14 +183,14 @@ object "test_A2_M_test_increment_a" { // $t7 := (u128)($t6) /// @src 1:405:422 $t7 := $CastU128($t6) - // $t8 := pack M::S2($t7) + // $t8 := pack 0x2::M::S2($t7) /// @src 1:399:423 { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), $t7) $t8 := $mem } - // $t9 := pack M::S($t1, $t5, $t8) + // $t9 := pack 0x2::M::S($t1, $t5, $t8) /// @src 1:371:424 { let $mem := $Malloc(41) @@ -199,7 +199,7 @@ object "test_A2_M_test_increment_a" { $MemoryStoreU256(add($mem, 0), $t8) $t9 := $mem } - // move_to($t9, $t0) + // move_to<0x2::M::S>($t9, $t0) /// @src 1:434:441 { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $LoadU256(sg)) @@ -492,7 +492,7 @@ object "test_A2_M_test_publish" { // $t4 := 0x3 /// @src 1:566:568 $t4 := 0x3 - // $t5 := exists($t4) + // $t5 := exists<0x2::M::S>($t4) /// @src 1:556:562 $t5 := $AlignedStorageLoad($MakeTypeStorageBase(0, 0x698265eb, $t4)) // if ($t5) goto L1 else goto L0 @@ -506,7 +506,7 @@ object "test_A2_M_test_publish" { // $t7 := 0x3 /// @src 1:609:611 $t7 := 0x3 - // $t8 := borrow_global($t7) + // $t8 := borrow_global<0x2::M::S>($t7) /// @src 1:592:605 { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $t7) @@ -515,7 +515,7 @@ object "test_A2_M_test_publish" { } $t8 := $MakePtr(true, add($base_offset, 32)) } - // $t9 := borrow_field.a($t8) + // $t9 := borrow_field<0x2::M::S>.a($t8) /// @src 1:592:614 $t9 := $IndexPtr($t8, 32) // $t10 := read_ref($t9) @@ -553,7 +553,7 @@ object "test_A2_M_test_publish" { // $t14 := 0x3 /// @src 1:660:662 $t14 := 0x3 - // $t15 := borrow_global($t14) + // $t15 := borrow_global<0x2::M::S>($t14) /// @src 1:643:656 { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $t14) @@ -562,7 +562,7 @@ object "test_A2_M_test_publish" { } $t15 := $MakePtr(true, add($base_offset, 32)) } - // $t16 := borrow_field.b($t15) + // $t16 := borrow_field<0x2::M::S>.b($t15) /// @src 1:643:665 $t16 := $IndexPtr($t15, 40) // $t17 := read_ref($t16) @@ -600,7 +600,7 @@ object "test_A2_M_test_publish" { // $t21 := 0x3 /// @src 1:711:713 $t21 := 0x3 - // $t22 := borrow_global($t21) + // $t22 := borrow_global<0x2::M::S>($t21) /// @src 1:694:707 { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $t21) @@ -609,12 +609,12 @@ object "test_A2_M_test_publish" { } $t22 := $MakePtr(true, add($base_offset, 32)) } - // $t23 := borrow_field.c($t22) + // $t23 := borrow_field<0x2::M::S>.c($t22) /// @src 1:694:716 { $t23 := $MakePtr($IsStoragePtr($t22), $LoadU256($t22)) } - // $t24 := borrow_field.x($t23) + // $t24 := borrow_field<0x2::M::S2>.x($t23) /// @src 1:694:718 $t24 := $t23 // $t25 := read_ref($t24) @@ -674,14 +674,14 @@ object "test_A2_M_test_publish" { // $t7 := (u128)($t6) /// @src 1:405:422 $t7 := $CastU128($t6) - // $t8 := pack M::S2($t7) + // $t8 := pack 0x2::M::S2($t7) /// @src 1:399:423 { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), $t7) $t8 := $mem } - // $t9 := pack M::S($t1, $t5, $t8) + // $t9 := pack 0x2::M::S($t1, $t5, $t8) /// @src 1:371:424 { let $mem := $Malloc(41) @@ -690,7 +690,7 @@ object "test_A2_M_test_publish" { $MemoryStoreU256(add($mem, 0), $t8) $t9 := $mem } - // move_to($t9, $t0) + // move_to<0x2::M::S>($t9, $t0) /// @src 1:434:441 { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $LoadU256(sg)) @@ -976,7 +976,7 @@ object "test_A2_M_test_publish_t" { // $t4 := 0x3 /// @src 1:1602:1604 $t4 := 0x3 - // $t5 := exists($t4) + // $t5 := exists<0x2::M::T>($t4) /// @src 1:1592:1598 $t5 := $AlignedStorageLoad($MakeTypeStorageBase(0, 0x3948ca0a, $t4)) // if ($t5) goto L1 else goto L0 @@ -990,7 +990,7 @@ object "test_A2_M_test_publish_t" { // $t7 := 0x3 /// @src 1:1646:1648 $t7 := 0x3 - // $t8 := borrow_global($t7) + // $t8 := borrow_global<0x2::M::T>($t7) /// @src 1:1629:1642 { let $base_offset := $MakeTypeStorageBase(0, 0x3948ca0a, $t7) @@ -999,12 +999,12 @@ object "test_A2_M_test_publish_t" { } $t8 := $MakePtr(true, add($base_offset, 32)) } - // $t9 := borrow_field.s($t8) + // $t9 := borrow_field<0x2::M::T>.s($t8) /// @src 1:1629:1651 { $t9 := $MakePtr($IsStoragePtr($t8), $LoadU256($t8)) } - // $t10 := borrow_field.a($t9) + // $t10 := borrow_field<0x2::M::S>.a($t9) /// @src 1:1629:1653 $t10 := $IndexPtr($t9, 32) // $t11 := read_ref($t10) @@ -1042,7 +1042,7 @@ object "test_A2_M_test_publish_t" { // $t15 := 0x3 /// @src 1:1700:1702 $t15 := 0x3 - // $t16 := borrow_global($t15) + // $t16 := borrow_global<0x2::M::T>($t15) /// @src 1:1683:1696 { let $base_offset := $MakeTypeStorageBase(0, 0x3948ca0a, $t15) @@ -1051,12 +1051,12 @@ object "test_A2_M_test_publish_t" { } $t16 := $MakePtr(true, add($base_offset, 32)) } - // $t17 := borrow_field.s($t16) + // $t17 := borrow_field<0x2::M::T>.s($t16) /// @src 1:1683:1705 { $t17 := $MakePtr($IsStoragePtr($t16), $LoadU256($t16)) } - // $t18 := borrow_field.b($t17) + // $t18 := borrow_field<0x2::M::S>.b($t17) /// @src 1:1683:1707 $t18 := $IndexPtr($t17, 40) // $t19 := read_ref($t18) @@ -1094,7 +1094,7 @@ object "test_A2_M_test_publish_t" { // $t23 := 0x3 /// @src 1:1754:1756 $t23 := 0x3 - // $t24 := borrow_global($t23) + // $t24 := borrow_global<0x2::M::T>($t23) /// @src 1:1737:1750 { let $base_offset := $MakeTypeStorageBase(0, 0x3948ca0a, $t23) @@ -1103,17 +1103,17 @@ object "test_A2_M_test_publish_t" { } $t24 := $MakePtr(true, add($base_offset, 32)) } - // $t25 := borrow_field.s($t24) + // $t25 := borrow_field<0x2::M::T>.s($t24) /// @src 1:1737:1759 { $t25 := $MakePtr($IsStoragePtr($t24), $LoadU256($t24)) } - // $t26 := borrow_field.c($t25) + // $t26 := borrow_field<0x2::M::S>.c($t25) /// @src 1:1737:1761 { $t26 := $MakePtr($IsStoragePtr($t25), $LoadU256($t25)) } - // $t27 := borrow_field.x($t26) + // $t27 := borrow_field<0x2::M::S2>.x($t26) /// @src 1:1737:1763 $t27 := $t26 // $t28 := read_ref($t27) @@ -1173,14 +1173,14 @@ object "test_A2_M_test_publish_t" { // $t7 := (u128)($t6) /// @src 1:1434:1451 $t7 := $CastU128($t6) - // $t8 := pack M::S2($t7) + // $t8 := pack 0x2::M::S2($t7) /// @src 1:1428:1452 { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), $t7) $t8 := $mem } - // $t9 := pack M::S($t1, $t5, $t8) + // $t9 := pack 0x2::M::S($t1, $t5, $t8) /// @src 1:1400:1453 { let $mem := $Malloc(41) @@ -1189,14 +1189,14 @@ object "test_A2_M_test_publish_t" { $MemoryStoreU256(add($mem, 0), $t8) $t9 := $mem } - // $t10 := pack M::T($t9) + // $t10 := pack 0x2::M::T($t9) /// @src 1:1393:1454 { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t9) $t10 := $mem } - // move_to($t10, $t0) + // move_to<0x2::M::T>($t10, $t0) /// @src 1:1464:1471 { let $base_offset := $MakeTypeStorageBase(0, 0x3948ca0a, $LoadU256(sg)) @@ -1491,13 +1491,13 @@ object "test_A2_M_test_unpublish" { // $t7 := M::unpublish($t6) /// @src 1:931:944 $t7 := A2_M_unpublish($t6) - // ($t8, $t9, $t10) := unpack M::S($t7) + // ($t8, $t9, $t10) := unpack 0x2::M::S($t7) /// @src 1:911:928 $t8 := $MemoryLoadU64(add($t7, 32)) $t9 := $MemoryLoadU8(add($t7, 40)) $t10 := $MemoryLoadU256(add($t7, 0)) $Free($t7, 41) - // $t11 := unpack M::S2($t10) + // $t11 := unpack 0x2::M::S2($t10) /// @src 1:922:927 $t11 := $MemoryLoadU128(add($t10, 0)) $Free($t10, 16) @@ -1583,7 +1583,7 @@ object "test_A2_M_test_unpublish" { function A2_M_unpublish(a) -> $result { let $t1 - // $t1 := move_from($t0) + // $t1 := move_from<0x2::M::S>($t0) /// @src 1:793:802 { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, a) @@ -1631,14 +1631,14 @@ object "test_A2_M_test_unpublish" { // $t7 := (u128)($t6) /// @src 1:405:422 $t7 := $CastU128($t6) - // $t8 := pack M::S2($t7) + // $t8 := pack 0x2::M::S2($t7) /// @src 1:399:423 { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), $t7) $t8 := $mem } - // $t9 := pack M::S($t1, $t5, $t8) + // $t9 := pack 0x2::M::S($t1, $t5, $t8) /// @src 1:371:424 { let $mem := $Malloc(41) @@ -1647,7 +1647,7 @@ object "test_A2_M_test_unpublish" { $MemoryStoreU256(add($mem, 0), $t8) $t9 := $mem } - // move_to($t9, $t0) + // move_to<0x2::M::S>($t9, $t0) /// @src 1:434:441 { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $LoadU256(sg)) diff --git a/third_party/move/evm/move-to-yul/tests/Structs.exp b/third_party/move/evm/move-to-yul/tests/Structs.exp index d79871424ed16..078aae2d530ec 100644 --- a/third_party/move/evm/move-to-yul/tests/Structs.exp +++ b/third_party/move/evm/move-to-yul/tests/Structs.exp @@ -54,7 +54,7 @@ object "test_A2_M_test_drop" { $t1 := false // $t2 := M::pack_S($t0, $t1) $t2 := A2_M_pack_S($t0, $t1) - // $t3 := pack M::S3($t2) + // $t3 := pack 0x2::M::S3($t2) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t2) @@ -79,7 +79,7 @@ object "test_A2_M_test_drop" { $t2 := $CastU128(a) // $t3 := M::pack_S2($t2) $t3 := A2_M_pack_S2($t2) - // $t4 := pack M::S($t0, $t1, $t3) + // $t4 := pack 0x2::M::S($t0, $t1, $t3) { let $mem := $Malloc(41) $MemoryStoreU64(add($mem, 32), a) @@ -93,7 +93,7 @@ object "test_A2_M_test_drop" { function A2_M_pack_S2(x) -> $result { let $t1 - // $t1 := pack M::S2($t0) + // $t1 := pack 0x2::M::S2($t0) { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), x) @@ -330,7 +330,7 @@ object "test_A2_M_test_equality" { $t2 := $CastU128(a) // $t3 := M::pack_S2($t2) $t3 := A2_M_pack_S2($t2) - // $t4 := pack M::S($t0, $t1, $t3) + // $t4 := pack 0x2::M::S($t0, $t1, $t3) { let $mem := $Malloc(41) $MemoryStoreU64(add($mem, 32), a) @@ -344,7 +344,7 @@ object "test_A2_M_test_equality" { function A2_M_pack_S2(x) -> $result { let $t1 - // $t1 := pack M::S2($t0) + // $t1 := pack 0x2::M::S2($t0) { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), x) @@ -460,7 +460,7 @@ object "test_A2_M_test_pack_S" { s := A2_M_pack_S($t1, $t2) // $t3 := borrow_local($t0) $t3 := $MakePtr(false, s) - // $t4 := borrow_field.a($t3) + // $t4 := borrow_field<0x2::M::S>.a($t3) $t4 := $IndexPtr($t3, 32) // $t5 := read_ref($t4) $t5 := $LoadU64($t4) @@ -477,7 +477,7 @@ object "test_A2_M_test_pack_S" { // label L2 // $t9 := borrow_local($t0) $t9 := $MakePtr(false, s) - // $t10 := borrow_field.b($t9) + // $t10 := borrow_field<0x2::M::S>.b($t9) $t10 := $IndexPtr($t9, 40) // $t11 := read_ref($t10) $t11 := $LoadU8($t10) @@ -506,11 +506,11 @@ object "test_A2_M_test_pack_S" { // label L5 // $t15 := borrow_local($t0) $t15 := $MakePtr(false, s) - // $t16 := borrow_field.c($t15) + // $t16 := borrow_field<0x2::M::S>.c($t15) { $t16 := $MakePtr($IsStoragePtr($t15), $LoadU256($t15)) } - // $t17 := borrow_field.x($t16) + // $t17 := borrow_field<0x2::M::S2>.x($t16) $t17 := $t16 // $t18 := read_ref($t17) $t18 := $LoadU128($t17) @@ -549,7 +549,7 @@ object "test_A2_M_test_pack_S" { $t2 := $CastU128(a) // $t3 := M::pack_S2($t2) $t3 := A2_M_pack_S2($t2) - // $t4 := pack M::S($t0, $t1, $t3) + // $t4 := pack 0x2::M::S($t0, $t1, $t3) { let $mem := $Malloc(41) $MemoryStoreU64(add($mem, 32), a) @@ -563,7 +563,7 @@ object "test_A2_M_test_pack_S" { function A2_M_pack_S2(x) -> $result { let $t1 - // $t1 := pack M::S2($t0) + // $t1 := pack 0x2::M::S2($t0) { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), x) @@ -780,7 +780,7 @@ object "test_A2_M_test_pack_S2" { s := A2_M_pack_S2($t1) // $t2 := borrow_local($t0) $t2 := $MakePtr(false, s) - // $t3 := borrow_field.x($t2) + // $t3 := borrow_field<0x2::M::S2>.x($t2) $t3 := $t2 // $t4 := read_ref($t3) $t4 := $LoadU128($t3) @@ -803,7 +803,7 @@ object "test_A2_M_test_pack_S2" { function A2_M_pack_S2(x) -> $result { let $t1 - // $t1 := pack M::S2($t0) + // $t1 := pack 0x2::M::S2($t0) { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), x) @@ -952,7 +952,7 @@ object "test_A2_M_test_pack_S2_fail" { s := A2_M_pack_S2($t1) // $t2 := borrow_local($t0) $t2 := $MakePtr(false, s) - // $t3 := borrow_field.x($t2) + // $t3 := borrow_field<0x2::M::S2>.x($t2) $t3 := $t2 // $t4 := read_ref($t3) $t4 := $LoadU128($t3) @@ -975,7 +975,7 @@ object "test_A2_M_test_pack_S2_fail" { function A2_M_pack_S2(x) -> $result { let $t1 - // $t1 := pack M::S2($t0) + // $t1 := pack 0x2::M::S2($t0) { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), x) @@ -1147,15 +1147,15 @@ object "test_A2_M_test_read_S" { function A2_M_read_S(s) -> $result { let $t1, $t2, $t3, $t4, $t5, $t6, $t7 - // $t1 := borrow_field.a($t0) + // $t1 := borrow_field<0x2::M::S>.a($t0) $t1 := $IndexPtr(s, 32) // $t2 := read_ref($t1) $t2 := $LoadU64($t1) - // $t3 := borrow_field.c($t0) + // $t3 := borrow_field<0x2::M::S>.c($t0) { $t3 := $MakePtr($IsStoragePtr(s), $LoadU256(s)) } - // $t4 := borrow_field.x($t3) + // $t4 := borrow_field<0x2::M::S2>.x($t3) $t4 := $t3 // $t5 := read_ref($t4) $t5 := $LoadU128($t4) @@ -1173,7 +1173,7 @@ object "test_A2_M_test_read_S" { $t2 := $CastU128(a) // $t3 := M::pack_S2($t2) $t3 := A2_M_pack_S2($t2) - // $t4 := pack M::S($t0, $t1, $t3) + // $t4 := pack 0x2::M::S($t0, $t1, $t3) { let $mem := $Malloc(41) $MemoryStoreU64(add($mem, 32), a) @@ -1187,7 +1187,7 @@ object "test_A2_M_test_read_S" { function A2_M_pack_S2(x) -> $result { let $t1 - // $t1 := pack M::S2($t0) + // $t1 := pack 0x2::M::S2($t0) { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), x) @@ -1394,7 +1394,7 @@ object "test_A2_M_test_read_and_write_S" { s := A2_M_read_and_write_S() // $t1 := borrow_local($t0) $t1 := $MakePtr(false, s) - // $t2 := borrow_field.a($t1) + // $t2 := borrow_field<0x2::M::S>.a($t1) $t2 := $IndexPtr($t1, 32) // $t3 := read_ref($t2) $t3 := $LoadU64($t2) @@ -1411,11 +1411,11 @@ object "test_A2_M_test_read_and_write_S" { // label L2 // $t7 := borrow_local($t0) $t7 := $MakePtr(false, s) - // $t8 := borrow_field.c($t7) + // $t8 := borrow_field<0x2::M::S>.c($t7) { $t8 := $MakePtr($IsStoragePtr($t7), $LoadU256($t7)) } - // $t9 := borrow_field.x($t8) + // $t9 := borrow_field<0x2::M::S2>.x($t8) $t9 := $t8 // $t10 := read_ref($t9) $t10 := $LoadU128($t9) @@ -1472,21 +1472,21 @@ object "test_A2_M_test_read_and_write_S" { function A2_M_write_S(s, v) { let $t2, $t3, $t4, $t5, $t6, $t7 - // $t2 := borrow_field.a($t0) + // $t2 := borrow_field<0x2::M::S>.a($t0) $t2 := $IndexPtr(s, 32) // write_ref($t2, $t1) $StoreU64($t2, v) - // $t3 := borrow_field.a($t0) + // $t3 := borrow_field<0x2::M::S>.a($t0) $t3 := $IndexPtr(s, 32) // $t4 := read_ref($t3) $t4 := $LoadU64($t3) // $t5 := (u128)($t4) $t5 := $CastU128($t4) - // $t6 := borrow_field.c($t0) + // $t6 := borrow_field<0x2::M::S>.c($t0) { $t6 := $MakePtr($IsStoragePtr(s), $LoadU256(s)) } - // $t7 := borrow_field.x($t6) + // $t7 := borrow_field<0x2::M::S2>.x($t6) $t7 := $t6 // write_ref($t7, $t5) $StoreU128($t7, $t5) @@ -1495,15 +1495,15 @@ object "test_A2_M_test_read_and_write_S" { function A2_M_read_S(s) -> $result { let $t1, $t2, $t3, $t4, $t5, $t6, $t7 - // $t1 := borrow_field.a($t0) + // $t1 := borrow_field<0x2::M::S>.a($t0) $t1 := $IndexPtr(s, 32) // $t2 := read_ref($t1) $t2 := $LoadU64($t1) - // $t3 := borrow_field.c($t0) + // $t3 := borrow_field<0x2::M::S>.c($t0) { $t3 := $MakePtr($IsStoragePtr(s), $LoadU256(s)) } - // $t4 := borrow_field.x($t3) + // $t4 := borrow_field<0x2::M::S2>.x($t3) $t4 := $t3 // $t5 := read_ref($t4) $t5 := $LoadU128($t4) @@ -1521,7 +1521,7 @@ object "test_A2_M_test_read_and_write_S" { $t2 := $CastU128(a) // $t3 := M::pack_S2($t2) $t3 := A2_M_pack_S2($t2) - // $t4 := pack M::S($t0, $t1, $t3) + // $t4 := pack 0x2::M::S($t0, $t1, $t3) { let $mem := $Malloc(41) $MemoryStoreU64(add($mem, 32), a) @@ -1535,7 +1535,7 @@ object "test_A2_M_test_read_and_write_S" { function A2_M_pack_S2(x) -> $result { let $t1 - // $t1 := pack M::S2($t0) + // $t1 := pack 0x2::M::S2($t0) { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), x) @@ -1800,7 +1800,7 @@ object "test_A2_M_test_unpack" { s1 := A2_M_unpack($t3) // $t4 := borrow_local($t0) $t4 := $MakePtr(false, s1) - // $t5 := borrow_field.x($t4) + // $t5 := borrow_field<0x2::M::S2>.x($t4) $t5 := $t4 // $t6 := read_ref($t5) $t6 := $LoadU128($t5) @@ -1823,7 +1823,7 @@ object "test_A2_M_test_unpack" { function A2_M_unpack(s) -> $result { let c, $t2, $t3, $t4 - // ($t2, $t3, $t4) := unpack M::S($t0) + // ($t2, $t3, $t4) := unpack 0x2::M::S($t0) $t2 := $MemoryLoadU64(add(s, 32)) $t3 := $MemoryLoadU8(add(s, 40)) $t4 := $MemoryLoadU256(add(s, 0)) @@ -1840,7 +1840,7 @@ object "test_A2_M_test_unpack" { $t2 := $CastU128(a) // $t3 := M::pack_S2($t2) $t3 := A2_M_pack_S2($t2) - // $t4 := pack M::S($t0, $t1, $t3) + // $t4 := pack 0x2::M::S($t0, $t1, $t3) { let $mem := $Malloc(41) $MemoryStoreU64(add($mem, 32), a) @@ -1854,7 +1854,7 @@ object "test_A2_M_test_unpack" { function A2_M_pack_S2(x) -> $result { let $t1 - // $t1 := pack M::S2($t0) + // $t1 := pack 0x2::M::S2($t0) { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), x) @@ -2039,7 +2039,7 @@ object "test_A2_M_test_write_S" { A2_M_write_S($t3, $t4) // $t5 := borrow_local($t0) $t5 := $MakePtr(false, s) - // $t6 := borrow_field.a($t5) + // $t6 := borrow_field<0x2::M::S>.a($t5) $t6 := $IndexPtr($t5, 32) // $t7 := read_ref($t6) $t7 := $LoadU64($t6) @@ -2056,11 +2056,11 @@ object "test_A2_M_test_write_S" { // label L2 // $t11 := borrow_local($t0) $t11 := $MakePtr(false, s) - // $t12 := borrow_field.c($t11) + // $t12 := borrow_field<0x2::M::S>.c($t11) { $t12 := $MakePtr($IsStoragePtr($t11), $LoadU256($t11)) } - // $t13 := borrow_field.x($t12) + // $t13 := borrow_field<0x2::M::S2>.x($t12) $t13 := $t12 // $t14 := read_ref($t13) $t14 := $LoadU128($t13) @@ -2095,21 +2095,21 @@ object "test_A2_M_test_write_S" { function A2_M_write_S(s, v) { let $t2, $t3, $t4, $t5, $t6, $t7 - // $t2 := borrow_field.a($t0) + // $t2 := borrow_field<0x2::M::S>.a($t0) $t2 := $IndexPtr(s, 32) // write_ref($t2, $t1) $StoreU64($t2, v) - // $t3 := borrow_field.a($t0) + // $t3 := borrow_field<0x2::M::S>.a($t0) $t3 := $IndexPtr(s, 32) // $t4 := read_ref($t3) $t4 := $LoadU64($t3) // $t5 := (u128)($t4) $t5 := $CastU128($t4) - // $t6 := borrow_field.c($t0) + // $t6 := borrow_field<0x2::M::S>.c($t0) { $t6 := $MakePtr($IsStoragePtr(s), $LoadU256(s)) } - // $t7 := borrow_field.x($t6) + // $t7 := borrow_field<0x2::M::S2>.x($t6) $t7 := $t6 // write_ref($t7, $t5) $StoreU128($t7, $t5) @@ -2122,7 +2122,7 @@ object "test_A2_M_test_write_S" { $t2 := $CastU128(a) // $t3 := M::pack_S2($t2) $t3 := A2_M_pack_S2($t2) - // $t4 := pack M::S($t0, $t1, $t3) + // $t4 := pack 0x2::M::S($t0, $t1, $t3) { let $mem := $Malloc(41) $MemoryStoreU64(add($mem, 32), a) @@ -2136,7 +2136,7 @@ object "test_A2_M_test_write_S" { function A2_M_pack_S2(x) -> $result { let $t1 - // $t1 := pack M::S2($t0) + // $t1 := pack 0x2::M::S2($t0) { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), x) diff --git a/third_party/move/evm/move-to-yul/tests/Tables.exp b/third_party/move/evm/move-to-yul/tests/Tables.exp index f6ce37ffea2a9..04a2ed965d8c1 100644 --- a/third_party/move/evm/move-to-yul/tests/Tables.exp +++ b/third_party/move/evm/move-to-yul/tests/Tables.exp @@ -108,13 +108,13 @@ object "test_A2_Tables_test_borrow_fail" { $t19 := $MakePtr(false, add($locals, 96)) // $t20 := move($t6) $t20 := mload($locals) - // $t21 := pack Tables::S($t20) + // $t21 := pack 0x2::Tables::S($t20) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t20) $t21 := $mem } - // move_to>($t21, $t19) + // move_to<0x2::Tables::S>($t21, $t19) { let $base_offset := $MakeTypeStorageBase(0, 0x8a475b1c, $LoadU256($t19)) if $AlignedStorageLoad($base_offset) { @@ -456,13 +456,13 @@ object "test_A2_Tables_test_insert_fail" { $t30 := $MakePtr(false, add($locals, 160)) // $t31 := move($t9) $t31 := mload($locals) - // $t32 := pack Tables::S($t31) + // $t32 := pack 0x2::Tables::S($t31) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t31) $t32 := $mem } - // move_to>($t32, $t30) + // move_to<0x2::Tables::S>($t32, $t30) { let $base_offset := $MakeTypeStorageBase(0, 0x8a475b1c, $LoadU256($t30)) if $AlignedStorageLoad($base_offset) { @@ -1022,13 +1022,13 @@ object "test_A2_Tables_test_primitive" { $t98 := $MakePtr(false, add($locals, 384)) // $t99 := move($t31) $t99 := mload($locals) - // $t100 := pack Tables::S($t99) + // $t100 := pack 0x2::Tables::S($t99) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t99) $t100 := $mem } - // move_to>($t100, $t98) + // move_to<0x2::Tables::S>($t100, $t98) { let $base_offset := $MakeTypeStorageBase(0, 0x8a475b1c, $LoadU256($t98)) if $AlignedStorageLoad($base_offset) { @@ -1044,7 +1044,7 @@ object "test_A2_Tables_test_primitive" { } // $t101 := 0x42 $t101 := 0x42 - // $t102 := borrow_global>($t101) + // $t102 := borrow_global<0x2::Tables::S>($t101) { let $base_offset := $MakeTypeStorageBase(0, 0x8a475b1c, $t101) if iszero($AlignedStorageLoad($base_offset)) { @@ -1052,7 +1052,7 @@ object "test_A2_Tables_test_primitive" { } $t102 := $MakePtr(true, add($base_offset, 32)) } - // $t103 := borrow_field>.t($t102) + // $t103 := borrow_field<0x2::Tables::S>.t($t102) $t103 := $t102 // $t104 := 42 $t104 := 42 @@ -1119,7 +1119,7 @@ object "test_A2_Tables_test_primitive" { // label L32 // $t116 := 0x42 $t116 := 0x42 - // $t117 := move_from>($t116) + // $t117 := move_from<0x2::Tables::S>($t116) { let $base_offset := $MakeTypeStorageBase(0, 0x8a475b1c, $t116) if iszero($AlignedStorageLoad($base_offset)) { @@ -1135,7 +1135,7 @@ object "test_A2_Tables_test_primitive" { $t117 := $dst } } - // $t30 := unpack Tables::S($t117) + // $t30 := unpack 0x2::Tables::S($t117) mstore(add($locals, 480), $MemoryLoadU256(add($t117, 0))) $Free($t117, 32) // $t118 := borrow_local($t30) @@ -1181,13 +1181,13 @@ object "test_A2_Tables_test_primitive" { $t127 := $MakePtr(false, add($locals, 544)) // $t128 := move($t30) $t128 := mload(add($locals, 480)) - // $t129 := pack Tables::S($t128) + // $t129 := pack 0x2::Tables::S($t128) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t128) $t129 := $mem } - // move_to>($t129, $t127) + // move_to<0x2::Tables::S>($t129, $t127) { let $base_offset := $MakeTypeStorageBase(0, 0x8a475b1c, $LoadU256($t127)) if $AlignedStorageLoad($base_offset) { @@ -1483,7 +1483,7 @@ object "test_A2_Tables_test_remove_fail" { $Abort($t11) } case 4 { - // $t3 := Table::empty() + // $t3 := Table::empty() mstore($locals, A2_Table_empty$u64_A2_Tables_Balance$()) // $t4 := borrow_local($t3) $t4 := $MakePtr(false, $locals) @@ -1493,9 +1493,9 @@ object "test_A2_Tables_test_remove_fail" { mstore(add($locals, 32), $t5) // $t6 := borrow_local($t0) $t6 := $MakePtr(false, add($locals, 56)) - // $t7 := Table::remove($t4, $t6) + // $t7 := Table::remove($t4, $t6) $t7 := A2_Table_remove$u64_A2_Tables_Balance$($t4, $t6) - // $t8 := unpack Tables::Balance($t7) + // $t8 := unpack 0x2::Tables::Balance($t7) $t8 := $MemoryLoadU256(add($t7, 0)) $Free($t7, 32) // $t9 := U256::zero() @@ -1517,13 +1517,13 @@ object "test_A2_Tables_test_remove_fail" { $t13 := $MakePtr(false, add($locals, 64)) // $t14 := move($t3) $t14 := mload($locals) - // $t15 := pack Tables::S($t14) + // $t15 := pack 0x2::Tables::S($t14) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t14) $t15 := $mem } - // move_to>($t15, $t13) + // move_to<0x2::Tables::S>($t15, $t13) { let $base_offset := $MakeTypeStorageBase(0, 0x6f98bffd, $LoadU256($t13)) if $AlignedStorageLoad($base_offset) { @@ -1749,7 +1749,7 @@ object "test_A2_Tables_test_struct" { $Abort($t40) } case 4 { - // $t27 := Table::empty() + // $t27 := Table::empty() mstore($locals, A2_Table_empty$address_A2_Tables_Balance$()) // $t30 := 3743106036130323098097120681749450326028 $t30 := 3743106036130323098097120681749450326028 @@ -1763,13 +1763,13 @@ object "test_A2_Tables_test_struct" { mstore(add($locals, 32), $t33) // $t34 := borrow_local($t0) $t34 := $MakePtr(false, add($locals, 32)) - // $t35 := pack Tables::Balance($t30) + // $t35 := pack 0x2::Tables::Balance($t30) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t30) $t35 := $mem } - // Table::insert($t32, $t34, $t35) + // Table::insert($t32, $t34, $t35) A2_Table_insert$address_A2_Tables_Balance$($t32, $t34, $t35) // $t36 := borrow_local($t27) $t36 := $MakePtr(false, $locals) @@ -1779,7 +1779,7 @@ object "test_A2_Tables_test_struct" { mstore(add($locals, 64), $t37) // $t38 := borrow_local($t18) $t38 := $MakePtr(false, add($locals, 64)) - // $t39 := Table::contains($t36, $t38) + // $t39 := Table::contains($t36, $t38) $t39 := A2_Table_contains$address_A2_Tables_Balance$($t36, $t38) // if ($t39) goto L1 else goto L0 switch $t39 @@ -1796,9 +1796,9 @@ object "test_A2_Tables_test_struct" { mstore(add($locals, 96), $t42) // $t43 := borrow_local($t20) $t43 := $MakePtr(false, add($locals, 96)) - // $t44 := Table::borrow($t41, $t43) + // $t44 := Table::borrow($t41, $t43) $t44 := A2_Table_borrow$address_A2_Tables_Balance$($t41, $t43) - // $t45 := borrow_field.value($t44) + // $t45 := borrow_field<0x2::Tables::Balance>.value($t44) $t45 := $t44 // $t46 := read_ref($t45) $t46 := $LoadU256($t45) @@ -1831,13 +1831,13 @@ object "test_A2_Tables_test_struct" { $t50 := $MakePtr(false, add($locals, 128)) // $t51 := move($t27) $t51 := mload($locals) - // $t52 := pack Tables::S($t51) + // $t52 := pack 0x2::Tables::S($t51) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t51) $t52 := $mem } - // move_to>($t52, $t50) + // move_to<0x2::Tables::S>($t52, $t50) { let $base_offset := $MakeTypeStorageBase(0, 0x7dd56ec3, $LoadU256($t50)) if $AlignedStorageLoad($base_offset) { @@ -1853,7 +1853,7 @@ object "test_A2_Tables_test_struct" { } // $t53 := 0x42 $t53 := 0x42 - // $t54 := borrow_global>($t53) + // $t54 := borrow_global<0x2::Tables::S>($t53) { let $base_offset := $MakeTypeStorageBase(0, 0x7dd56ec3, $t53) if iszero($AlignedStorageLoad($base_offset)) { @@ -1861,7 +1861,7 @@ object "test_A2_Tables_test_struct" { } $t54 := $MakePtr(true, add($base_offset, 32)) } - // $t55 := borrow_field>.t($t54) + // $t55 := borrow_field<0x2::Tables::S>.t($t54) $t55 := $t54 // $t56 := 0xcd $t56 := 0xcd @@ -1869,13 +1869,13 @@ object "test_A2_Tables_test_struct" { mstore(add($locals, 160), $t56) // $t57 := borrow_local($t23) $t57 := $MakePtr(false, add($locals, 160)) - // $t58 := pack Tables::Balance($t31) + // $t58 := pack 0x2::Tables::Balance($t31) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t31) $t58 := $mem } - // Table::insert($t55, $t57, $t58) + // Table::insert($t55, $t57, $t58) A2_Table_insert$address_A2_Tables_Balance$($t55, $t57, $t58) // $t59 := 0xab $t59 := 0xab @@ -1885,9 +1885,9 @@ object "test_A2_Tables_test_struct" { $t60 := $MakePtr(false, add($locals, 192)) // $t61 := freeze_ref($t55) $t61 := $t55 - // $t62 := Table::borrow($t61, $t60) + // $t62 := Table::borrow($t61, $t60) $t62 := A2_Table_borrow$address_A2_Tables_Balance$($t61, $t60) - // $t63 := borrow_field.value($t62) + // $t63 := borrow_field<0x2::Tables::Balance>.value($t62) $t63 := $t62 // $t64 := read_ref($t63) $t64 := $LoadU256($t63) @@ -1921,9 +1921,9 @@ object "test_A2_Tables_test_struct" { $t68 := $MakePtr(false, add($locals, 224)) // $t69 := freeze_ref($t55) $t69 := $t55 - // $t70 := Table::borrow($t69, $t68) + // $t70 := Table::borrow($t69, $t68) $t70 := A2_Table_borrow$address_A2_Tables_Balance$($t69, $t68) - // $t71 := borrow_field.value($t70) + // $t71 := borrow_field<0x2::Tables::Balance>.value($t70) $t71 := $t70 // $t72 := read_ref($t71) $t72 := $LoadU256($t71) @@ -1955,9 +1955,9 @@ object "test_A2_Tables_test_struct" { mstore(add($locals, 256), $t75) // $t76 := borrow_local($t7) $t76 := $MakePtr(false, add($locals, 256)) - // $t77 := Table::borrow_mut($t55, $t76) + // $t77 := Table::borrow_mut($t55, $t76) $t77 := A2_Table_borrow_mut$address_A2_Tables_Balance$($t55, $t76) - // $t78 := borrow_field.value($t77) + // $t78 := borrow_field<0x2::Tables::Balance>.value($t77) $t78 := $t77 // $t79 := read_ref($t78) $t79 := $LoadU256($t78) @@ -1965,7 +1965,7 @@ object "test_A2_Tables_test_struct" { $t80 := A2_U256_one() // $t81 := -($t79, $t80) $t81 := $Sub($t79, $t80) - // $t82 := borrow_field.value($t77) + // $t82 := borrow_field<0x2::Tables::Balance>.value($t77) $t82 := $t77 // write_ref($t82, $t81) $StoreU256($t82, $t81) @@ -1977,9 +1977,9 @@ object "test_A2_Tables_test_struct" { $t84 := $MakePtr(false, add($locals, 288)) // $t85 := freeze_ref($t55) $t85 := $t55 - // $t86 := Table::borrow($t85, $t84) + // $t86 := Table::borrow($t85, $t84) $t86 := A2_Table_borrow$address_A2_Tables_Balance$($t85, $t84) - // $t87 := borrow_field.value($t86) + // $t87 := borrow_field<0x2::Tables::Balance>.value($t86) $t87 := $t86 // $t88 := read_ref($t87) $t88 := $LoadU256($t87) @@ -2013,9 +2013,9 @@ object "test_A2_Tables_test_struct" { mstore(add($locals, 320), $t92) // $t93 := borrow_local($t13) $t93 := $MakePtr(false, add($locals, 320)) - // $t94 := Table::remove($t55, $t93) + // $t94 := Table::remove($t55, $t93) $t94 := A2_Table_remove$address_A2_Tables_Balance$($t55, $t93) - // $t95 := unpack Tables::Balance($t94) + // $t95 := unpack 0x2::Tables::Balance($t94) $t95 := $MemoryLoadU256(add($t94, 0)) $Free($t94, 32) // $t96 := ==($t95, $t30) @@ -2048,7 +2048,7 @@ object "test_A2_Tables_test_struct" { $t99 := $MakePtr(false, add($locals, 352)) // $t100 := freeze_ref($t55) $t100 := $t55 - // $t101 := Table::contains($t100, $t99) + // $t101 := Table::contains($t100, $t99) $t101 := A2_Table_contains$address_A2_Tables_Balance$($t100, $t99) // $t102 := !($t101) $t102 := $LogicalNot($t101) @@ -2356,7 +2356,7 @@ object "test_A2_Tables_test_table_of_tables" { $Abort($t75) } case 4 { - // $t45 := Table::empty>() + // $t45 := Table::empty>() mstore(add($locals, 128), A2_Table_empty$address_A2_Table_Table$address_A2_U256_U256$$()) // $t51 := 3743106036130323098097120681749450326028 $t51 := 3743106036130323098097120681749450326028 @@ -2364,7 +2364,7 @@ object "test_A2_Tables_test_table_of_tables" { $t52 := 15312706511442230855851857334429569515566 // $t53 := 26542024619833200150143219379677920493647 $t53 := 26542024619833200150143219379677920493647 - // $t46 := Table::empty() + // $t46 := Table::empty() mstore($locals, A2_Table_empty$address_A2_U256_U256$()) // $t54 := borrow_local($t46) $t54 := $MakePtr(false, $locals) @@ -2374,9 +2374,9 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 32), $t55) // $t56 := borrow_local($t0) $t56 := $MakePtr(false, add($locals, 32)) - // Table::insert($t54, $t56, $t51) + // Table::insert($t54, $t56, $t51) A2_Table_insert$address_A2_U256_U256$($t54, $t56, $t51) - // $t47 := Table::empty() + // $t47 := Table::empty() mstore(add($locals, 64), A2_Table_empty$address_A2_U256_U256$()) // $t57 := borrow_local($t47) $t57 := $MakePtr(false, add($locals, 64)) @@ -2386,7 +2386,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 96), $t58) // $t59 := borrow_local($t22) $t59 := $MakePtr(false, add($locals, 96)) - // Table::insert($t57, $t59, $t52) + // Table::insert($t57, $t59, $t52) A2_Table_insert$address_A2_U256_U256$($t57, $t59, $t52) // $t60 := borrow_local($t45) $t60 := $MakePtr(false, add($locals, 128)) @@ -2398,7 +2398,7 @@ object "test_A2_Tables_test_table_of_tables" { $t62 := $MakePtr(false, add($locals, 160)) // $t63 := move($t46) $t63 := mload($locals) - // Table::insert>($t60, $t62, $t63) + // Table::insert>($t60, $t62, $t63) A2_Table_insert$address_A2_Table_Table$address_A2_U256_U256$$($t60, $t62, $t63) // $t64 := borrow_local($t45) $t64 := $MakePtr(false, add($locals, 128)) @@ -2410,7 +2410,7 @@ object "test_A2_Tables_test_table_of_tables" { $t66 := $MakePtr(false, add($locals, 192)) // $t67 := move($t47) $t67 := mload(add($locals, 64)) - // Table::insert>($t64, $t66, $t67) + // Table::insert>($t64, $t66, $t67) A2_Table_insert$address_A2_Table_Table$address_A2_U256_U256$$($t64, $t66, $t67) // $t68 := borrow_local($t45) $t68 := $MakePtr(false, add($locals, 128)) @@ -2420,7 +2420,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 224), $t69) // $t70 := borrow_local($t1) $t70 := $MakePtr(false, add($locals, 224)) - // $t71 := Table::borrow>($t68, $t70) + // $t71 := Table::borrow>($t68, $t70) $t71 := A2_Table_borrow$address_A2_Table_Table$address_A2_U256_U256$$($t68, $t70) // $t72 := 0xab $t72 := 0xab @@ -2428,7 +2428,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 256), $t72) // $t73 := borrow_local($t44) $t73 := $MakePtr(false, add($locals, 256)) - // $t74 := Table::contains($t71, $t73) + // $t74 := Table::contains($t71, $t73) $t74 := A2_Table_contains$address_A2_U256_U256$($t71, $t73) // if ($t74) goto L1 else goto L0 switch $t74 @@ -2445,7 +2445,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 288), $t77) // $t78 := borrow_local($t5) $t78 := $MakePtr(false, add($locals, 288)) - // $t79 := Table::borrow>($t76, $t78) + // $t79 := Table::borrow>($t76, $t78) $t79 := A2_Table_borrow$address_A2_Table_Table$address_A2_U256_U256$$($t76, $t78) // $t80 := 0xcd $t80 := 0xcd @@ -2453,7 +2453,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 320), $t80) // $t81 := borrow_local($t4) $t81 := $MakePtr(false, add($locals, 320)) - // $t82 := Table::contains($t79, $t81) + // $t82 := Table::contains($t79, $t81) $t82 := A2_Table_contains$address_A2_U256_U256$($t79, $t81) // if ($t82) goto L4 else goto L3 switch $t82 @@ -2482,7 +2482,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 352), $t85) // $t86 := borrow_local($t9) $t86 := $MakePtr(false, add($locals, 352)) - // $t87 := Table::borrow>($t84, $t86) + // $t87 := Table::borrow>($t84, $t86) $t87 := A2_Table_borrow$address_A2_Table_Table$address_A2_U256_U256$$($t84, $t86) // $t88 := 0xab $t88 := 0xab @@ -2490,7 +2490,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 384), $t88) // $t89 := borrow_local($t8) $t89 := $MakePtr(false, add($locals, 384)) - // $t90 := Table::borrow($t87, $t89) + // $t90 := Table::borrow($t87, $t89) $t90 := A2_Table_borrow$address_A2_U256_U256$($t87, $t89) // $t91 := read_ref($t90) $t91 := $LoadU256($t90) @@ -2523,7 +2523,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 416), $t95) // $t96 := borrow_local($t14) $t96 := $MakePtr(false, add($locals, 416)) - // $t97 := Table::borrow>($t94, $t96) + // $t97 := Table::borrow>($t94, $t96) $t97 := A2_Table_borrow$address_A2_Table_Table$address_A2_U256_U256$$($t94, $t96) // $t98 := 0xcd $t98 := 0xcd @@ -2531,7 +2531,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 448), $t98) // $t99 := borrow_local($t13) $t99 := $MakePtr(false, add($locals, 448)) - // $t100 := Table::borrow($t97, $t99) + // $t100 := Table::borrow($t97, $t99) $t100 := A2_Table_borrow$address_A2_U256_U256$($t97, $t99) // $t101 := read_ref($t100) $t101 := $LoadU256($t100) @@ -2564,7 +2564,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 480), $t105) // $t106 := borrow_local($t18) $t106 := $MakePtr(false, add($locals, 480)) - // $t107 := Table::borrow_mut>($t104, $t106) + // $t107 := Table::borrow_mut>($t104, $t106) $t107 := A2_Table_borrow_mut$address_A2_Table_Table$address_A2_U256_U256$$($t104, $t106) // $t108 := 0xef $t108 := 0xef @@ -2572,7 +2572,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 512), $t108) // $t109 := borrow_local($t17) $t109 := $MakePtr(false, add($locals, 512)) - // Table::insert($t107, $t109, $t53) + // Table::insert($t107, $t109, $t53) A2_Table_insert$address_A2_U256_U256$($t107, $t109, $t53) // $t110 := borrow_local($t45) $t110 := $MakePtr(false, add($locals, 128)) @@ -2582,7 +2582,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 544), $t111) // $t112 := borrow_local($t23) $t112 := $MakePtr(false, add($locals, 544)) - // $t113 := Table::borrow>($t110, $t112) + // $t113 := Table::borrow>($t110, $t112) $t113 := A2_Table_borrow$address_A2_Table_Table$address_A2_U256_U256$$($t110, $t112) // $t114 := 0xef $t114 := 0xef @@ -2590,7 +2590,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 576), $t114) // $t115 := borrow_local($t21) $t115 := $MakePtr(false, add($locals, 576)) - // $t116 := Table::borrow($t113, $t115) + // $t116 := Table::borrow($t113, $t115) $t116 := A2_Table_borrow$address_A2_U256_U256$($t113, $t115) // $t117 := read_ref($t116) $t117 := $LoadU256($t116) @@ -2623,7 +2623,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 608), $t121) // $t122 := borrow_local($t27) $t122 := $MakePtr(false, add($locals, 608)) - // $t123 := Table::borrow>($t120, $t122) + // $t123 := Table::borrow>($t120, $t122) $t123 := A2_Table_borrow$address_A2_Table_Table$address_A2_U256_U256$$($t120, $t122) // $t124 := 0xab $t124 := 0xab @@ -2631,7 +2631,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 640), $t124) // $t125 := borrow_local($t26) $t125 := $MakePtr(false, add($locals, 640)) - // $t126 := Table::borrow($t123, $t125) + // $t126 := Table::borrow($t123, $t125) $t126 := A2_Table_borrow$address_A2_U256_U256$($t123, $t125) // $t127 := read_ref($t126) $t127 := $LoadU256($t126) @@ -2664,7 +2664,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 672), $t131) // $t132 := borrow_local($t31) $t132 := $MakePtr(false, add($locals, 672)) - // $t133 := Table::borrow_mut>($t130, $t132) + // $t133 := Table::borrow_mut>($t130, $t132) $t133 := A2_Table_borrow_mut$address_A2_Table_Table$address_A2_U256_U256$$($t130, $t132) // $t134 := 0xcd $t134 := 0xcd @@ -2672,7 +2672,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 704), $t134) // $t135 := borrow_local($t30) $t135 := $MakePtr(false, add($locals, 704)) - // $t136 := Table::remove($t133, $t135) + // $t136 := Table::remove($t133, $t135) $t136 := A2_Table_remove$address_A2_U256_U256$($t133, $t135) // $t137 := ==($t136, $t52) $t137 := $Eq($t136, $t52) @@ -2703,7 +2703,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 736), $t140) // $t141 := borrow_local($t36) $t141 := $MakePtr(false, add($locals, 736)) - // $t142 := Table::borrow>($t139, $t141) + // $t142 := Table::borrow>($t139, $t141) $t142 := A2_Table_borrow$address_A2_Table_Table$address_A2_U256_U256$$($t139, $t141) // $t143 := 0xcd $t143 := 0xcd @@ -2711,7 +2711,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 768), $t143) // $t144 := borrow_local($t35) $t144 := $MakePtr(false, add($locals, 768)) - // $t145 := Table::contains($t142, $t144) + // $t145 := Table::contains($t142, $t144) $t145 := A2_Table_contains$address_A2_U256_U256$($t142, $t144) // $t146 := !($t145) $t146 := $LogicalNot($t145) @@ -2742,13 +2742,13 @@ object "test_A2_Tables_test_table_of_tables" { $t149 := $MakePtr(false, add($locals, 800)) // $t150 := move($t45) $t150 := mload(add($locals, 128)) - // $t151 := pack Tables::S>($t150) + // $t151 := pack 0x2::Tables::S>($t150) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t150) $t151 := $mem } - // move_to>>($t151, $t149) + // move_to<0x2::Tables::S>>($t151, $t149) { let $base_offset := $MakeTypeStorageBase(0, 0xc5110c9a, $LoadU256($t149)) if $AlignedStorageLoad($base_offset) { @@ -3047,7 +3047,7 @@ object "test_A2_Tables_test_u256" { $Abort($t14) } case 4 { - // $t3 := Table::empty() + // $t3 := Table::empty<0x2::U256::U256, 0x2::U256::U256>() mstore($locals, A2_Table_empty$A2_U256_U256_A2_U256_U256$()) // $t6 := 26542024619833200150143219379677920493647 $t6 := 26542024619833200150143219379677920493647 @@ -3061,13 +3061,13 @@ object "test_A2_Tables_test_u256" { $t9 := $MakePtr(false, $locals) // $t10 := borrow_local($t2) $t10 := $MakePtr(false, add($locals, 32)) - // Table::insert($t9, $t10, $t7) + // Table::insert<0x2::U256::U256, 0x2::U256::U256>($t9, $t10, $t7) A2_Table_insert$A2_U256_U256_A2_U256_U256$($t9, $t10, $t7) // $t11 := borrow_local($t3) $t11 := $MakePtr(false, $locals) // $t12 := borrow_local($t2) $t12 := $MakePtr(false, add($locals, 32)) - // $t13 := Table::contains($t11, $t12) + // $t13 := Table::contains<0x2::U256::U256, 0x2::U256::U256>($t11, $t12) $t13 := A2_Table_contains$A2_U256_U256_A2_U256_U256$($t11, $t12) // if ($t13) goto L1 else goto L0 switch $t13 @@ -3080,7 +3080,7 @@ object "test_A2_Tables_test_u256" { $t15 := $MakePtr(false, $locals) // $t16 := borrow_local($t2) $t16 := $MakePtr(false, add($locals, 32)) - // $t17 := Table::borrow($t15, $t16) + // $t17 := Table::borrow<0x2::U256::U256, 0x2::U256::U256>($t15, $t16) $t17 := A2_Table_borrow$A2_U256_U256_A2_U256_U256$($t15, $t16) // $t18 := read_ref($t17) $t18 := $LoadU256($t17) @@ -3111,7 +3111,7 @@ object "test_A2_Tables_test_u256" { $t22 := $MakePtr(false, $locals) // $t23 := borrow_local($t2) $t23 := $MakePtr(false, add($locals, 32)) - // $t24 := Table::borrow_mut($t22, $t23) + // $t24 := Table::borrow_mut<0x2::U256::U256, 0x2::U256::U256>($t22, $t23) $t24 := A2_Table_borrow_mut$A2_U256_U256_A2_U256_U256$($t22, $t23) // write_ref($t24, $t8) $StoreU256($t24, $t8) @@ -3119,7 +3119,7 @@ object "test_A2_Tables_test_u256" { $t25 := $MakePtr(false, $locals) // $t26 := borrow_local($t2) $t26 := $MakePtr(false, add($locals, 32)) - // $t27 := Table::borrow($t25, $t26) + // $t27 := Table::borrow<0x2::U256::U256, 0x2::U256::U256>($t25, $t26) $t27 := A2_Table_borrow$A2_U256_U256_A2_U256_U256$($t25, $t26) // $t28 := read_ref($t27) $t28 := $LoadU256($t27) @@ -3152,13 +3152,13 @@ object "test_A2_Tables_test_u256" { $t32 := $MakePtr(false, add($locals, 64)) // $t33 := move($t3) $t33 := mload($locals) - // $t34 := pack Tables::S($t33) + // $t34 := pack 0x2::Tables::S<0x2::U256::U256, 0x2::U256::U256>($t33) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t33) $t34 := $mem } - // move_to>($t34, $t32) + // move_to<0x2::Tables::S<0x2::U256::U256, 0x2::U256::U256>>($t34, $t32) { let $base_offset := $MakeTypeStorageBase(0, 0xa20c17a3, $LoadU256($t32)) if $AlignedStorageLoad($base_offset) { @@ -3576,13 +3576,13 @@ object "test_A2_Tables_test_vector" { $t59 := $MakePtr(false, add($locals, 192)) // $t60 := move($t22) $t60 := mload($locals) - // $t61 := pack Tables::S>($t60) + // $t61 := pack 0x2::Tables::S>($t60) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t60) $t61 := $mem } - // move_to>>($t61, $t59) + // move_to<0x2::Tables::S>>($t61, $t59) { let $base_offset := $MakeTypeStorageBase(0, 0xa0362133, $LoadU256($t59)) if $AlignedStorageLoad($base_offset) { @@ -3598,7 +3598,7 @@ object "test_A2_Tables_test_vector" { } // $t62 := 0x42 $t62 := 0x42 - // $t63 := borrow_global>>($t62) + // $t63 := borrow_global<0x2::Tables::S>>($t62) { let $base_offset := $MakeTypeStorageBase(0, 0xa0362133, $t62) if iszero($AlignedStorageLoad($base_offset)) { @@ -3606,7 +3606,7 @@ object "test_A2_Tables_test_vector" { } $t63 := $MakePtr(true, add($base_offset, 32)) } - // $t64 := borrow_field>>.t($t63) + // $t64 := borrow_field<0x2::Tables::S>>.t($t63) $t64 := $t63 // $t65 := 42 $t65 := 42 @@ -3620,7 +3620,7 @@ object "test_A2_Tables_test_vector" { $t68 := 0x1013 // vector::push_back
($t67, $t68) A1_vector_push_back$address$($t67, $t68) - // $t69 := borrow_field>>.t($t63) + // $t69 := borrow_field<0x2::Tables::S>>.t($t63) $t69 := $t63 // $t70 := 42 $t70 := 42 @@ -3656,7 +3656,7 @@ object "test_A2_Tables_test_vector" { } case 17 { // label L14 - // $t77 := borrow_field>>.t($t63) + // $t77 := borrow_field<0x2::Tables::S>>.t($t63) $t77 := $t63 // $t78 := 42 $t78 := 42 @@ -3696,7 +3696,7 @@ object "test_A2_Tables_test_vector" { } case 20 { // label L17 - // $t87 := borrow_field>>.t($t63) + // $t87 := borrow_field<0x2::Tables::S>>.t($t63) $t87 := $t63 // $t88 := 42 $t88 := 42 @@ -3798,7 +3798,7 @@ object "test_A2_Tables_test_vector" { } case 29 { // label L26 - // $t109 := borrow_field>>.t($t63) + // $t109 := borrow_field<0x2::Tables::S>>.t($t63) $t109 := $t63 // $t110 := 42 $t110 := 42 diff --git a/third_party/move/evm/move-to-yul/tests/TestABIStructs.exp b/third_party/move/evm/move-to-yul/tests/TestABIStructs.exp index 49a3eb0ea4782..06d766ee22495 100644 --- a/third_party/move/evm/move-to-yul/tests/TestABIStructs.exp +++ b/third_party/move/evm/move-to-yul/tests/TestABIStructs.exp @@ -101,13 +101,13 @@ object "A2_M" { $t1 := true // $t2 := M::pack_S($t0, $t1) $t2 := A2_M_pack_S($t0, $t1) - // $t3 := pack M::Event_S($t2) + // $t3 := pack 0x2::M::Event_S($t2) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t2) $t3 := $mem } - // Evm::emit($t3) + // Evm::emit<0x2::M::Event_S>($t3) A2_Evm_emit$A2_M_Event_S$($t3) // return () } @@ -130,7 +130,7 @@ object "A2_M" { $t1 := $MakePtr(false, $locals) // $t2 := 0 $t2 := 0 - // $t3 := vector::borrow>($t1, $t2) + // $t3 := vector::borrow>($t1, $t2) $t3 := A1_vector_borrow$vec$A2_M_S$$($t1, $t2) // $t4 := read_ref($t3) $t4 := $LoadU256($t3) @@ -244,7 +244,7 @@ object "A2_M" { function A2_M_pack_S(a, b) -> $result { let s2, $t4, $t5, $t6, $t7, $t8 let $locals := $Malloc(32) - // $t3 := vector::empty() + // $t3 := vector::empty<0x2::M::S2>() mstore($locals, A1_vector_empty$A2_M_S2$()) // $t4 := (u128)($t0) $t4 := $CastU128(a) @@ -252,11 +252,11 @@ object "A2_M" { $t5 := A2_M_pack_S2($t4) // $t6 := borrow_local($t3) $t6 := $MakePtr(false, $locals) - // vector::push_back($t6, $t5) + // vector::push_back<0x2::M::S2>($t6, $t5) A1_vector_push_back$A2_M_S2$($t6, $t5) // $t7 := move($t3) $t7 := mload($locals) - // $t8 := pack M::S($t0, $t1, $t7) + // $t8 := pack 0x2::M::S($t0, $t1, $t7) { let $mem := $Malloc(41) $MemoryStoreU64(add($mem, 32), a) @@ -314,7 +314,7 @@ object "A2_M" { A1_vector_push_back$u128$($t2, x) // $t3 := move($t1) $t3 := mload($locals) - // $t4 := pack M::S2($t3) + // $t4 := pack 0x2::M::S2($t3) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t3) @@ -1068,13 +1068,13 @@ object "test_A2_M_test_abi_S" { _s := A2_M_decode_S($t7) // $t8 := borrow_local($t2) $t8 := $MakePtr(false, s) - // $t9 := borrow_field.a($t8) + // $t9 := borrow_field<0x2::M::S>.a($t8) $t9 := $IndexPtr($t8, 32) // $t10 := read_ref($t9) $t10 := $LoadU64($t9) // $t11 := borrow_local($t0) $t11 := $MakePtr(false, _s) - // $t12 := borrow_field.a($t11) + // $t12 := borrow_field<0x2::M::S>.a($t11) $t12 := $IndexPtr($t11, 32) // $t13 := read_ref($t12) $t13 := $LoadU64($t12) @@ -1089,7 +1089,7 @@ object "test_A2_M_test_abi_S" { // label L2 // $t16 := borrow_local($t0) $t16 := $MakePtr(false, _s) - // $t17 := borrow_field.a($t16) + // $t17 := borrow_field<0x2::M::S>.a($t16) $t17 := $IndexPtr($t16, 32) // $t18 := read_ref($t17) $t18 := $LoadU64($t17) @@ -1118,13 +1118,13 @@ object "test_A2_M_test_abi_S" { // label L5 // $t22 := borrow_local($t2) $t22 := $MakePtr(false, s) - // $t23 := borrow_field.b($t22) + // $t23 := borrow_field<0x2::M::S>.b($t22) $t23 := $IndexPtr($t22, 40) // $t24 := read_ref($t23) $t24 := $LoadU8($t23) // $t25 := borrow_local($t0) $t25 := $MakePtr(false, _s) - // $t26 := borrow_field.b($t25) + // $t26 := borrow_field<0x2::M::S>.b($t25) $t26 := $IndexPtr($t25, 40) // $t27 := read_ref($t26) $t27 := $LoadU8($t26) @@ -1151,7 +1151,7 @@ object "test_A2_M_test_abi_S" { // label L8 // $t30 := borrow_local($t0) $t30 := $MakePtr(false, _s) - // $t31 := borrow_field.b($t30) + // $t31 := borrow_field<0x2::M::S>.b($t30) $t31 := $IndexPtr($t30, 40) // $t32 := read_ref($t31) $t32 := $LoadU8($t31) @@ -1180,7 +1180,7 @@ object "test_A2_M_test_abi_S" { // label L11 // $t36 := borrow_local($t2) $t36 := $MakePtr(false, s) - // $t37 := borrow_field.c($t36) + // $t37 := borrow_field<0x2::M::S>.c($t36) $t37 := $t36 // $t3 := read_ref($t37) mstore($locals, $LoadU256($t37)) @@ -1222,7 +1222,7 @@ object "test_A2_M_test_abi_S" { } // $t38 := borrow_local($t0) $t38 := $MakePtr(false, _s) - // $t39 := borrow_field.c($t38) + // $t39 := borrow_field<0x2::M::S>.c($t38) $t39 := $t38 // $t1 := read_ref($t39) mstore(add($locals, 32), $LoadU256($t39)) @@ -1264,7 +1264,7 @@ object "test_A2_M_test_abi_S" { } // $t40 := borrow_local($t3) $t40 := $MakePtr(false, $locals) - // $t41 := vector::length($t40) + // $t41 := vector::length<0x2::M::S2>($t40) $t41 := A1_vector_length$A2_M_S2$($t40) // $t42 := 1 $t42 := 1 @@ -1291,7 +1291,7 @@ object "test_A2_M_test_abi_S" { // label L14 // $t45 := borrow_local($t1) $t45 := $MakePtr(false, add($locals, 32)) - // $t46 := vector::length($t45) + // $t46 := vector::length<0x2::M::S2>($t45) $t46 := A1_vector_length$A2_M_S2$($t45) // $t47 := 1 $t47 := 1 @@ -1320,9 +1320,9 @@ object "test_A2_M_test_abi_S" { $t50 := $MakePtr(false, add($locals, 32)) // $t51 := 0 $t51 := 0 - // $t52 := vector::borrow($t50, $t51) + // $t52 := vector::borrow<0x2::M::S2>($t50, $t51) $t52 := A1_vector_borrow$A2_M_S2$($t50, $t51) - // $t53 := borrow_field.x($t52) + // $t53 := borrow_field<0x2::M::S2>.x($t52) $t53 := $t52 // $t54 := 0 $t54 := 0 @@ -1404,7 +1404,7 @@ object "test_A2_M_test_abi_S" { function A2_M_pack_S(a, b) -> $result { let s2, $t4, $t5, $t6, $t7, $t8 let $locals := $Malloc(32) - // $t3 := vector::empty() + // $t3 := vector::empty<0x2::M::S2>() mstore($locals, A1_vector_empty$A2_M_S2$()) // $t4 := (u128)($t0) $t4 := $CastU128(a) @@ -1412,11 +1412,11 @@ object "test_A2_M_test_abi_S" { $t5 := A2_M_pack_S2($t4) // $t6 := borrow_local($t3) $t6 := $MakePtr(false, $locals) - // vector::push_back($t6, $t5) + // vector::push_back<0x2::M::S2>($t6, $t5) A1_vector_push_back$A2_M_S2$($t6, $t5) // $t7 := move($t3) $t7 := mload($locals) - // $t8 := pack M::S($t0, $t1, $t7) + // $t8 := pack 0x2::M::S($t0, $t1, $t7) { let $mem := $Malloc(41) $MemoryStoreU64(add($mem, 32), a) @@ -1474,7 +1474,7 @@ object "test_A2_M_test_abi_S" { A1_vector_push_back$u128$($t2, x) // $t3 := move($t1) $t3 := mload($locals) - // $t4 := pack M::S2($t3) + // $t4 := pack 0x2::M::S2($t3) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t3) @@ -2216,7 +2216,7 @@ object "test_A2_M_test_abi_String" { } function A1_ascii_into_bytes(string) -> $result { let $t1 - // $t1 := unpack ascii::String($t0) + // $t1 := unpack 0x1::ascii::String($t0) $t1 := $MemoryLoadU256(add(string, 0)) $Free(string, 32) // return $t1 @@ -2249,7 +2249,7 @@ object "test_A2_M_test_abi_String" { function A1_ascii_as_bytes(string) -> $result { let $t1 - // $t1 := borrow_field.bytes($t0) + // $t1 := borrow_field<0x1::ascii::String>.bytes($t0) $t1 := string // return $t1 $result := $t1 @@ -2297,7 +2297,7 @@ object "test_A2_M_test_abi_String" { x := A1_ascii_try_string(bytes) // $t2 := borrow_local($t1) $t2 := $MakePtr(false, x) - // $t3 := option::is_some($t2) + // $t3 := option::is_some<0x1::ascii::String>($t2) $t3 := A1_option_is_some$A1_ascii_String$($t2) // if ($t3) goto L1 else goto L0 switch $t3 @@ -2308,7 +2308,7 @@ object "test_A2_M_test_abi_String" { // label L2 // $t5 := move($t1) $t5 := x - // $t6 := option::destroy_some($t5) + // $t6 := option::destroy_some<0x1::ascii::String>($t5) $t6 := A1_option_destroy_some$A1_ascii_String$($t5) // return $t6 $result := $t6 @@ -2349,7 +2349,7 @@ object "test_A2_M_test_abi_String" { // label L2 // $t6 := move($t0) $t6 := t - // $t2 := unpack option::Option<#0>($t6) + // $t2 := unpack 0x1::option::Option<#0>($t6) mstore($locals, $MemoryLoadU256(add($t6, 0))) $Free($t6, 32) // $t7 := borrow_local($t2) @@ -2409,7 +2409,7 @@ object "test_A2_M_test_abi_String" { } function A1_option_is_some$A1_ascii_String$(t) -> $result { let $t1, $t2, $t3 - // $t1 := borrow_field>.vec($t0) + // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$A1_ascii_String$($t1) @@ -2477,13 +2477,13 @@ object "test_A2_M_test_abi_String" { // assert forall j: num: Range(0, $t4): ascii::is_valid_char(Index($t0, j)) // $t14 := move($t0) $t14 := mload($locals) - // $t15 := pack ascii::String($t14) + // $t15 := pack 0x1::ascii::String($t14) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t14) $t15 := $mem } - // $t16 := option::some($t15) + // $t16 := option::some<0x1::ascii::String>($t15) $t16 := A1_option_some$A1_ascii_String$($t15) // return $t16 $result := $t16 @@ -2509,7 +2509,7 @@ object "test_A2_M_test_abi_String" { } case 7 { // label L4 - // $t12 := option::none() + // $t12 := option::none<0x1::ascii::String>() $t12 := A1_option_none$A1_ascii_String$() // return $t12 $result := $t12 @@ -2532,7 +2532,7 @@ object "test_A2_M_test_abi_String" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$A1_ascii_String$() - // $t1 := pack option::Option<#0>($t0) + // $t1 := pack 0x1::option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -2550,7 +2550,7 @@ object "test_A2_M_test_abi_String" { let $t1, $t2 // $t1 := vector::singleton<#0>($t0) $t1 := A1_vector_singleton$A1_ascii_String$(e) - // $t2 := pack option::Option<#0>($t1) + // $t2 := pack 0x1::option::Option<#0>($t1) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t1) diff --git a/third_party/move/evm/move-to-yul/tests/TestExternalResult.exp b/third_party/move/evm/move-to-yul/tests/TestExternalResult.exp index 0efdfd006698d..53d43f5dcd892 100644 --- a/third_party/move/evm/move-to-yul/tests/TestExternalResult.exp +++ b/third_party/move/evm/move-to-yul/tests/TestExternalResult.exp @@ -171,7 +171,7 @@ object "test_A2_M_extract_err_data" { } function A2_ExternalResult_unwrap_err_data$u64$(result) -> $result { let err_data, err_reason, panic_code, $t4, $t5, $t6, $t7, $t8 - // ($t4, $t5, $t6, $t7) := unpack ExternalResult::ExternalResult<#0>($t0) + // ($t4, $t5, $t6, $t7) := unpack 0x2::ExternalResult::ExternalResult<#0>($t0) $t4 := $MemoryLoadU256(add(result, 0)) $t5 := $MemoryLoadU256(add(result, 32)) $t6 := $MemoryLoadU256(add(result, 64)) @@ -181,7 +181,7 @@ object "test_A2_M_extract_err_data" { A1_option_destroy_none$u64$($t4) // option::destroy_none>($t6) A1_option_destroy_none$vec$u8$$($t6) - // option::destroy_none($t7) + // option::destroy_none<0x2::U256::U256>($t7) A1_option_destroy_none$A2_U256_U256$($t7) // $t8 := option::destroy_some>($t5) $t8 := A1_option_destroy_some$vec$u8$$($t5) @@ -221,7 +221,7 @@ object "test_A2_M_extract_err_data" { // label L2 // $t6 := move($t0) $t6 := t - // $t2 := unpack option::Option<#0>($t6) + // $t2 := unpack 0x1::option::Option<#0>($t6) mstore($locals, $MemoryLoadU256(add($t6, 0))) $Free($t6, 32) // $t7 := borrow_local($t2) @@ -274,7 +274,7 @@ object "test_A2_M_extract_err_data" { } function A1_option_is_some$vec$u8$$(t) -> $result { let $t1, $t2, $t3 - // $t1 := borrow_field>.vec($t0) + // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$vec$u8$$($t1) @@ -332,7 +332,7 @@ object "test_A2_M_extract_err_data" { // label L2 // $t4 := move($t0) $t4 := t - // $t5 := unpack option::Option<#0>($t4) + // $t5 := unpack 0x1::option::Option<#0>($t4) $t5 := $MemoryLoadU256(add($t4, 0)) $Free($t4, 32) // vector::destroy_empty<#0>($t5) @@ -351,7 +351,7 @@ object "test_A2_M_extract_err_data" { } function A1_option_is_none$A2_U256_U256$(t) -> $result { let $t1, $t2 - // $t1 := borrow_field>.vec($t0) + // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$A2_U256_U256$($t1) @@ -407,7 +407,7 @@ object "test_A2_M_extract_err_data" { // label L2 // $t4 := move($t0) $t4 := t - // $t5 := unpack option::Option<#0>($t4) + // $t5 := unpack 0x1::option::Option<#0>($t4) $t5 := $MemoryLoadU256(add($t4, 0)) $Free($t4, 32) // vector::destroy_empty<#0>($t5) @@ -420,7 +420,7 @@ object "test_A2_M_extract_err_data" { function A1_option_is_none$vec$u8$$(t) -> $result { let $t1, $t2 - // $t1 := borrow_field>.vec($t0) + // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$vec$u8$$($t1) @@ -459,7 +459,7 @@ object "test_A2_M_extract_err_data" { // label L2 // $t4 := move($t0) $t4 := t - // $t5 := unpack option::Option<#0>($t4) + // $t5 := unpack 0x1::option::Option<#0>($t4) $t5 := $MemoryLoadU256(add($t4, 0)) $Free($t4, 32) // vector::destroy_empty<#0>($t5) @@ -478,7 +478,7 @@ object "test_A2_M_extract_err_data" { } function A1_option_is_none$u64$(t) -> $result { let $t1, $t2 - // $t1 := borrow_field>.vec($t0) + // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$u64$($t1) @@ -505,7 +505,7 @@ object "test_A2_M_extract_err_data" { } function A2_ExternalResult_is_err_data$u64$(result) -> $result { let $t1, $t2 - // $t1 := borrow_field>.err_data($t0) + // $t1 := borrow_field<0x2::ExternalResult::ExternalResult<#0>>.err_data($t0) { let $field_ptr := $IndexPtr(result, 32) $t1 := $MakePtr($IsStoragePtr($field_ptr), $LoadU256($field_ptr)) @@ -532,9 +532,9 @@ object "test_A2_M_extract_err_data" { $t2 := A1_option_some$vec$u8$$(error) // $t3 := option::none>() $t3 := A1_option_none$vec$u8$$() - // $t4 := option::none() + // $t4 := option::none<0x2::U256::U256>() $t4 := A1_option_none$A2_U256_U256$() - // $t5 := pack ExternalResult::ExternalResult<#0>($t1, $t2, $t3, $t4) + // $t5 := pack 0x2::ExternalResult::ExternalResult<#0>($t1, $t2, $t3, $t4) { let $mem := $Malloc(128) $MemoryStoreU256(add($mem, 0), $t1) @@ -551,7 +551,7 @@ object "test_A2_M_extract_err_data" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$A2_U256_U256$() - // $t1 := pack option::Option<#0>($t0) + // $t1 := pack 0x1::option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -569,7 +569,7 @@ object "test_A2_M_extract_err_data" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$vec$u8$$() - // $t1 := pack option::Option<#0>($t0) + // $t1 := pack 0x1::option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -587,7 +587,7 @@ object "test_A2_M_extract_err_data" { let $t1, $t2 // $t1 := vector::singleton<#0>($t0) $t1 := A1_vector_singleton$vec$u8$$(e) - // $t2 := pack option::Option<#0>($t1) + // $t2 := pack 0x1::option::Option<#0>($t1) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t1) @@ -645,7 +645,7 @@ object "test_A2_M_extract_err_data" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$u64$() - // $t1 := pack option::Option<#0>($t0) + // $t1 := pack 0x1::option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -1082,7 +1082,7 @@ object "test_A2_M_extract_err_reason" { } function A2_ExternalResult_unwrap_err_reason$u64$(result) -> $result { let err_data, err_reason, panic_code, $t4, $t5, $t6, $t7, $t8 - // ($t4, $t5, $t6, $t7) := unpack ExternalResult::ExternalResult<#0>($t0) + // ($t4, $t5, $t6, $t7) := unpack 0x2::ExternalResult::ExternalResult<#0>($t0) $t4 := $MemoryLoadU256(add(result, 0)) $t5 := $MemoryLoadU256(add(result, 32)) $t6 := $MemoryLoadU256(add(result, 64)) @@ -1092,7 +1092,7 @@ object "test_A2_M_extract_err_reason" { A1_option_destroy_none$u64$($t4) // option::destroy_none>($t5) A1_option_destroy_none$vec$u8$$($t5) - // option::destroy_none($t7) + // option::destroy_none<0x2::U256::U256>($t7) A1_option_destroy_none$A2_U256_U256$($t7) // $t8 := option::destroy_some>($t6) $t8 := A1_option_destroy_some$vec$u8$$($t6) @@ -1132,7 +1132,7 @@ object "test_A2_M_extract_err_reason" { // label L2 // $t6 := move($t0) $t6 := t - // $t2 := unpack option::Option<#0>($t6) + // $t2 := unpack 0x1::option::Option<#0>($t6) mstore($locals, $MemoryLoadU256(add($t6, 0))) $Free($t6, 32) // $t7 := borrow_local($t2) @@ -1185,7 +1185,7 @@ object "test_A2_M_extract_err_reason" { } function A1_option_is_some$vec$u8$$(t) -> $result { let $t1, $t2, $t3 - // $t1 := borrow_field>.vec($t0) + // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$vec$u8$$($t1) @@ -1243,7 +1243,7 @@ object "test_A2_M_extract_err_reason" { // label L2 // $t4 := move($t0) $t4 := t - // $t5 := unpack option::Option<#0>($t4) + // $t5 := unpack 0x1::option::Option<#0>($t4) $t5 := $MemoryLoadU256(add($t4, 0)) $Free($t4, 32) // vector::destroy_empty<#0>($t5) @@ -1262,7 +1262,7 @@ object "test_A2_M_extract_err_reason" { } function A1_option_is_none$A2_U256_U256$(t) -> $result { let $t1, $t2 - // $t1 := borrow_field>.vec($t0) + // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$A2_U256_U256$($t1) @@ -1318,7 +1318,7 @@ object "test_A2_M_extract_err_reason" { // label L2 // $t4 := move($t0) $t4 := t - // $t5 := unpack option::Option<#0>($t4) + // $t5 := unpack 0x1::option::Option<#0>($t4) $t5 := $MemoryLoadU256(add($t4, 0)) $Free($t4, 32) // vector::destroy_empty<#0>($t5) @@ -1331,7 +1331,7 @@ object "test_A2_M_extract_err_reason" { function A1_option_is_none$vec$u8$$(t) -> $result { let $t1, $t2 - // $t1 := borrow_field>.vec($t0) + // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$vec$u8$$($t1) @@ -1370,7 +1370,7 @@ object "test_A2_M_extract_err_reason" { // label L2 // $t4 := move($t0) $t4 := t - // $t5 := unpack option::Option<#0>($t4) + // $t5 := unpack 0x1::option::Option<#0>($t4) $t5 := $MemoryLoadU256(add($t4, 0)) $Free($t4, 32) // vector::destroy_empty<#0>($t5) @@ -1389,7 +1389,7 @@ object "test_A2_M_extract_err_reason" { } function A1_option_is_none$u64$(t) -> $result { let $t1, $t2 - // $t1 := borrow_field>.vec($t0) + // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$u64$($t1) @@ -1416,7 +1416,7 @@ object "test_A2_M_extract_err_reason" { } function A2_ExternalResult_is_err_reason$u64$(result) -> $result { let $t1, $t2 - // $t1 := borrow_field>.err_reason($t0) + // $t1 := borrow_field<0x2::ExternalResult::ExternalResult<#0>>.err_reason($t0) { let $field_ptr := $IndexPtr(result, 64) $t1 := $MakePtr($IsStoragePtr($field_ptr), $LoadU256($field_ptr)) @@ -1443,9 +1443,9 @@ object "test_A2_M_extract_err_reason" { $t6 := A1_option_some$vec$u8$$(error) // $t7 := option::none>() $t7 := A1_option_none$vec$u8$$() - // $t8 := option::none() + // $t8 := option::none<0x2::U256::U256>() $t8 := A1_option_none$A2_U256_U256$() - // $t9 := pack ExternalResult::ExternalResult<#0>($t5, $t7, $t6, $t8) + // $t9 := pack 0x2::ExternalResult::ExternalResult<#0>($t5, $t7, $t6, $t8) { let $mem := $Malloc(128) $MemoryStoreU256(add($mem, 0), $t5) @@ -1462,7 +1462,7 @@ object "test_A2_M_extract_err_reason" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$A2_U256_U256$() - // $t1 := pack option::Option<#0>($t0) + // $t1 := pack 0x1::option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -1480,7 +1480,7 @@ object "test_A2_M_extract_err_reason" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$vec$u8$$() - // $t1 := pack option::Option<#0>($t0) + // $t1 := pack 0x1::option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -1498,7 +1498,7 @@ object "test_A2_M_extract_err_reason" { let $t1, $t2 // $t1 := vector::singleton<#0>($t0) $t1 := A1_vector_singleton$vec$u8$$(e) - // $t2 := pack option::Option<#0>($t1) + // $t2 := pack 0x1::option::Option<#0>($t1) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t1) @@ -1556,7 +1556,7 @@ object "test_A2_M_extract_err_reason" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$u64$() - // $t1 := pack option::Option<#0>($t0) + // $t1 := pack 0x1::option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -1950,7 +1950,7 @@ object "test_A2_M_extract_panic_code" { function A2_ExternalResult_unwrap_panic$u64$(result) -> $result { let err_data, err_reason, panic_code, $t4, $t5, $t6, $t7, $t8 - // ($t4, $t5, $t6, $t7) := unpack ExternalResult::ExternalResult<#0>($t0) + // ($t4, $t5, $t6, $t7) := unpack 0x2::ExternalResult::ExternalResult<#0>($t0) $t4 := $MemoryLoadU256(add(result, 0)) $t5 := $MemoryLoadU256(add(result, 32)) $t6 := $MemoryLoadU256(add(result, 64)) @@ -1962,7 +1962,7 @@ object "test_A2_M_extract_panic_code" { A1_option_destroy_none$vec$u8$$($t6) // option::destroy_none>($t5) A1_option_destroy_none$vec$u8$$($t5) - // $t8 := option::destroy_some($t7) + // $t8 := option::destroy_some<0x2::U256::U256>($t7) $t8 := A1_option_destroy_some$A2_U256_U256$($t7) // return $t8 $result := $t8 @@ -2000,7 +2000,7 @@ object "test_A2_M_extract_panic_code" { // label L2 // $t6 := move($t0) $t6 := t - // $t2 := unpack option::Option<#0>($t6) + // $t2 := unpack 0x1::option::Option<#0>($t6) mstore($locals, $MemoryLoadU256(add($t6, 0))) $Free($t6, 32) // $t7 := borrow_local($t2) @@ -2036,7 +2036,7 @@ object "test_A2_M_extract_panic_code" { } function A1_option_is_some$A2_U256_U256$(t) -> $result { let $t1, $t2, $t3 - // $t1 := borrow_field>.vec($t0) + // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$A2_U256_U256$($t1) @@ -2094,7 +2094,7 @@ object "test_A2_M_extract_panic_code" { // label L2 // $t4 := move($t0) $t4 := t - // $t5 := unpack option::Option<#0>($t4) + // $t5 := unpack 0x1::option::Option<#0>($t4) $t5 := $MemoryLoadU256(add($t4, 0)) $Free($t4, 32) // vector::destroy_empty<#0>($t5) @@ -2113,7 +2113,7 @@ object "test_A2_M_extract_panic_code" { } function A1_option_is_none$vec$u8$$(t) -> $result { let $t1, $t2 - // $t1 := borrow_field>.vec($t0) + // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$vec$u8$$($t1) @@ -2169,7 +2169,7 @@ object "test_A2_M_extract_panic_code" { // label L2 // $t4 := move($t0) $t4 := t - // $t5 := unpack option::Option<#0>($t4) + // $t5 := unpack 0x1::option::Option<#0>($t4) $t5 := $MemoryLoadU256(add($t4, 0)) $Free($t4, 32) // vector::destroy_empty<#0>($t5) @@ -2188,7 +2188,7 @@ object "test_A2_M_extract_panic_code" { } function A1_option_is_none$u64$(t) -> $result { let $t1, $t2 - // $t1 := borrow_field>.vec($t0) + // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$u64$($t1) @@ -2215,12 +2215,12 @@ object "test_A2_M_extract_panic_code" { } function A2_ExternalResult_is_panic$u64$(result) -> $result { let $t1, $t2 - // $t1 := borrow_field>.panic_code($t0) + // $t1 := borrow_field<0x2::ExternalResult::ExternalResult<#0>>.panic_code($t0) { let $field_ptr := $IndexPtr(result, 96) $t1 := $MakePtr($IsStoragePtr($field_ptr), $LoadU256($field_ptr)) } - // $t2 := option::is_some($t1) + // $t2 := option::is_some<0x2::U256::U256>($t1) $t2 := A1_option_is_some$A2_U256_U256$($t1) // return $t2 $result := $t2 @@ -2242,9 +2242,9 @@ object "test_A2_M_extract_panic_code" { $t6 := A1_option_none$vec$u8$$() // $t7 := option::none>() $t7 := A1_option_none$vec$u8$$() - // $t8 := option::some($t0) + // $t8 := option::some<0x2::U256::U256>($t0) $t8 := A1_option_some$A2_U256_U256$(panic_code) - // $t9 := pack ExternalResult::ExternalResult<#0>($t5, $t7, $t6, $t8) + // $t9 := pack 0x2::ExternalResult::ExternalResult<#0>($t5, $t7, $t6, $t8) { let $mem := $Malloc(128) $MemoryStoreU256(add($mem, 0), $t5) @@ -2261,7 +2261,7 @@ object "test_A2_M_extract_panic_code" { let $t1, $t2 // $t1 := vector::singleton<#0>($t0) $t1 := A1_vector_singleton$A2_U256_U256$(e) - // $t2 := pack option::Option<#0>($t1) + // $t2 := pack 0x1::option::Option<#0>($t1) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t1) @@ -2309,7 +2309,7 @@ object "test_A2_M_extract_panic_code" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$vec$u8$$() - // $t1 := pack option::Option<#0>($t0) + // $t1 := pack 0x1::option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -2327,7 +2327,7 @@ object "test_A2_M_extract_panic_code" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$u64$() - // $t1 := pack option::Option<#0>($t0) + // $t1 := pack 0x1::option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -2632,7 +2632,7 @@ object "test_A2_M_extract_value" { function A2_ExternalResult_unwrap$u64$(result) -> $result { let err_data, err_reason, panic_code, value, $t5, $t6, $t7, $t8, $t9 - // ($t5, $t6, $t7, $t8) := unpack ExternalResult::ExternalResult<#0>($t0) + // ($t5, $t6, $t7, $t8) := unpack 0x2::ExternalResult::ExternalResult<#0>($t0) $t5 := $MemoryLoadU256(add(result, 0)) $t6 := $MemoryLoadU256(add(result, 32)) $t7 := $MemoryLoadU256(add(result, 64)) @@ -2642,7 +2642,7 @@ object "test_A2_M_extract_value" { A1_option_destroy_none$vec$u8$$($t6) // option::destroy_none>($t7) A1_option_destroy_none$vec$u8$$($t7) - // option::destroy_none($t8) + // option::destroy_none<0x2::U256::U256>($t8) A1_option_destroy_none$A2_U256_U256$($t8) // $t9 := option::destroy_some<#0>($t5) $t9 := A1_option_destroy_some$u64$($t5) @@ -2682,7 +2682,7 @@ object "test_A2_M_extract_value" { // label L2 // $t6 := move($t0) $t6 := t - // $t2 := unpack option::Option<#0>($t6) + // $t2 := unpack 0x1::option::Option<#0>($t6) mstore($locals, $MemoryLoadU256(add($t6, 0))) $Free($t6, 32) // $t7 := borrow_local($t2) @@ -2718,7 +2718,7 @@ object "test_A2_M_extract_value" { } function A1_option_is_some$u64$(t) -> $result { let $t1, $t2, $t3 - // $t1 := borrow_field>.vec($t0) + // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$u64$($t1) @@ -2776,7 +2776,7 @@ object "test_A2_M_extract_value" { // label L2 // $t4 := move($t0) $t4 := t - // $t5 := unpack option::Option<#0>($t4) + // $t5 := unpack 0x1::option::Option<#0>($t4) $t5 := $MemoryLoadU256(add($t4, 0)) $Free($t4, 32) // vector::destroy_empty<#0>($t5) @@ -2795,7 +2795,7 @@ object "test_A2_M_extract_value" { } function A1_option_is_none$A2_U256_U256$(t) -> $result { let $t1, $t2 - // $t1 := borrow_field>.vec($t0) + // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$A2_U256_U256$($t1) @@ -2851,7 +2851,7 @@ object "test_A2_M_extract_value" { // label L2 // $t4 := move($t0) $t4 := t - // $t5 := unpack option::Option<#0>($t4) + // $t5 := unpack 0x1::option::Option<#0>($t4) $t5 := $MemoryLoadU256(add($t4, 0)) $Free($t4, 32) // vector::destroy_empty<#0>($t5) @@ -2870,7 +2870,7 @@ object "test_A2_M_extract_value" { } function A1_option_is_none$vec$u8$$(t) -> $result { let $t1, $t2 - // $t1 := borrow_field>.vec($t0) + // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$vec$u8$$($t1) @@ -2897,7 +2897,7 @@ object "test_A2_M_extract_value" { } function A2_ExternalResult_is_ok$u64$(result) -> $result { let $t1, $t2 - // $t1 := borrow_field>.value($t0) + // $t1 := borrow_field<0x2::ExternalResult::ExternalResult<#0>>.value($t0) { $t1 := $MakePtr($IsStoragePtr(result), $LoadU256(result)) } @@ -2923,9 +2923,9 @@ object "test_A2_M_extract_value" { $t2 := A1_option_none$vec$u8$$() // $t3 := option::none>() $t3 := A1_option_none$vec$u8$$() - // $t4 := option::none() + // $t4 := option::none<0x2::U256::U256>() $t4 := A1_option_none$A2_U256_U256$() - // $t5 := pack ExternalResult::ExternalResult<#0>($t1, $t2, $t3, $t4) + // $t5 := pack 0x2::ExternalResult::ExternalResult<#0>($t1, $t2, $t3, $t4) { let $mem := $Malloc(128) $MemoryStoreU256(add($mem, 0), $t1) @@ -2942,7 +2942,7 @@ object "test_A2_M_extract_value" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$A2_U256_U256$() - // $t1 := pack option::Option<#0>($t0) + // $t1 := pack 0x1::option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -2960,7 +2960,7 @@ object "test_A2_M_extract_value" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$vec$u8$$() - // $t1 := pack option::Option<#0>($t0) + // $t1 := pack 0x1::option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -2978,7 +2978,7 @@ object "test_A2_M_extract_value" { let $t1, $t2 // $t1 := vector::singleton<#0>($t0) $t1 := A1_vector_singleton$u64$(e) - // $t2 := pack option::Option<#0>($t1) + // $t2 := pack 0x1::option::Option<#0>($t1) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t1) diff --git a/third_party/move/evm/move-to-yul/tests/TestStringLiteral.exp b/third_party/move/evm/move-to-yul/tests/TestStringLiteral.exp index 7ff6ff55a5591..d268ad845efe2 100644 --- a/third_party/move/evm/move-to-yul/tests/TestStringLiteral.exp +++ b/third_party/move/evm/move-to-yul/tests/TestStringLiteral.exp @@ -76,13 +76,13 @@ object "test_A2_M_h1" { $MemoryStoreU64($t5, 3) $MemoryStoreU64(add($t5, 8), $ClosestGreaterPowerOfTwo(3)) copy_literal_string_to_memory_2053440334(add($t5, 32)) - // $t6 := pack M::T($t5) + // $t6 := pack 0x2::M::T($t5) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t5) $t6 := $mem } - // move_to($t6, $t4) + // move_to<0x2::M::T>($t6, $t4) { let $base_offset := $MakeTypeStorageBase(0, 0x3948ca0a, $LoadU256($t4)) if $AlignedStorageLoad($base_offset) { @@ -111,7 +111,7 @@ object "test_A2_M_h1" { } // $t7 := 0x3 $t7 := 0x3 - // $t8 := borrow_global($t7) + // $t8 := borrow_global<0x2::M::T>($t7) { let $base_offset := $MakeTypeStorageBase(0, 0x3948ca0a, $t7) if iszero($AlignedStorageLoad($base_offset)) { @@ -119,7 +119,7 @@ object "test_A2_M_h1" { } $t8 := $MakePtr(true, add($base_offset, 32)) } - // $t9 := borrow_field.s($t8) + // $t9 := borrow_field<0x2::M::T>.s($t8) $t9 := $t8 // $t1 := read_ref($t9) mstore(add($locals, 32), $LoadU256($t9)) @@ -253,7 +253,7 @@ object "test_A2_M_h1" { copy_literal_string_to_memory_2788570470(add($t36, 32)) // $t37 := 0x3 $t37 := 0x3 - // $t38 := borrow_global($t37) + // $t38 := borrow_global<0x2::M::T>($t37) { let $base_offset := $MakeTypeStorageBase(0, 0x3948ca0a, $t37) if iszero($AlignedStorageLoad($base_offset)) { @@ -261,7 +261,7 @@ object "test_A2_M_h1" { } $t38 := $MakePtr(true, add($base_offset, 32)) } - // $t39 := borrow_field.s($t38) + // $t39 := borrow_field<0x2::M::T>.s($t38) $t39 := $t38 // write_ref($t39, $t36) if $IsStoragePtr($t39){ @@ -279,7 +279,7 @@ object "test_A2_M_h1" { $StoreU256($t39, $t36) // $t40 := 0x3 $t40 := 0x3 - // $t41 := borrow_global($t40) + // $t41 := borrow_global<0x2::M::T>($t40) { let $base_offset := $MakeTypeStorageBase(0, 0x3948ca0a, $t40) if iszero($AlignedStorageLoad($base_offset)) { @@ -287,7 +287,7 @@ object "test_A2_M_h1" { } $t41 := $MakePtr(true, add($base_offset, 32)) } - // $t42 := borrow_field.s($t41) + // $t42 := borrow_field<0x2::M::T>.s($t41) $t42 := $t41 // $t2 := read_ref($t42) mstore(add($locals, 64), $LoadU256($t42)) diff --git a/third_party/move/evm/move-to-yul/tests/Vectors.exp b/third_party/move/evm/move-to-yul/tests/Vectors.exp index b173205f13135..0c52bbbddab24 100644 --- a/third_party/move/evm/move-to-yul/tests/Vectors.exp +++ b/third_party/move/evm/move-to-yul/tests/Vectors.exp @@ -622,7 +622,7 @@ object "test_A2_Vectors_test_borrow_mut" { $t5 := false // $t6 := 123 $t6 := 123 - // $t7 := pack Vectors::S($t4, $t5, $t6) + // $t7 := pack 0x2::Vectors::S($t4, $t5, $t6) { let $mem := $Malloc(25) $MemoryStoreU128(add($mem, 0), $t4) @@ -630,29 +630,29 @@ object "test_A2_Vectors_test_borrow_mut" { $MemoryStoreU64(add($mem, 16), $t6) $t7 := $mem } - // vector::push_back($t3, $t7) + // vector::push_back<0x2::Vectors::S>($t3, $t7) A1_vector_push_back$A2_Vectors_S$($t3, $t7) // $t8 := borrow_local($t2) $t8 := $MakePtr(false, $locals) // $t9 := 0 $t9 := 0 - // $t10 := vector::borrow_mut($t8, $t9) + // $t10 := vector::borrow_mut<0x2::Vectors::S>($t8, $t9) $t10 := A1_vector_borrow_mut$A2_Vectors_S$($t8, $t9) // $t11 := 90 $t11 := 90 - // $t12 := borrow_field.x($t10) + // $t12 := borrow_field<0x2::Vectors::S>.x($t10) $t12 := $t10 // write_ref($t12, $t11) $StoreU128($t12, $t11) // $t13 := false $t13 := false - // $t14 := borrow_field.y($t10) + // $t14 := borrow_field<0x2::Vectors::S>.y($t10) $t14 := $IndexPtr($t10, 24) // write_ref($t14, $t13) $StoreU8($t14, $t13) // $t15 := 1028 $t15 := 1028 - // $t16 := borrow_field.z($t10) + // $t16 := borrow_field<0x2::Vectors::S>.z($t10) $t16 := $IndexPtr($t10, 16) // write_ref($t16, $t15) $StoreU64($t16, $t15) @@ -660,9 +660,9 @@ object "test_A2_Vectors_test_borrow_mut" { $t17 := $MakePtr(false, $locals) // $t18 := 0 $t18 := 0 - // $t19 := vector::borrow($t17, $t18) + // $t19 := vector::borrow<0x2::Vectors::S>($t17, $t18) $t19 := A1_vector_borrow$A2_Vectors_S$($t17, $t18) - // $t20 := borrow_field.x($t19) + // $t20 := borrow_field<0x2::Vectors::S>.x($t19) $t20 := $t19 // $t21 := read_ref($t20) $t21 := $LoadU128($t20) @@ -681,9 +681,9 @@ object "test_A2_Vectors_test_borrow_mut" { $t25 := $MakePtr(false, $locals) // $t26 := 0 $t26 := 0 - // $t27 := vector::borrow($t25, $t26) + // $t27 := vector::borrow<0x2::Vectors::S>($t25, $t26) $t27 := A1_vector_borrow$A2_Vectors_S$($t25, $t26) - // $t28 := borrow_field.y($t27) + // $t28 := borrow_field<0x2::Vectors::S>.y($t27) $t28 := $IndexPtr($t27, 24) // $t29 := read_ref($t28) $t29 := $LoadU8($t28) @@ -714,9 +714,9 @@ object "test_A2_Vectors_test_borrow_mut" { $t33 := $MakePtr(false, $locals) // $t34 := 0 $t34 := 0 - // $t35 := vector::borrow($t33, $t34) + // $t35 := vector::borrow<0x2::Vectors::S>($t33, $t34) $t35 := A1_vector_borrow$A2_Vectors_S$($t33, $t34) - // $t36 := borrow_field.z($t35) + // $t36 := borrow_field<0x2::Vectors::S>.z($t35) $t36 := $IndexPtr($t35, 16) // $t37 := read_ref($t36) $t37 := $LoadU64($t36) @@ -747,9 +747,9 @@ object "test_A2_Vectors_test_borrow_mut" { $t41 := $MakePtr(false, $locals) // $t42 := 1 $t42 := 1 - // $t43 := vector::borrow($t41, $t42) + // $t43 := vector::borrow<0x2::Vectors::S>($t41, $t42) $t43 := A1_vector_borrow$A2_Vectors_S$($t41, $t42) - // $t44 := borrow_field.x($t43) + // $t44 := borrow_field<0x2::Vectors::S>.x($t43) $t44 := $t43 // $t45 := read_ref($t44) $t45 := $LoadU128($t44) @@ -780,9 +780,9 @@ object "test_A2_Vectors_test_borrow_mut" { $t49 := $MakePtr(false, $locals) // $t50 := 1 $t50 := 1 - // $t51 := vector::borrow($t49, $t50) + // $t51 := vector::borrow<0x2::Vectors::S>($t49, $t50) $t51 := A1_vector_borrow$A2_Vectors_S$($t49, $t50) - // $t52 := borrow_field.y($t51) + // $t52 := borrow_field<0x2::Vectors::S>.y($t51) $t52 := $IndexPtr($t51, 24) // $t53 := read_ref($t52) $t53 := $LoadU8($t52) @@ -813,9 +813,9 @@ object "test_A2_Vectors_test_borrow_mut" { $t57 := $MakePtr(false, $locals) // $t58 := 1 $t58 := 1 - // $t59 := vector::borrow($t57, $t58) + // $t59 := vector::borrow<0x2::Vectors::S>($t57, $t58) $t59 := A1_vector_borrow$A2_Vectors_S$($t57, $t58) - // $t60 := borrow_field.z($t59) + // $t60 := borrow_field<0x2::Vectors::S>.z($t59) $t60 := $IndexPtr($t59, 16) // $t61 := read_ref($t60) $t61 := $LoadU64($t60) @@ -846,23 +846,23 @@ object "test_A2_Vectors_test_borrow_mut" { $t65 := $MakePtr(false, $locals) // $t66 := 1 $t66 := 1 - // $t67 := vector::borrow_mut($t65, $t66) + // $t67 := vector::borrow_mut<0x2::Vectors::S>($t65, $t66) $t67 := A1_vector_borrow_mut$A2_Vectors_S$($t65, $t66) // $t68 := 10 $t68 := 10 - // $t69 := borrow_field.x($t67) + // $t69 := borrow_field<0x2::Vectors::S>.x($t67) $t69 := $t67 // write_ref($t69, $t68) $StoreU128($t69, $t68) // $t70 := true $t70 := true - // $t71 := borrow_field.y($t67) + // $t71 := borrow_field<0x2::Vectors::S>.y($t67) $t71 := $IndexPtr($t67, 24) // write_ref($t71, $t70) $StoreU8($t71, $t70) // $t72 := 456 $t72 := 456 - // $t73 := borrow_field.z($t67) + // $t73 := borrow_field<0x2::Vectors::S>.z($t67) $t73 := $IndexPtr($t67, 16) // write_ref($t73, $t72) $StoreU64($t73, $t72) @@ -870,9 +870,9 @@ object "test_A2_Vectors_test_borrow_mut" { $t74 := $MakePtr(false, $locals) // $t75 := 1 $t75 := 1 - // $t76 := vector::borrow($t74, $t75) + // $t76 := vector::borrow<0x2::Vectors::S>($t74, $t75) $t76 := A1_vector_borrow$A2_Vectors_S$($t74, $t75) - // $t77 := borrow_field.x($t76) + // $t77 := borrow_field<0x2::Vectors::S>.x($t76) $t77 := $t76 // $t78 := read_ref($t77) $t78 := $LoadU128($t77) @@ -903,9 +903,9 @@ object "test_A2_Vectors_test_borrow_mut" { $t82 := $MakePtr(false, $locals) // $t83 := 1 $t83 := 1 - // $t84 := vector::borrow($t82, $t83) + // $t84 := vector::borrow<0x2::Vectors::S>($t82, $t83) $t84 := A1_vector_borrow$A2_Vectors_S$($t82, $t83) - // $t85 := borrow_field.y($t84) + // $t85 := borrow_field<0x2::Vectors::S>.y($t84) $t85 := $IndexPtr($t84, 24) // $t86 := read_ref($t85) $t86 := $LoadU8($t85) @@ -936,9 +936,9 @@ object "test_A2_Vectors_test_borrow_mut" { $t90 := $MakePtr(false, $locals) // $t91 := 1 $t91 := 1 - // $t92 := vector::borrow($t90, $t91) + // $t92 := vector::borrow<0x2::Vectors::S>($t90, $t91) $t92 := A1_vector_borrow$A2_Vectors_S$($t90, $t91) - // $t93 := borrow_field.z($t92) + // $t93 := borrow_field<0x2::Vectors::S>.z($t92) $t93 := $IndexPtr($t92, 16) // $t94 := read_ref($t93) $t94 := $LoadU64($t93) @@ -1014,7 +1014,7 @@ object "test_A2_Vectors_test_borrow_mut" { function A2_Vectors_one_elem_struct() -> $result { let $t1, $t2, $t3, $t4, $t5, $t6 let $locals := $Malloc(32) - // $t0 := vector::empty() + // $t0 := vector::empty<0x2::Vectors::S>() mstore($locals, A1_vector_empty$A2_Vectors_S$()) // $t1 := borrow_local($t0) $t1 := $MakePtr(false, $locals) @@ -1024,7 +1024,7 @@ object "test_A2_Vectors_test_borrow_mut" { $t3 := true // $t4 := 789 $t4 := 789 - // $t5 := pack Vectors::S($t2, $t3, $t4) + // $t5 := pack 0x2::Vectors::S($t2, $t3, $t4) { let $mem := $Malloc(25) $MemoryStoreU128(add($mem, 0), $t2) @@ -1032,7 +1032,7 @@ object "test_A2_Vectors_test_borrow_mut" { $MemoryStoreU64(add($mem, 16), $t4) $t5 := $mem } - // vector::push_back($t1, $t5) + // vector::push_back<0x2::Vectors::S>($t1, $t5) A1_vector_push_back$A2_Vectors_S$($t1, $t5) // $t6 := move($t0) $t6 := mload($locals) @@ -1418,7 +1418,7 @@ object "test_A2_Vectors_test_destroy_non_empty_fail" { let $t0 // $t0 := Vectors::one_elem_struct() $t0 := A2_Vectors_one_elem_struct() - // vector::destroy_empty($t0) + // vector::destroy_empty<0x2::Vectors::S>($t0) A1_vector_destroy_empty$A2_Vectors_S$($t0) // return () } @@ -1432,7 +1432,7 @@ object "test_A2_Vectors_test_destroy_non_empty_fail" { function A2_Vectors_one_elem_struct() -> $result { let $t1, $t2, $t3, $t4, $t5, $t6 let $locals := $Malloc(32) - // $t0 := vector::empty() + // $t0 := vector::empty<0x2::Vectors::S>() mstore($locals, A1_vector_empty$A2_Vectors_S$()) // $t1 := borrow_local($t0) $t1 := $MakePtr(false, $locals) @@ -1442,7 +1442,7 @@ object "test_A2_Vectors_test_destroy_non_empty_fail" { $t3 := true // $t4 := 789 $t4 := 789 - // $t5 := pack Vectors::S($t2, $t3, $t4) + // $t5 := pack 0x2::Vectors::S($t2, $t3, $t4) { let $mem := $Malloc(25) $MemoryStoreU128(add($mem, 0), $t2) @@ -1450,7 +1450,7 @@ object "test_A2_Vectors_test_destroy_non_empty_fail" { $MemoryStoreU64(add($mem, 16), $t4) $t5 := $mem } - // vector::push_back($t1, $t5) + // vector::push_back<0x2::Vectors::S>($t1, $t5) A1_vector_push_back$A2_Vectors_S$($t1, $t5) // $t6 := move($t0) $t6 := mload($locals) @@ -3121,7 +3121,7 @@ object "test_A2_Vectors_test_one_elem_struct" { mstore($locals, A2_Vectors_one_elem_struct()) // $t1 := borrow_local($t0) $t1 := $MakePtr(false, $locals) - // $t2 := vector::length($t1) + // $t2 := vector::length<0x2::Vectors::S>($t1) $t2 := A1_vector_length$A2_Vectors_S$($t1) // $t3 := 1 $t3 := 1 @@ -3138,9 +3138,9 @@ object "test_A2_Vectors_test_one_elem_struct" { $t6 := $MakePtr(false, $locals) // $t7 := 0 $t7 := 0 - // $t8 := vector::borrow($t6, $t7) + // $t8 := vector::borrow<0x2::Vectors::S>($t6, $t7) $t8 := A1_vector_borrow$A2_Vectors_S$($t6, $t7) - // $t9 := borrow_field.x($t8) + // $t9 := borrow_field<0x2::Vectors::S>.x($t8) $t9 := $t8 // $t10 := read_ref($t9) $t10 := $LoadU128($t9) @@ -3171,9 +3171,9 @@ object "test_A2_Vectors_test_one_elem_struct" { $t14 := $MakePtr(false, $locals) // $t15 := 0 $t15 := 0 - // $t16 := vector::borrow($t14, $t15) + // $t16 := vector::borrow<0x2::Vectors::S>($t14, $t15) $t16 := A1_vector_borrow$A2_Vectors_S$($t14, $t15) - // $t17 := borrow_field.y($t16) + // $t17 := borrow_field<0x2::Vectors::S>.y($t16) $t17 := $IndexPtr($t16, 24) // $t18 := read_ref($t17) $t18 := $LoadU8($t17) @@ -3204,9 +3204,9 @@ object "test_A2_Vectors_test_one_elem_struct" { $t22 := $MakePtr(false, $locals) // $t23 := 0 $t23 := 0 - // $t24 := vector::borrow($t22, $t23) + // $t24 := vector::borrow<0x2::Vectors::S>($t22, $t23) $t24 := A1_vector_borrow$A2_Vectors_S$($t22, $t23) - // $t25 := borrow_field.z($t24) + // $t25 := borrow_field<0x2::Vectors::S>.z($t24) $t25 := $IndexPtr($t24, 16) // $t26 := read_ref($t25) $t26 := $LoadU64($t25) @@ -3257,7 +3257,7 @@ object "test_A2_Vectors_test_one_elem_struct" { function A2_Vectors_one_elem_struct() -> $result { let $t1, $t2, $t3, $t4, $t5, $t6 let $locals := $Malloc(32) - // $t0 := vector::empty() + // $t0 := vector::empty<0x2::Vectors::S>() mstore($locals, A1_vector_empty$A2_Vectors_S$()) // $t1 := borrow_local($t0) $t1 := $MakePtr(false, $locals) @@ -3267,7 +3267,7 @@ object "test_A2_Vectors_test_one_elem_struct" { $t3 := true // $t4 := 789 $t4 := 789 - // $t5 := pack Vectors::S($t2, $t3, $t4) + // $t5 := pack 0x2::Vectors::S($t2, $t3, $t4) { let $mem := $Malloc(25) $MemoryStoreU128(add($mem, 0), $t2) @@ -3275,7 +3275,7 @@ object "test_A2_Vectors_test_one_elem_struct" { $MemoryStoreU64(add($mem, 16), $t4) $t5 := $mem } - // vector::push_back($t1, $t5) + // vector::push_back<0x2::Vectors::S>($t1, $t5) A1_vector_push_back$A2_Vectors_S$($t1, $t5) // $t6 := move($t0) $t6 := mload($locals) @@ -6666,9 +6666,9 @@ object "test_A2_Vectors_test_vector_equality_struct" { $Abort($t7) } case 4 { - // $t2 := vector::empty() + // $t2 := vector::empty<0x2::Vectors::R>() mstore($locals, A1_vector_empty$A2_Vectors_R$()) - // $t3 := vector::empty() + // $t3 := vector::empty<0x2::Vectors::R>() mstore(add($locals, 32), A1_vector_empty$A2_Vectors_R$()) // $t4 := copy($t2) $t4 := mload($locals) @@ -6689,7 +6689,7 @@ object "test_A2_Vectors_test_vector_equality_struct" { $t9 := true // $t10 := 9 $t10 := 9 - // $t11 := pack Vectors::S($t8, $t9, $t10) + // $t11 := pack 0x2::Vectors::S($t8, $t9, $t10) { let $mem := $Malloc(25) $MemoryStoreU128(add($mem, 0), $t8) @@ -6699,7 +6699,7 @@ object "test_A2_Vectors_test_vector_equality_struct" { } // $t12 := Vectors::one_elem_u64() $t12 := A2_Vectors_one_elem_u64() - // $t13 := pack Vectors::R($t11, $t12) + // $t13 := pack 0x2::Vectors::R($t11, $t12) { let $mem := $Malloc(64) $MemoryStoreU256(add($mem, 0), $t11) @@ -6708,7 +6708,7 @@ object "test_A2_Vectors_test_vector_equality_struct" { } // $t14 := borrow_local($t2) $t14 := $MakePtr(false, $locals) - // vector::push_back($t14, $t13) + // vector::push_back<0x2::Vectors::R>($t14, $t13) A1_vector_push_back$A2_Vectors_R$($t14, $t13) // $t15 := copy($t2) $t15 := mload($locals) @@ -6737,7 +6737,7 @@ object "test_A2_Vectors_test_vector_equality_struct" { // label L5 // $t19 := borrow_local($t3) $t19 := $MakePtr(false, add($locals, 32)) - // vector::push_back($t19, $t13) + // vector::push_back<0x2::Vectors::R>($t19, $t13) A1_vector_push_back$A2_Vectors_R$($t19, $t13) // $t20 := copy($t2) $t20 := mload($locals) @@ -6770,7 +6770,7 @@ object "test_A2_Vectors_test_vector_equality_struct" { $t25 := false // $t26 := 9 $t26 := 9 - // $t27 := pack Vectors::S($t24, $t25, $t26) + // $t27 := pack 0x2::Vectors::S($t24, $t25, $t26) { let $mem := $Malloc(25) $MemoryStoreU128(add($mem, 0), $t24) @@ -6780,7 +6780,7 @@ object "test_A2_Vectors_test_vector_equality_struct" { } // $t28 := Vectors::one_elem_u64() $t28 := A2_Vectors_one_elem_u64() - // $t29 := pack Vectors::R($t27, $t28) + // $t29 := pack 0x2::Vectors::R($t27, $t28) { let $mem := $Malloc(64) $MemoryStoreU256(add($mem, 0), $t27) @@ -6789,7 +6789,7 @@ object "test_A2_Vectors_test_vector_equality_struct" { } // $t30 := borrow_local($t2) $t30 := $MakePtr(false, $locals) - // vector::push_back($t30, $t13) + // vector::push_back<0x2::Vectors::R>($t30, $t13) A1_vector_push_back$A2_Vectors_R$($t30, $t13) // $t31 := copy($t2) $t31 := mload($locals) @@ -6818,7 +6818,7 @@ object "test_A2_Vectors_test_vector_equality_struct" { // label L11 // $t35 := borrow_local($t3) $t35 := $MakePtr(false, add($locals, 32)) - // vector::push_back($t35, $t29) + // vector::push_back<0x2::Vectors::R>($t35, $t29) A1_vector_push_back$A2_Vectors_R$($t35, $t29) // $t36 := move($t2) $t36 := mload($locals) @@ -7282,7 +7282,7 @@ object "test_A2_Vectors_test_vectors_in_structs" { $t9 := true // $t10 := 9 $t10 := 9 - // $t11 := pack Vectors::S($t8, $t9, $t10) + // $t11 := pack 0x2::Vectors::S($t8, $t9, $t10) { let $mem := $Malloc(25) $MemoryStoreU128(add($mem, 0), $t8) @@ -7292,7 +7292,7 @@ object "test_A2_Vectors_test_vectors_in_structs" { } // $t12 := move($t1) $t12 := mload($locals) - // $t0 := pack Vectors::R($t11, $t12) + // $t0 := pack 0x2::Vectors::R($t11, $t12) { let $mem := $Malloc(64) $MemoryStoreU256(add($mem, 0), $t11) @@ -7301,7 +7301,7 @@ object "test_A2_Vectors_test_vectors_in_structs" { } // $t13 := borrow_local($t0) $t13 := $MakePtr(false, r) - // $t14 := borrow_field.v($t13) + // $t14 := borrow_field<0x2::Vectors::R>.v($t13) $t14 := $IndexPtr($t13, 32) // $t15 := vector::length($t14) $t15 := A1_vector_length$u64$($t14) @@ -7318,7 +7318,7 @@ object "test_A2_Vectors_test_vectors_in_structs" { // label L2 // $t19 := borrow_local($t0) $t19 := $MakePtr(false, r) - // $t20 := borrow_field.v($t19) + // $t20 := borrow_field<0x2::Vectors::R>.v($t19) $t20 := $IndexPtr($t19, 32) // $t21 := 0 $t21 := 0 @@ -7351,7 +7351,7 @@ object "test_A2_Vectors_test_vectors_in_structs" { // label L5 // $t27 := borrow_local($t0) $t27 := $MakePtr(false, r) - // $t28 := borrow_field.v($t27) + // $t28 := borrow_field<0x2::Vectors::R>.v($t27) $t28 := $IndexPtr($t27, 32) // $t29 := 1 $t29 := 1 @@ -7384,7 +7384,7 @@ object "test_A2_Vectors_test_vectors_in_structs" { // label L8 // $t35 := borrow_local($t0) $t35 := $MakePtr(false, r) - // $t36 := borrow_field.v($t35) + // $t36 := borrow_field<0x2::Vectors::R>.v($t35) $t36 := $IndexPtr($t35, 32) // $t37 := 2 $t37 := 2 @@ -7419,7 +7419,7 @@ object "test_A2_Vectors_test_vectors_in_structs" { $t43 := 41 // $t44 := borrow_local($t0) $t44 := $MakePtr(false, r) - // $t45 := borrow_field.v($t44) + // $t45 := borrow_field<0x2::Vectors::R>.v($t44) $t45 := $IndexPtr($t44, 32) // $t46 := 1 $t46 := 1 @@ -7429,7 +7429,7 @@ object "test_A2_Vectors_test_vectors_in_structs" { $StoreU64($t47, $t43) // $t48 := borrow_local($t0) $t48 := $MakePtr(false, r) - // $t49 := borrow_field.v($t48) + // $t49 := borrow_field<0x2::Vectors::R>.v($t48) $t49 := $IndexPtr($t48, 32) // $t50 := 1 $t50 := 1 @@ -7464,7 +7464,7 @@ object "test_A2_Vectors_test_vectors_in_structs" { $t56 := A2_Vectors_one_elem_u64() // $t57 := borrow_local($t0) $t57 := $MakePtr(false, r) - // $t58 := borrow_field.v($t57) + // $t58 := borrow_field<0x2::Vectors::R>.v($t57) $t58 := $IndexPtr($t57, 32) // write_ref($t58, $t56) if $IsStoragePtr($t58){ @@ -7482,7 +7482,7 @@ object "test_A2_Vectors_test_vectors_in_structs" { $StoreU256($t58, $t56) // $t59 := borrow_local($t0) $t59 := $MakePtr(false, r) - // $t60 := borrow_field.v($t59) + // $t60 := borrow_field<0x2::Vectors::R>.v($t59) $t60 := $IndexPtr($t59, 32) // $t61 := vector::length($t60) $t61 := A1_vector_length$u64$($t60) @@ -7511,7 +7511,7 @@ object "test_A2_Vectors_test_vectors_in_structs" { // label L17 // $t65 := borrow_local($t0) $t65 := $MakePtr(false, r) - // $t66 := borrow_field.v($t65) + // $t66 := borrow_field<0x2::Vectors::R>.v($t65) $t66 := $IndexPtr($t65, 32) // $t67 := 0 $t67 := 0 diff --git a/third_party/move/evm/move-to-yul/tests/test-dispatcher/DispatcherArrayDecoding.exp b/third_party/move/evm/move-to-yul/tests/test-dispatcher/DispatcherArrayDecoding.exp index 970b17cc61d8c..8d10b80137a38 100644 --- a/third_party/move/evm/move-to-yul/tests/test-dispatcher/DispatcherArrayDecoding.exp +++ b/third_party/move/evm/move-to-yul/tests/test-dispatcher/DispatcherArrayDecoding.exp @@ -461,7 +461,7 @@ object "A2_M" { case 3 { // $t7 := borrow_local($t0) $t7 := $MakePtr(false, $locals) - // $t8 := vector::length>($t7) + // $t8 := vector::length>($t7) $t8 := A1_vector_length$vec$A2_U256_U256$$($t7) // $t9 := 0 $t9 := 0 @@ -488,17 +488,17 @@ object "A2_M" { // label L2 // $t11 := borrow_local($t0) $t11 := $MakePtr(false, $locals) - // $t12 := vector::borrow>($t11, $t1) + // $t12 := vector::borrow>($t11, $t1) $t12 := A1_vector_borrow$vec$A2_U256_U256$$($t11, i) // $t13 := 0 $t13 := 0 - // $t14 := vector::borrow($t12, $t13) + // $t14 := vector::borrow<0x2::U256::U256>($t12, $t13) $t14 := A1_vector_borrow$A2_U256_U256$($t12, $t13) // $t15 := read_ref($t14) $t15 := $LoadU256($t14) // $t16 := 1 $t16 := 1 - // $t17 := vector::borrow($t12, $t16) + // $t17 := vector::borrow<0x2::U256::U256>($t12, $t16) $t17 := A1_vector_borrow$A2_U256_U256$($t12, $t16) // $t18 := read_ref($t17) $t18 := $LoadU256($t17) @@ -689,9 +689,9 @@ object "A2_M" { // label L2 // $t10 := borrow_local($t0) $t10 := $MakePtr(false, $locals) - // $t11 := vector::borrow>($t10, $t1) + // $t11 := vector::borrow>($t10, $t1) $t11 := A1_vector_borrow$vec$A2_U256_U256$$($t10, i) - // $t12 := vector::length($t11) + // $t12 := vector::length<0x2::U256::U256>($t11) $t12 := A1_vector_length$A2_U256_U256$($t11) // $t13 := 0 $t13 := 0 @@ -726,7 +726,7 @@ object "A2_M" { } case 10 { // label L5 - // $t15 := vector::borrow($t11, $t2) + // $t15 := vector::borrow<0x2::U256::U256>($t11, $t2) $t15 := A1_vector_borrow$A2_U256_U256$($t11, j) // $t16 := read_ref($t15) $t16 := $LoadU256($t15) @@ -959,7 +959,7 @@ object "A2_M" { case 3 { // $t7 := borrow_local($t0) $t7 := $MakePtr(false, $locals) - // $t8 := vector::length>($t7) + // $t8 := vector::length>($t7) $t8 := A1_vector_length$vec$A2_U256_U256$$($t7) // $t9 := 0 $t9 := 0 @@ -986,17 +986,17 @@ object "A2_M" { // label L2 // $t11 := borrow_local($t0) $t11 := $MakePtr(false, $locals) - // $t12 := vector::borrow>($t11, $t1) + // $t12 := vector::borrow>($t11, $t1) $t12 := A1_vector_borrow$vec$A2_U256_U256$$($t11, i) // $t13 := 0 $t13 := 0 - // $t14 := vector::borrow($t12, $t13) + // $t14 := vector::borrow<0x2::U256::U256>($t12, $t13) $t14 := A1_vector_borrow$A2_U256_U256$($t12, $t13) // $t15 := read_ref($t14) $t15 := $LoadU256($t14) // $t16 := 1 $t16 := 1 - // $t17 := vector::borrow($t12, $t16) + // $t17 := vector::borrow<0x2::U256::U256>($t12, $t16) $t17 := A1_vector_borrow$A2_U256_U256$($t12, $t16) // $t18 := read_ref($t17) $t18 := $LoadU256($t17) diff --git a/third_party/move/evm/move-to-yul/tests/test-dispatcher/DispatcherBasicStorage.exp b/third_party/move/evm/move-to-yul/tests/test-dispatcher/DispatcherBasicStorage.exp index bc0463b511e92..f18ac758a350e 100644 --- a/third_party/move/evm/move-to-yul/tests/test-dispatcher/DispatcherBasicStorage.exp +++ b/third_party/move/evm/move-to-yul/tests/test-dispatcher/DispatcherBasicStorage.exp @@ -26,7 +26,7 @@ object "A2_M" { let $t0, $t1 // $t0 := 0 $t0 := 0 - // $t1 := pack M::Storage($t0) + // $t1 := pack 0x2::M::Storage($t0) { let $mem := $Malloc(8) $MemoryStoreU64(add($mem, 0), $t0) @@ -139,7 +139,7 @@ object "A2_M" { } function A2_M_current(self) -> $result { let $t1, $t2 - // $t1 := borrow_field.counter($t0) + // $t1 := borrow_field<0x2::M::Storage>.counter($t0) $t1 := self // $t2 := read_ref($t1) $t2 := $LoadU64($t1) @@ -149,7 +149,7 @@ object "A2_M" { function A2_M_increment(self) { let $t1, $t2, $t3, $t4, $t5 - // $t1 := borrow_field.counter($t0) + // $t1 := borrow_field<0x2::M::Storage>.counter($t0) $t1 := self // $t2 := read_ref($t1) $t2 := $LoadU64($t1) @@ -157,7 +157,7 @@ object "A2_M" { $t3 := 1 // $t4 := +($t2, $t3) $t4 := $AddU64($t2, $t3) - // $t5 := borrow_field.counter($t0) + // $t5 := borrow_field<0x2::M::Storage>.counter($t0) $t5 := self // write_ref($t5, $t4) $StoreU64($t5, $t4) @@ -166,7 +166,7 @@ object "A2_M" { function A2_M_receive(self) { let $t1, $t2, $t3, $t4, $t5 - // $t1 := borrow_field.counter($t0) + // $t1 := borrow_field<0x2::M::Storage>.counter($t0) $t1 := self // $t2 := read_ref($t1) $t2 := $LoadU64($t1) @@ -174,7 +174,7 @@ object "A2_M" { $t3 := 2 // $t4 := +($t2, $t3) $t4 := $AddU64($t2, $t3) - // $t5 := borrow_field.counter($t0) + // $t5 := borrow_field<0x2::M::Storage>.counter($t0) $t5 := self // write_ref($t5, $t4) $StoreU64($t5, $t4) diff --git a/third_party/move/evm/move-to-yul/tests/test-dispatcher/DispatcherEncodingStorage.exp b/third_party/move/evm/move-to-yul/tests/test-dispatcher/DispatcherEncodingStorage.exp index 9112f59810d17..b748bf5ebed78 100644 --- a/third_party/move/evm/move-to-yul/tests/test-dispatcher/DispatcherEncodingStorage.exp +++ b/third_party/move/evm/move-to-yul/tests/test-dispatcher/DispatcherEncodingStorage.exp @@ -61,13 +61,13 @@ object "A2_M" { $t5 := $MakePtr(false, add($locals, 32)) // $t6 := move($t1) $t6 := mload($locals) - // $t7 := pack M::T($t6) + // $t7 := pack 0x2::M::T($t6) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t6) $t7 := $mem } - // move_to>($t7, $t5) + // move_to<0x2::M::T>($t7, $t5) { let $base_offset := $MakeTypeStorageBase(0, 0x2e75402e, $LoadU256($t5)) if $AlignedStorageLoad($base_offset) { @@ -96,7 +96,7 @@ object "A2_M" { } // $t8 := 0x42 $t8 := 0x42 - // $t9 := borrow_global>($t8) + // $t9 := borrow_global<0x2::M::T>($t8) { let $base_offset := $MakeTypeStorageBase(0, 0x2e75402e, $t8) if iszero($AlignedStorageLoad($base_offset)) { @@ -104,7 +104,7 @@ object "A2_M" { } $t9 := $MakePtr(true, add($base_offset, 32)) } - // $t10 := borrow_field>.v($t9) + // $t10 := borrow_field<0x2::M::T>.v($t9) $t10 := $t9 // $t11 := read_ref($t10) $t11 := $LoadU256($t10) @@ -139,19 +139,19 @@ object "A2_M" { $t4 := 65 // vector::push_back($t3, $t4) A1_vector_push_back$u8$($t3, $t4) - // $t2 := vector::empty() + // $t2 := vector::empty<0x2::U256::U256>() mstore(add($locals, 32), A1_vector_empty$A2_U256_U256$()) // $t5 := borrow_local($t2) $t5 := $MakePtr(false, add($locals, 32)) // $t6 := 64 $t6 := 64 - // vector::push_back($t5, $t6) + // vector::push_back<0x2::U256::U256>($t5, $t6) A1_vector_push_back$A2_U256_U256$($t5, $t6) // $t7 := borrow_local($t2) $t7 := $MakePtr(false, add($locals, 32)) // $t8 := 65 $t8 := 65 - // vector::push_back($t7, $t8) + // vector::push_back<0x2::U256::U256>($t7, $t8) A1_vector_push_back$A2_U256_U256$($t7, $t8) // $t9 := 0x42 $t9 := 0x42 @@ -163,14 +163,14 @@ object "A2_M" { $t11 := mload($locals) // $t12 := move($t2) $t12 := mload(add($locals, 32)) - // $t13 := pack M::State($t11, $t12) + // $t13 := pack 0x2::M::State($t11, $t12) { let $mem := $Malloc(64) $MemoryStoreU256(add($mem, 0), $t11) $MemoryStoreU256(add($mem, 32), $t12) $t13 := $mem } - // move_to($t13, $t10) + // move_to<0x2::M::State>($t13, $t10) { let $base_offset := $MakeTypeStorageBase(0, 0x7d9cc237, $LoadU256($t10)) if $AlignedStorageLoad($base_offset) { @@ -213,7 +213,7 @@ object "A2_M" { } // $t14 := 0x42 $t14 := 0x42 - // $t15 := borrow_global($t14) + // $t15 := borrow_global<0x2::M::State>($t14) { let $base_offset := $MakeTypeStorageBase(0, 0x7d9cc237, $t14) if iszero($AlignedStorageLoad($base_offset)) { @@ -221,7 +221,7 @@ object "A2_M" { } $t15 := $MakePtr(true, add($base_offset, 32)) } - // $t16 := borrow_field.s1($t15) + // $t16 := borrow_field<0x2::M::State>.s1($t15) $t16 := $t15 // $t17 := read_ref($t16) $t17 := $LoadU256($t16) @@ -242,7 +242,7 @@ object "A2_M" { } // $t18 := 0x42 $t18 := 0x42 - // $t19 := borrow_global($t18) + // $t19 := borrow_global<0x2::M::State>($t18) { let $base_offset := $MakeTypeStorageBase(0, 0x7d9cc237, $t18) if iszero($AlignedStorageLoad($base_offset)) { @@ -250,7 +250,7 @@ object "A2_M" { } $t19 := $MakePtr(true, add($base_offset, 32)) } - // $t20 := borrow_field.s2($t19) + // $t20 := borrow_field<0x2::M::State>.s2($t19) $t20 := $IndexPtr($t19, 32) // $t21 := read_ref($t20) $t21 := $LoadU256($t20) diff --git a/third_party/move/evm/move-to-yul/tests/test-dispatcher/ExternalCall.exp b/third_party/move/evm/move-to-yul/tests/test-dispatcher/ExternalCall.exp index a4be571a266c6..3026fbefb4c60 100644 --- a/third_party/move/evm/move-to-yul/tests/test-dispatcher/ExternalCall.exp +++ b/third_party/move/evm/move-to-yul/tests/test-dispatcher/ExternalCall.exp @@ -114,7 +114,7 @@ object "A2_M" { // label L1 // $t4 := move($t1) $t4 := v - // $t5 := ExternalResult::unwrap($t4) + // $t5 := ExternalResult::unwrap<0x2::U256::U256>($t4) $t5 := A2_ExternalResult_unwrap$A2_U256_U256$($t4) // return $t5 $result := $t5 @@ -133,7 +133,7 @@ object "A2_M" { v := A2_M_success(addr) // $t2 := borrow_local($t1) $t2 := $MakePtr(false, v) - // $t3 := ExternalResult::is_ok($t2) + // $t3 := ExternalResult::is_ok<0x2::U256::U256>($t2) $t3 := A2_ExternalResult_is_ok$A2_U256_U256$($t2) // if ($t3) goto L1 else goto L0 switch $t3 @@ -152,7 +152,7 @@ object "A2_M" { // label L1 // $t4 := move($t1) $t4 := v - // $t5 := ExternalResult::unwrap($t4) + // $t5 := ExternalResult::unwrap<0x2::Evm::Unit>($t4) $t5 := A2_ExternalResult_unwrap$A2_Evm_Unit$($t4) // drop($t5) $Free($t5, 1) @@ -169,7 +169,7 @@ object "A2_M" { v := A2_M_test_unit(addr) // $t2 := borrow_local($t1) $t2 := $MakePtr(false, v) - // $t3 := ExternalResult::is_ok($t2) + // $t3 := ExternalResult::is_ok<0x2::Evm::Unit>($t2) $t3 := A2_ExternalResult_is_ok$A2_Evm_Unit$($t2) // if ($t3) goto L1 else goto L0 switch $t3 @@ -197,7 +197,7 @@ object "A2_M" { let data, v, $t2, $t3, $t4, $t5, $t6 // $t2 := 0 $t2 := 0 - // $t3 := vector::empty() + // $t3 := vector::empty<0x2::U256::U256>() $t3 := A1_vector_empty$A2_U256_U256$() // $t4 := 0x3 $t4 := 0x3 @@ -251,7 +251,7 @@ object "A2_M" { // label L0 // $t7 := borrow_local($t1) $t7 := $MakePtr(false, value) - // $t8 := ExternalResult::is_err_reason($t7) + // $t8 := ExternalResult::is_err_reason<0x2::U256::U256>($t7) $t8 := A2_ExternalResult_is_err_reason$A2_U256_U256$($t7) // if ($t8) goto L3 else goto L2 switch $t8 @@ -267,7 +267,7 @@ object "A2_M" { value := A2_M_test_try_call($t3, $t2) // $t4 := borrow_local($t1) $t4 := $MakePtr(false, value) - // $t5 := ExternalResult::is_ok($t4) + // $t5 := ExternalResult::is_ok<0x2::U256::U256>($t4) $t5 := A2_ExternalResult_is_ok$A2_U256_U256$($t4) // if ($t5) goto L1 else goto L0 switch $t5 @@ -286,7 +286,7 @@ object "A2_M" { // label L2 // $t10 := borrow_local($t1) $t10 := $MakePtr(false, value) - // $t11 := ExternalResult::is_panic($t10) + // $t11 := ExternalResult::is_panic<0x2::U256::U256>($t10) $t11 := A2_ExternalResult_is_panic$A2_U256_U256$($t10) // if ($t11) goto L5 else goto L4 switch $t11 @@ -314,12 +314,12 @@ object "A2_M" { function A2_ExternalResult_is_panic$A2_U256_U256$(result) -> $result { let $t1, $t2 - // $t1 := borrow_field>.panic_code($t0) + // $t1 := borrow_field<0x2::ExternalResult::ExternalResult<#0>>.panic_code($t0) { let $field_ptr := $IndexPtr(result, 96) $t1 := $MakePtr($IsStoragePtr($field_ptr), $LoadU256($field_ptr)) } - // $t2 := option::is_some($t1) + // $t2 := option::is_some<0x2::U256::U256>($t1) $t2 := A1_option_is_some$A2_U256_U256$($t1) // return $t2 $result := $t2 @@ -327,7 +327,7 @@ object "A2_M" { function A1_option_is_some$A2_U256_U256$(t) -> $result { let $t1, $t2, $t3 - // $t1 := borrow_field>.vec($t0) + // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$A2_U256_U256$($t1) @@ -356,7 +356,7 @@ object "A2_M" { } function A2_ExternalResult_is_ok$A2_U256_U256$(result) -> $result { let $t1, $t2 - // $t1 := borrow_field>.value($t0) + // $t1 := borrow_field<0x2::ExternalResult::ExternalResult<#0>>.value($t0) { $t1 := $MakePtr($IsStoragePtr(result), $LoadU256(result)) } @@ -412,9 +412,9 @@ object "A2_M" { $t2 := A1_option_some$vec$u8$$(error) // $t3 := option::none>() $t3 := A1_option_none$vec$u8$$() - // $t4 := option::none() + // $t4 := option::none<0x2::U256::U256>() $t4 := A1_option_none$A2_U256_U256$() - // $t5 := pack ExternalResult::ExternalResult<#0>($t1, $t2, $t3, $t4) + // $t5 := pack 0x2::ExternalResult::ExternalResult<#0>($t1, $t2, $t3, $t4) { let $mem := $Malloc(128) $MemoryStoreU256(add($mem, 0), $t1) @@ -431,7 +431,7 @@ object "A2_M" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$A2_U256_U256$() - // $t1 := pack option::Option<#0>($t0) + // $t1 := pack 0x1::option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -449,7 +449,7 @@ object "A2_M" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$vec$u8$$() - // $t1 := pack option::Option<#0>($t0) + // $t1 := pack 0x1::option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -467,7 +467,7 @@ object "A2_M" { let $t1, $t2 // $t1 := vector::singleton<#0>($t0) $t1 := A1_vector_singleton$vec$u8$$(e) - // $t2 := pack option::Option<#0>($t1) + // $t2 := pack 0x1::option::Option<#0>($t1) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t1) @@ -529,9 +529,9 @@ object "A2_M" { $t6 := A1_option_none$vec$u8$$() // $t7 := option::none>() $t7 := A1_option_none$vec$u8$$() - // $t8 := option::some($t0) + // $t8 := option::some<0x2::U256::U256>($t0) $t8 := A1_option_some$A2_U256_U256$(panic_code) - // $t9 := pack ExternalResult::ExternalResult<#0>($t5, $t7, $t6, $t8) + // $t9 := pack 0x2::ExternalResult::ExternalResult<#0>($t5, $t7, $t6, $t8) { let $mem := $Malloc(128) $MemoryStoreU256(add($mem, 0), $t5) @@ -548,7 +548,7 @@ object "A2_M" { let $t1, $t2 // $t1 := vector::singleton<#0>($t0) $t1 := A1_vector_singleton$A2_U256_U256$(e) - // $t2 := pack option::Option<#0>($t1) + // $t2 := pack 0x1::option::Option<#0>($t1) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t1) @@ -596,9 +596,9 @@ object "A2_M" { $t6 := A1_option_some$vec$u8$$(error) // $t7 := option::none>() $t7 := A1_option_none$vec$u8$$() - // $t8 := option::none() + // $t8 := option::none<0x2::U256::U256>() $t8 := A1_option_none$A2_U256_U256$() - // $t9 := pack ExternalResult::ExternalResult<#0>($t5, $t7, $t6, $t8) + // $t9 := pack 0x2::ExternalResult::ExternalResult<#0>($t5, $t7, $t6, $t8) { let $mem := $Malloc(128) $MemoryStoreU256(add($mem, 0), $t5) @@ -619,9 +619,9 @@ object "A2_M" { $t2 := A1_option_none$vec$u8$$() // $t3 := option::none>() $t3 := A1_option_none$vec$u8$$() - // $t4 := option::none() + // $t4 := option::none<0x2::U256::U256>() $t4 := A1_option_none$A2_U256_U256$() - // $t5 := pack ExternalResult::ExternalResult<#0>($t1, $t2, $t3, $t4) + // $t5 := pack 0x2::ExternalResult::ExternalResult<#0>($t1, $t2, $t3, $t4) { let $mem := $Malloc(128) $MemoryStoreU256(add($mem, 0), $t1) @@ -636,7 +636,7 @@ object "A2_M" { function A2_ExternalResult_is_err_reason$A2_U256_U256$(result) -> $result { let $t1, $t2 - // $t1 := borrow_field>.err_reason($t0) + // $t1 := borrow_field<0x2::ExternalResult::ExternalResult<#0>>.err_reason($t0) { let $field_ptr := $IndexPtr(result, 64) $t1 := $MakePtr($IsStoragePtr($field_ptr), $LoadU256($field_ptr)) @@ -649,7 +649,7 @@ object "A2_M" { function A1_option_is_some$vec$u8$$(t) -> $result { let $t1, $t2, $t3 - // $t1 := borrow_field>.vec($t0) + // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$vec$u8$$($t1) @@ -742,7 +742,7 @@ object "A2_M" { } function A2_ExternalResult_is_ok$A2_Evm_Unit$(result) -> $result { let $t1, $t2 - // $t1 := borrow_field>.value($t0) + // $t1 := borrow_field<0x2::ExternalResult::ExternalResult<#0>>.value($t0) { $t1 := $MakePtr($IsStoragePtr(result), $LoadU256(result)) } @@ -754,7 +754,7 @@ object "A2_M" { function A1_option_is_some$A2_Evm_Unit$(t) -> $result { let $t1, $t2, $t3 - // $t1 := borrow_field>.vec($t0) + // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$A2_Evm_Unit$($t1) @@ -827,9 +827,9 @@ object "A2_M" { $t2 := A1_option_some$vec$u8$$(error) // $t3 := option::none>() $t3 := A1_option_none$vec$u8$$() - // $t4 := option::none() + // $t4 := option::none<0x2::U256::U256>() $t4 := A1_option_none$A2_U256_U256$() - // $t5 := pack ExternalResult::ExternalResult<#0>($t1, $t2, $t3, $t4) + // $t5 := pack 0x2::ExternalResult::ExternalResult<#0>($t1, $t2, $t3, $t4) { let $mem := $Malloc(128) $MemoryStoreU256(add($mem, 0), $t1) @@ -846,7 +846,7 @@ object "A2_M" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$A2_Evm_Unit$() - // $t1 := pack option::Option<#0>($t0) + // $t1 := pack 0x1::option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -868,9 +868,9 @@ object "A2_M" { $t6 := A1_option_none$vec$u8$$() // $t7 := option::none>() $t7 := A1_option_none$vec$u8$$() - // $t8 := option::some($t0) + // $t8 := option::some<0x2::U256::U256>($t0) $t8 := A1_option_some$A2_U256_U256$(panic_code) - // $t9 := pack ExternalResult::ExternalResult<#0>($t5, $t7, $t6, $t8) + // $t9 := pack 0x2::ExternalResult::ExternalResult<#0>($t5, $t7, $t6, $t8) { let $mem := $Malloc(128) $MemoryStoreU256(add($mem, 0), $t5) @@ -891,9 +891,9 @@ object "A2_M" { $t6 := A1_option_some$vec$u8$$(error) // $t7 := option::none>() $t7 := A1_option_none$vec$u8$$() - // $t8 := option::none() + // $t8 := option::none<0x2::U256::U256>() $t8 := A1_option_none$A2_U256_U256$() - // $t9 := pack ExternalResult::ExternalResult<#0>($t5, $t7, $t6, $t8) + // $t9 := pack 0x2::ExternalResult::ExternalResult<#0>($t5, $t7, $t6, $t8) { let $mem := $Malloc(128) $MemoryStoreU256(add($mem, 0), $t5) @@ -908,7 +908,7 @@ object "A2_M" { function A2_ExternalResult_unwrap$A2_Evm_Unit$(result) -> $result { let err_data, err_reason, panic_code, value, $t5, $t6, $t7, $t8, $t9 - // ($t5, $t6, $t7, $t8) := unpack ExternalResult::ExternalResult<#0>($t0) + // ($t5, $t6, $t7, $t8) := unpack 0x2::ExternalResult::ExternalResult<#0>($t0) $t5 := $MemoryLoadU256(add(result, 0)) $t6 := $MemoryLoadU256(add(result, 32)) $t7 := $MemoryLoadU256(add(result, 64)) @@ -918,7 +918,7 @@ object "A2_M" { A1_option_destroy_none$vec$u8$$($t6) // option::destroy_none>($t7) A1_option_destroy_none$vec$u8$$($t7) - // option::destroy_none($t8) + // option::destroy_none<0x2::U256::U256>($t8) A1_option_destroy_none$A2_U256_U256$($t8) // $t9 := option::destroy_some<#0>($t5) $t9 := A1_option_destroy_some$A2_Evm_Unit$($t5) @@ -958,7 +958,7 @@ object "A2_M" { // label L2 // $t6 := move($t0) $t6 := t - // $t2 := unpack option::Option<#0>($t6) + // $t2 := unpack 0x1::option::Option<#0>($t6) mstore($locals, $MemoryLoadU256(add($t6, 0))) $Free($t6, 32) // $t7 := borrow_local($t2) @@ -1031,7 +1031,7 @@ object "A2_M" { // label L2 // $t4 := move($t0) $t4 := t - // $t5 := unpack option::Option<#0>($t4) + // $t5 := unpack 0x1::option::Option<#0>($t4) $t5 := $MemoryLoadU256(add($t4, 0)) $Free($t4, 32) // vector::destroy_empty<#0>($t5) @@ -1050,7 +1050,7 @@ object "A2_M" { } function A1_option_is_none$A2_U256_U256$(t) -> $result { let $t1, $t2 - // $t1 := borrow_field>.vec($t0) + // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$A2_U256_U256$($t1) @@ -1089,7 +1089,7 @@ object "A2_M" { // label L2 // $t4 := move($t0) $t4 := t - // $t5 := unpack option::Option<#0>($t4) + // $t5 := unpack 0x1::option::Option<#0>($t4) $t5 := $MemoryLoadU256(add($t4, 0)) $Free($t4, 32) // vector::destroy_empty<#0>($t5) @@ -1108,7 +1108,7 @@ object "A2_M" { } function A1_option_is_none$vec$u8$$(t) -> $result { let $t1, $t2 - // $t1 := borrow_field>.vec($t0) + // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$vec$u8$$($t1) @@ -1164,7 +1164,7 @@ object "A2_M" { function A2_ExternalResult_unwrap$A2_U256_U256$(result) -> $result { let err_data, err_reason, panic_code, value, $t5, $t6, $t7, $t8, $t9 - // ($t5, $t6, $t7, $t8) := unpack ExternalResult::ExternalResult<#0>($t0) + // ($t5, $t6, $t7, $t8) := unpack 0x2::ExternalResult::ExternalResult<#0>($t0) $t5 := $MemoryLoadU256(add(result, 0)) $t6 := $MemoryLoadU256(add(result, 32)) $t7 := $MemoryLoadU256(add(result, 64)) @@ -1174,7 +1174,7 @@ object "A2_M" { A1_option_destroy_none$vec$u8$$($t6) // option::destroy_none>($t7) A1_option_destroy_none$vec$u8$$($t7) - // option::destroy_none($t8) + // option::destroy_none<0x2::U256::U256>($t8) A1_option_destroy_none$A2_U256_U256$($t8) // $t9 := option::destroy_some<#0>($t5) $t9 := A1_option_destroy_some$A2_U256_U256$($t5) @@ -1214,7 +1214,7 @@ object "A2_M" { // label L2 // $t6 := move($t0) $t6 := t - // $t2 := unpack option::Option<#0>($t6) + // $t2 := unpack 0x1::option::Option<#0>($t6) mstore($locals, $MemoryLoadU256(add($t6, 0))) $Free($t6, 32) // $t7 := borrow_local($t2) diff --git a/third_party/move/evm/move-to-yul/tests/test-events/CallEmit.exp b/third_party/move/evm/move-to-yul/tests/test-events/CallEmit.exp index ab8e443702abe..57270d396370a 100644 --- a/third_party/move/evm/move-to-yul/tests/test-events/CallEmit.exp +++ b/third_party/move/evm/move-to-yul/tests/test-events/CallEmit.exp @@ -137,7 +137,7 @@ object "A2_M" { $Abort(97) function A2_M_do_event_1(from, to, amount) { let $t3 - // $t3 := pack M::Event_1($t0, $t1, $t2) + // $t3 := pack 0x2::M::Event_1($t0, $t1, $t2) { let $mem := $Malloc(65) $MemoryStoreU8(add($mem, 64), from) @@ -145,14 +145,14 @@ object "A2_M" { $MemoryStoreU256(add($mem, 32), amount) $t3 := $mem } - // Evm::emit($t3) + // Evm::emit<0x2::M::Event_1>($t3) A2_Evm_emit$A2_M_Event_1$($t3) // return () } function A2_M_do_event_2(v1, v2, v3, v4) { let $t4 - // $t4 := pack M::Event_2($t0, $t1, $t2, $t3) + // $t4 := pack 0x2::M::Event_2($t0, $t1, $t2, $t3) { let $mem := $Malloc(73) $MemoryStoreU8(add($mem, 72), v1) @@ -161,14 +161,14 @@ object "A2_M" { $MemoryStoreU256(add($mem, 0), v4) $t4 := $mem } - // Evm::emit($t4) + // Evm::emit<0x2::M::Event_2>($t4) A2_Evm_emit$A2_M_Event_2$($t4) // return () } function A2_M_do_event_3(from, to, amount) { let $t3 - // $t3 := pack M::Event_3($t0, $t1, $t2) + // $t3 := pack 0x2::M::Event_3($t0, $t1, $t2) { let $mem := $Malloc(65) $MemoryStoreU8(add($mem, 64), from) @@ -176,14 +176,14 @@ object "A2_M" { $MemoryStoreU256(add($mem, 32), amount) $t3 := $mem } - // Evm::emit($t3) + // Evm::emit<0x2::M::Event_3>($t3) A2_Evm_emit$A2_M_Event_3$($t3) // return () } function A2_M_do_event_4(v1, v2, v3) { let $t3 - // $t3 := pack M::Event_4($t0, $t1, $t2) + // $t3 := pack 0x2::M::Event_4($t0, $t1, $t2) { let $mem := $Malloc(96) $MemoryStoreU256(add($mem, 0), v1) @@ -191,28 +191,28 @@ object "A2_M" { $MemoryStoreU256(add($mem, 64), v3) $t3 := $mem } - // Evm::emit($t3) + // Evm::emit<0x2::M::Event_4>($t3) A2_Evm_emit$A2_M_Event_4$($t3) // return () } function A2_M_do_event_5(bys, str) { let $t2 - // $t2 := pack M::Event_5($t0, $t1) + // $t2 := pack 0x2::M::Event_5($t0, $t1) { let $mem := $Malloc(64) $MemoryStoreU256(add($mem, 0), bys) $MemoryStoreU256(add($mem, 32), str) $t2 := $mem } - // Evm::emit($t2) + // Evm::emit<0x2::M::Event_5>($t2) A2_Evm_emit$A2_M_Event_5$($t2) // return () } function A2_M_do_event_6(bys, str, uint16_array) { let $t3 - // $t3 := pack M::Event_6($t0, $t1, $t2) + // $t3 := pack 0x2::M::Event_6($t0, $t1, $t2) { let $mem := $Malloc(96) $MemoryStoreU256(add($mem, 0), bys) @@ -220,41 +220,41 @@ object "A2_M" { $MemoryStoreU256(add($mem, 64), uint16_array) $t3 := $mem } - // Evm::emit($t3) + // Evm::emit<0x2::M::Event_6>($t3) A2_Evm_emit$A2_M_Event_6$($t3) // return () } function A2_M_do_event_7(bys) { let $t1 - // $t1 := pack M::Event_7($t0) + // $t1 := pack 0x2::M::Event_7($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), bys) $t1 := $mem } - // Evm::emit($t1) + // Evm::emit<0x2::M::Event_7>($t1) A2_Evm_emit$A2_M_Event_7$($t1) // return () } function A2_M_do_event_8(bys, strs) { let $t2 - // $t2 := pack M::Event_8($t0, $t1) + // $t2 := pack 0x2::M::Event_8($t0, $t1) { let $mem := $Malloc(64) $MemoryStoreU256(add($mem, 0), bys) $MemoryStoreU256(add($mem, 32), strs) $t2 := $mem } - // Evm::emit($t2) + // Evm::emit<0x2::M::Event_8>($t2) A2_Evm_emit$A2_M_Event_8$($t2) // return () } function A2_M_do_transfer(from, to, amount) { let $t3 - // $t3 := pack M::Transfer($t0, $t1, $t2) + // $t3 := pack 0x2::M::Transfer($t0, $t1, $t2) { let $mem := $Malloc(96) $MemoryStoreU256(add($mem, 0), from) @@ -262,7 +262,7 @@ object "A2_M" { $MemoryStoreU256(add($mem, 64), amount) $t3 := $mem } - // Evm::emit($t3) + // Evm::emit<0x2::M::Transfer>($t3) A2_Evm_emit$A2_M_Transfer$($t3) // return () } diff --git a/third_party/move/move-compiler-v2/src/bytecode_generator.rs b/third_party/move/move-compiler-v2/src/bytecode_generator.rs index e20f3b09bf19e..16248e056d369 100644 --- a/third_party/move/move-compiler-v2/src/bytecode_generator.rs +++ b/third_party/move/move-compiler-v2/src/bytecode_generator.rs @@ -447,7 +447,7 @@ impl<'env> Generator<'env> { self.emit_with(*id, |attr| Bytecode::Jump(attr, continue_label)); self.emit_with(*id, |attr| Bytecode::Label(attr, break_label)); }, - ExpData::LoopCont(id, do_continue) => { + ExpData::LoopCont(id, 0, do_continue) => { if let Some(LoopContext { continue_label, break_label, @@ -463,6 +463,9 @@ impl<'env> Generator<'env> { self.error(*id, "missing enclosing loop statement") } }, + ExpData::LoopCont(_, _, _) => { + unimplemented!("continue/break with nesting") + }, ExpData::SpecBlock(id, spec) => { // Map locals in spec to assigned temporaries. let mut replacer = |id, target| { diff --git a/third_party/move/move-compiler-v2/src/env_pipeline/inliner.rs b/third_party/move/move-compiler-v2/src/env_pipeline/inliner.rs index 6047eae1a82ab..77a4ce7eefede 100644 --- a/third_party/move/move-compiler-v2/src/env_pipeline/inliner.rs +++ b/third_party/move/move-compiler-v2/src/env_pipeline/inliner.rs @@ -800,7 +800,7 @@ impl<'env, 'rewriter> InlinedRewriter<'env, 'rewriter> { (lambda expressions)", ) }, - ExpData::LoopCont(node_id, is_continue) if !post && in_loop == 0 => { + ExpData::LoopCont(node_id, _, is_continue) if !post && in_loop == 0 => { let node_loc = env.get_node_loc(*node_id); env.error( &node_loc, @@ -1046,7 +1046,7 @@ impl<'env, 'rewriter> ExpRewriterFunctions for InlinedRewriter<'env, 'rewriter> self.in_loop += 1; true }, - ExpData::LoopCont(node_id, is_continue) if self.in_loop == 0 => { + ExpData::LoopCont(node_id, _, is_continue) if self.in_loop == 0 => { let node_loc = self.env.get_node_loc(*node_id); self.env.error( &node_loc, diff --git a/third_party/move/move-compiler-v2/tests/ability-check/ability_violation.exp b/third_party/move/move-compiler-v2/tests/ability-check/ability_violation.exp index 3910bd4b361dc..449755574b05a 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/ability_violation.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/ability_violation.exp @@ -1,6 +1,6 @@ Diagnostics: -error: local `x` of type `ability::Impotent` does not have the `copy` ability +error: local `x` of type `Impotent` does not have the `copy` ability ┌─ tests/ability-check/ability_violation.move:7:10 │ 7 │ (x, x); @@ -8,13 +8,13 @@ error: local `x` of type `ability::Impotent` does not have the `copy` ability │ │ │ copy needed here because value is still in use -error: value of type `ability::Impotent` does not have the `drop` ability +error: value of type `Impotent` does not have the `drop` ability ┌─ tests/ability-check/ability_violation.move:7:10 │ 7 │ (x, x); │ ^ implicitly dropped here since it is no longer used -error: value of type `ability::Impotent` does not have the `drop` ability +error: value of type `Impotent` does not have the `drop` ability ┌─ tests/ability-check/ability_violation.move:7:13 │ 7 │ (x, x); diff --git a/third_party/move/move-compiler-v2/tests/ability-check/alive_since_borrowed.exp b/third_party/move/move-compiler-v2/tests/ability-check/alive_since_borrowed.exp index 780b27d837589..558387a805c8a 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/alive_since_borrowed.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/alive_since_borrowed.exp @@ -1,12 +1,12 @@ Diagnostics: -error: local `x` of type `test::Impotent` does not have the `drop` ability +error: local `x` of type `Impotent` does not have the `drop` ability ┌─ tests/ability-check/alive_since_borrowed.move:7:17 │ 7 │ let y = &x; │ ^^ still borrowed but will be implicitly dropped later since it is no longer used -error: local `x` of type `test::S` does not have the `drop` ability +error: local `x` of type `S` does not have the `drop` ability ┌─ tests/ability-check/alive_since_borrowed.move:21:9 │ 21 │ x.g.h diff --git a/third_party/move/move-compiler-v2/tests/ability-check/assign.exp b/third_party/move/move-compiler-v2/tests/ability-check/assign.exp index 0b42b9566280a..342c5583dcf4a 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/assign.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/assign.exp @@ -1,6 +1,6 @@ Diagnostics: -error: local `s` of type `assign::S` does not have the `drop` ability +error: local `s` of type `S` does not have the `drop` ability ┌─ tests/ability-check/assign.move:17:9 │ 17 │ *s = S { f: 42, g: T { h: 42 } }; diff --git a/third_party/move/move-compiler-v2/tests/ability-check/bug_14189.exp b/third_party/move/move-compiler-v2/tests/ability-check/bug_14189.exp index 9be1b39f7a68d..1f466890ce1b3 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/bug_14189.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/bug_14189.exp @@ -1,6 +1,6 @@ Diagnostics: -error: local `x1` of type `test::S2` does not have the `copy` ability +error: local `x1` of type `S2` does not have the `copy` ability ┌─ tests/ability-check/bug_14189.move:34:18 │ 34 │ let x2 = S3 { x: x1, y: x0, z: x1 }; diff --git a/third_party/move/move-compiler-v2/tests/ability-check/bug_14223_unused_non_droppable_no_abort.exp b/third_party/move/move-compiler-v2/tests/ability-check/bug_14223_unused_non_droppable_no_abort.exp index 7686f9261cd64..b796cb2449c58 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/bug_14223_unused_non_droppable_no_abort.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/bug_14223_unused_non_droppable_no_abort.exp @@ -1,6 +1,6 @@ Diagnostics: -error: local `_x` of type `Module0::S` does not have the `drop` ability +error: local `_x` of type `S` does not have the `drop` ability ┌─ tests/ability-check/bug_14223_unused_non_droppable_no_abort.move:5:18 │ 5 │ let _x = S {}; diff --git a/third_party/move/move-compiler-v2/tests/ability-check/bug_14227.exp b/third_party/move/move-compiler-v2/tests/ability-check/bug_14227.exp index fd998cd08ec9e..9d9cc031d2a49 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/bug_14227.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/bug_14227.exp @@ -1,6 +1,6 @@ Diagnostics: -error: local `_common_fields` of type `m::CommonFields` does not have the `copy` ability +error: local `_common_fields` of type `CommonFields` does not have the `copy` ability ┌─ tests/ability-check/bug_14227.move:21:16 │ 21 │ y: vector[_common_fields] diff --git a/third_party/move/move-compiler-v2/tests/ability-check/explicit_move.exp b/third_party/move/move-compiler-v2/tests/ability-check/explicit_move.exp index 6d7bca3a95988..82955ef74829c 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/explicit_move.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/explicit_move.exp @@ -1,6 +1,6 @@ Diagnostics: -error: local `x` of type `m::R` does not have the `copy` ability +error: local `x` of type `R` does not have the `copy` ability ┌─ tests/ability-check/explicit_move.move:12:9 │ 12 │ some(x); diff --git a/third_party/move/move-compiler-v2/tests/ability-check/index_ability_err.exp b/third_party/move/move-compiler-v2/tests/ability-check/index_ability_err.exp index f43ecc4cd3d91..fa105ebb9bb60 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/index_ability_err.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/index_ability_err.exp @@ -1,6 +1,6 @@ Diagnostics: -error: value of type `test::Y>` does not have the `copy` ability +error: value of type `Y>` does not have the `copy` ability ┌─ tests/ability-check/index_ability_err.move:12:17 │ 12 │ let _ = Y>[addr]; diff --git a/third_party/move/move-compiler-v2/tests/ability-check/loop_abort.exp b/third_party/move/move-compiler-v2/tests/ability-check/loop_abort.exp index ad91b8f3de0f4..b1b16e0db1718 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/loop_abort.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/loop_abort.exp @@ -1,6 +1,6 @@ Diagnostics: -error: local `_x` of type `Test::Impotent` does not have the `drop` ability +error: local `_x` of type `Impotent` does not have the `drop` ability ┌─ tests/ability-check/loop_abort.move:11:18 │ 11 │ let _x = Impotent {}; diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/assign_unpack_references.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/assign_unpack_references.exp index bbc6a9d36aef0..2c976c12f11c9 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/typing/assign_unpack_references.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/assign_unpack_references.exp @@ -1,12 +1,12 @@ Diagnostics: -error: value of type `M::R` does not have the `drop` ability +error: value of type `R` does not have the `drop` ability ┌─ tests/ability-check/typing/assign_unpack_references.move:17:33 │ 17 │ R { s1: S { f }, s2 } = &R { s1: S{f: 0}, s2: S{f: 1} }; f; s2; │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ still borrowed but will be implicitly dropped later since it is no longer used -error: value of type `M::R` does not have the `drop` ability +error: value of type `R` does not have the `drop` ability ┌─ tests/ability-check/typing/assign_unpack_references.move:27:33 │ 27 │ R { s1: S { f }, s2 } = &mut R { s1: S{f: 0}, s2: S{f: 1} }; f; s2; diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/bind_unpack_references.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/bind_unpack_references.exp index ac2b384d7f6a7..4ebf1bda482f5 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/typing/bind_unpack_references.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/bind_unpack_references.exp @@ -1,12 +1,12 @@ Diagnostics: -error: value of type `M::R` does not have the `drop` ability +error: value of type `R` does not have the `drop` ability ┌─ tests/ability-check/typing/bind_unpack_references.move:13:41 │ 13 │ let R { s1: S { f }, s2 }: &R = &R { s1: S{f: 0}, s2: S{f: 1} }; f; s2; │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ still borrowed but will be implicitly dropped later since it is no longer used -error: value of type `M::R` does not have the `drop` ability +error: value of type `R` does not have the `drop` ability ┌─ tests/ability-check/typing/bind_unpack_references.move:20:45 │ 20 │ let R { s1: S { f }, s2 }: &mut R = &mut R { s1: S{f: 0}, s2: S{f: 1} }; f; s2; diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/borrow_local_temp_resource.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/borrow_local_temp_resource.exp index 470ba80ca3109..e094596ecd526 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/typing/borrow_local_temp_resource.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/borrow_local_temp_resource.exp @@ -1,12 +1,12 @@ Diagnostics: -error: value of type `M::R` does not have the `drop` ability +error: value of type `R` does not have the `drop` ability ┌─ tests/ability-check/typing/borrow_local_temp_resource.move:6:9 │ 6 │ &R{}; │ ^^^^ implicitly dropped here since it is no longer used -error: value of type `M::R` does not have the `drop` ability +error: value of type `R` does not have the `drop` ability ┌─ tests/ability-check/typing/borrow_local_temp_resource.move:7:9 │ 7 │ &mut R{}; diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/derefrence_reference.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/derefrence_reference.exp index 75db7a1e361f1..b2f9787f94a1a 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/typing/derefrence_reference.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/derefrence_reference.exp @@ -1,42 +1,42 @@ Diagnostics: -error: local `r` of type `M::R` does not have the `copy` ability +error: local `r` of type `R` does not have the `copy` ability ┌─ tests/ability-check/typing/derefrence_reference.move:6:16 │ 6 │ R {} = *r; │ ^^ reference content copied here -error: local `b` of type `M::B` does not have the `copy` ability +error: local `b` of type `B` does not have the `copy` ability ┌─ tests/ability-check/typing/derefrence_reference.move:7:24 │ 7 │ B { r: R{} } = *b; │ ^^ reference content copied here -error: value of type `M::R` does not have the `copy` ability +error: value of type `R` does not have the `copy` ability ┌─ tests/ability-check/typing/derefrence_reference.move:8:17 │ 8 │ R{} = *&b.r; │ ^^^ reference content copied here -error: local `r` of type `M::R` does not have the `copy` ability +error: local `r` of type `R` does not have the `copy` ability ┌─ tests/ability-check/typing/derefrence_reference.move:12:16 │ 12 │ R {} = *r; │ ^^ reference content copied here -error: local `b` of type `M::B` does not have the `copy` ability +error: local `b` of type `B` does not have the `copy` ability ┌─ tests/ability-check/typing/derefrence_reference.move:13:24 │ 13 │ B { r: R{} } = *b; │ ^^ reference content copied here -error: value of type `M::R` does not have the `copy` ability +error: value of type `R` does not have the `copy` ability ┌─ tests/ability-check/typing/derefrence_reference.move:14:17 │ 14 │ R{} = *&b.r; │ ^^^ reference content copied here -error: value of type `M::R` does not have the `copy` ability +error: value of type `R` does not have the `copy` ability ┌─ tests/ability-check/typing/derefrence_reference.move:15:21 │ 15 │ R{} = *&mut b.r; diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/eq_invalid2.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/eq_invalid2.exp index 7fea4b627a31d..a415502fc4815 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/typing/eq_invalid2.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/eq_invalid2.exp @@ -1,18 +1,18 @@ Diagnostics: -error: local `r` of type `M::R` does not have the `copy` ability +error: local `r` of type `R` does not have the `copy` ability ┌─ tests/ability-check/typing/eq_invalid2.move:11:9 │ 11 │ r == r; │ ^^^^^^ copy needed here because value is still in use -error: local `r` of type `M::R` does not have the `drop` ability +error: local `r` of type `R` does not have the `drop` ability ┌─ tests/ability-check/typing/eq_invalid2.move:11:9 │ 11 │ r == r; │ ^^^^^^ operator drops value here (consider borrowing the argument) -error: value of type `M::G1` does not have the `drop` ability +error: value of type `G1` does not have the `drop` ability ┌─ tests/ability-check/typing/eq_invalid2.move:15:9 │ 15 │ G1{ f: t } == G1{ f: t }; diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/mutate_resource.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/mutate_resource.exp index 6be249a01f461..8a2dbc1c78b74 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/typing/mutate_resource.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/mutate_resource.exp @@ -1,6 +1,6 @@ Diagnostics: -error: local `r` of type `M::R` does not have the `drop` ability +error: local `r` of type `R` does not have the `drop` ability ┌─ tests/ability-check/typing/mutate_resource.move:5:9 │ 5 │ *r = R {}; diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/neq_invalid2.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/neq_invalid2.exp index c21ca3e6e5640..c07bea1c68b1b 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/typing/neq_invalid2.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/neq_invalid2.exp @@ -1,36 +1,36 @@ Diagnostics: -error: local `s2` of type `M::S` does not have the `drop` ability +error: local `s2` of type `S` does not have the `drop` ability ┌─ tests/ability-check/typing/neq_invalid2.move:17:9 │ 17 │ s != s2; │ ^^^^^^^ operator drops value here (consider borrowing the argument) -error: local `s` of type `M::S` does not have the `drop` ability +error: local `s` of type `S` does not have the `drop` ability ┌─ tests/ability-check/typing/neq_invalid2.move:17:9 │ 17 │ s != s2; │ ^^^^^^^ operator drops value here (consider borrowing the argument) -error: local `r1` of type `M::R` does not have the `drop` ability +error: local `r1` of type `R` does not have the `drop` ability ┌─ tests/ability-check/typing/neq_invalid2.move:22:9 │ 22 │ r1 != r2; │ ^^^^^^^^ operator drops value here (consider borrowing the argument) -error: local `r2` of type `M::R` does not have the `drop` ability +error: local `r2` of type `R` does not have the `drop` ability ┌─ tests/ability-check/typing/neq_invalid2.move:22:9 │ 22 │ r1 != r2; │ ^^^^^^^^ operator drops value here (consider borrowing the argument) -error: value of type `M::G1` does not have the `drop` ability +error: value of type `G1` does not have the `drop` ability ┌─ tests/ability-check/typing/neq_invalid2.move:27:9 │ 27 │ G1{} != G1{}; │ ^^^^^^^^^^^^^^^^^^^^^^ operator drops value here (consider borrowing the argument) -error: value of type `M::G2` does not have the `drop` ability +error: value of type `G2` does not have the `drop` ability ┌─ tests/ability-check/typing/neq_invalid2.move:28:9 │ 28 │ G2{} != G2{}; diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/pack.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/pack.exp index b35c01849ea5f..f413f2adcb141 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/typing/pack.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/pack.exp @@ -1,6 +1,6 @@ Diagnostics: -error: local `s` of type `M::S` does not have the `copy` ability +error: local `s` of type `S` does not have the `copy` ability ┌─ tests/ability-check/typing/pack.move:14:29 │ 14 │ let n2 = Nat { f: *&s }; diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/phantom_param_op_abilities_invalid2.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/phantom_param_op_abilities_invalid2.exp index 9ff4f8060bc86..412b4fac8c74d 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/typing/phantom_param_op_abilities_invalid2.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/phantom_param_op_abilities_invalid2.exp @@ -1,18 +1,18 @@ Diagnostics: -error: local `ref` of type `M::HasDrop` does not have the `drop` ability +error: local `ref` of type `HasDrop` does not have the `drop` ability ┌─ tests/ability-check/typing/phantom_param_op_abilities_invalid2.move:11:9 │ 11 │ *ref = HasDrop { a: NoAbilities { } }; │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reference content dropped here -error: value of type `M::HasDrop` does not have the `drop` ability +error: value of type `HasDrop` does not have the `drop` ability ┌─ tests/ability-check/typing/phantom_param_op_abilities_invalid2.move:16:9 │ 16 │ _ = HasDrop { a: NoAbilities { } }; │ ^ implicitly dropped here since it is no longer used -error: local `_x` of type `M::HasDrop` does not have the `drop` ability +error: local `_x` of type `HasDrop` does not have the `drop` ability ┌─ tests/ability-check/typing/phantom_param_op_abilities_invalid2.move:20:51 │ 20 │ fun f3(_x: HasDrop) { @@ -20,7 +20,7 @@ error: local `_x` of type `M::HasDrop` does not 21 │ │ } │ ╰─────^ implicitly dropped here since it is no longer used -error: local `x` of type `M::HasCopy` does not have the `copy` ability +error: local `x` of type `HasCopy` does not have the `copy` ability ┌─ tests/ability-check/typing/phantom_param_op_abilities_invalid2.move:25:10 │ 25 │ (copy x, x) diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/type_variable_join_threaded_unpack.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/type_variable_join_threaded_unpack.exp index a00ded68efbf9..41c2aec98921a 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/typing/type_variable_join_threaded_unpack.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/type_variable_join_threaded_unpack.exp @@ -1,6 +1,6 @@ Diagnostics: -error: local `f1` of type `M::Box>` does not have the `copy` ability +error: local `f1` of type `Box>` does not have the `copy` ability ┌─ tests/ability-check/typing/type_variable_join_threaded_unpack.move:40:44 │ 40 │ Container::put(&mut v, Box { f1: *&f1, f2 }); diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/type_variable_join_threaded_unpack_assign.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/type_variable_join_threaded_unpack_assign.exp index 01898c35db8c6..d95c02ffe7b31 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/typing/type_variable_join_threaded_unpack_assign.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/type_variable_join_threaded_unpack_assign.exp @@ -1,6 +1,6 @@ Diagnostics: -error: local `f1` of type `M::Box>` does not have the `copy` ability +error: local `f1` of type `Box>` does not have the `copy` ability ┌─ tests/ability-check/typing/type_variable_join_threaded_unpack_assign.move:44:44 │ 44 │ Container::put(&mut v, Box { f1: *&f1, f2 }); diff --git a/third_party/move/move-compiler-v2/tests/ability-check/unused_para_no_drop.exp b/third_party/move/move-compiler-v2/tests/ability-check/unused_para_no_drop.exp index 836f76fef6fd2..011b5e8f6e77d 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/unused_para_no_drop.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/unused_para_no_drop.exp @@ -8,7 +8,7 @@ error: local `_x` of type `T` does not have the `drop` ability 10 │ │ } │ ╰─────^ implicitly dropped here since it is no longer used -error: local `_x` of type `m::S` does not have the `drop` ability +error: local `_x` of type `S` does not have the `drop` ability ┌─ tests/ability-check/unused_para_no_drop.move:15:26 │ 15 │ public fun f3(_x: S) { @@ -16,7 +16,7 @@ error: local `_x` of type `m::S` does not have the `drop` ability 16 │ │ } │ ╰─────^ implicitly dropped here since it is no longer used -error: local `_x` of type `vector` does not have the `drop` ability +error: local `_x` of type `vector` does not have the `drop` ability ┌─ tests/ability-check/unused_para_no_drop.move:21:34 │ 21 │ public fun f5(_x: vector) { @@ -30,13 +30,13 @@ error: local `_y` of type `T` does not have the `drop` ability 38 │ x │ ^ implicitly dropped here since it is no longer used -error: local `x` of type `m::S` does not have the `drop` ability +error: local `x` of type `S` does not have the `drop` ability ┌─ tests/ability-check/unused_para_no_drop.move:42:9 │ 42 │ &x == &y │ ^^ still borrowed but will be implicitly dropped later since it is no longer used -error: local `y` of type `m::S` does not have the `drop` ability +error: local `y` of type `S` does not have the `drop` ability ┌─ tests/ability-check/unused_para_no_drop.move:42:15 │ 42 │ &x == &y @@ -54,13 +54,13 @@ error: local `y` of type `T` does not have the `drop` ability 46 │ &x == &y │ ^^ still borrowed but will be implicitly dropped later since it is no longer used -error: local `x` of type `m::S2` does not have the `drop` ability +error: local `x` of type `S2` does not have the `drop` ability ┌─ tests/ability-check/unused_para_no_drop.move:54:9 │ 54 │ x.foo == y.foo │ ^ still borrowed but will be implicitly dropped later since it is no longer used -error: local `y` of type `m::S2` does not have the `drop` ability +error: local `y` of type `S2` does not have the `drop` ability ┌─ tests/ability-check/unused_para_no_drop.move:54:18 │ 54 │ x.foo == y.foo diff --git a/third_party/move/move-compiler-v2/tests/ability-check/v1-borrow-tests/assign_resource.exp b/third_party/move/move-compiler-v2/tests/ability-check/v1-borrow-tests/assign_resource.exp index db2b4f2d7dfab..88b027952a193 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/v1-borrow-tests/assign_resource.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/v1-borrow-tests/assign_resource.exp @@ -1,12 +1,12 @@ Diagnostics: -error: local `t` of type `M::T` does not have the `drop` ability +error: local `t` of type `T` does not have the `drop` ability ┌─ tests/ability-check/v1-borrow-tests/assign_resource.move:5:22 │ 5 │ let t = T{}; &t; │ ^^ implicitly dropped here since it is no longer used -error: local `t` of type `M::T` does not have the `drop` ability +error: local `t` of type `T` does not have the `drop` ability ┌─ tests/ability-check/v1-borrow-tests/assign_resource.move:6:19 │ 6 │ t = T {}; &t; diff --git a/third_party/move/move-compiler-v2/tests/ability-check/v1-borrow-tests/no_drop.exp b/third_party/move/move-compiler-v2/tests/ability-check/v1-borrow-tests/no_drop.exp index 87e25ce461590..d0f0bd3816cb5 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/v1-borrow-tests/no_drop.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/v1-borrow-tests/no_drop.exp @@ -1,6 +1,6 @@ Diagnostics: -error: local `x` of type `M::X` does not have the `drop` ability +error: local `x` of type `X` does not have the `drop` ability ┌─ tests/ability-check/v1-borrow-tests/no_drop.move:6:9 │ 6 │ &x; diff --git a/third_party/move/move-compiler-v2/tests/ability-check/v1-locals/drop_conditional.exp b/third_party/move/move-compiler-v2/tests/ability-check/v1-locals/drop_conditional.exp index 3aeca4920a7b0..3d1e5403d7704 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/v1-locals/drop_conditional.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/v1-locals/drop_conditional.exp @@ -1,12 +1,12 @@ Diagnostics: -error: local `x` of type `M::Cup` does not have the `drop` ability +error: local `x` of type `Cup` does not have the `drop` ability ┌─ tests/ability-check/v1-locals/drop_conditional.move:12:9 │ 12 │ &x; │ ^^ implicitly dropped here since it is no longer used -error: local `x` of type `M::Pair` does not have the `drop` ability +error: local `x` of type `Pair` does not have the `drop` ability ┌─ tests/ability-check/v1-locals/drop_conditional.move:14:9 │ 14 │ &x; diff --git a/third_party/move/move-compiler-v2/tests/ability-check/v1-locals/reassign_parameter.exp b/third_party/move/move-compiler-v2/tests/ability-check/v1-locals/reassign_parameter.exp index 9b30add3a1359..f19e3cefbc39c 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/v1-locals/reassign_parameter.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/v1-locals/reassign_parameter.exp @@ -1,6 +1,6 @@ Diagnostics: -error: local `r` of type `M::R` does not have the `drop` ability +error: local `r` of type `R` does not have the `drop` ability ┌─ tests/ability-check/v1-locals/reassign_parameter.move:7:9 │ 7 │ â•­ if (true) { diff --git a/third_party/move/move-compiler-v2/tests/ability-check/v1-signer/copy_loc_transitive.exp b/third_party/move/move-compiler-v2/tests/ability-check/v1-signer/copy_loc_transitive.exp index 884b679059917..e9484ac844f4d 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/v1-signer/copy_loc_transitive.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/v1-signer/copy_loc_transitive.exp @@ -1,6 +1,6 @@ Diagnostics: -error: local `x` of type `M::S` does not have the `copy` ability +error: local `x` of type `S` does not have the `copy` ability ┌─ tests/ability-check/v1-signer/copy_loc_transitive.move:5:9 │ 5 │ copy x diff --git a/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/assign_pop_resource.exp b/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/assign_pop_resource.exp index 4094f23a8ee64..21b3423e4df58 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/assign_pop_resource.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/assign_pop_resource.exp @@ -1,18 +1,18 @@ Diagnostics: -error: value of type `M::R` does not have the `drop` ability +error: value of type `R` does not have the `drop` ability ┌─ tests/ability-check/v1-typing/assign_pop_resource.move:5:9 │ 5 │ _ = R{}; │ ^ implicitly dropped here since it is no longer used -error: value of type `M::R` does not have the `drop` ability +error: value of type `R` does not have the `drop` ability ┌─ tests/ability-check/v1-typing/assign_pop_resource.move:6:10 │ 6 │ (_, _) = (R{}, R{}); │ ^ implicitly dropped here since it is no longer used -error: value of type `M::R` does not have the `drop` ability +error: value of type `R` does not have the `drop` ability ┌─ tests/ability-check/v1-typing/assign_pop_resource.move:6:13 │ 6 │ (_, _) = (R{}, R{}); diff --git a/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/bind_pop_resource.exp b/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/bind_pop_resource.exp index 2c2f2e34d9686..553bf316dc87d 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/bind_pop_resource.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/bind_pop_resource.exp @@ -1,24 +1,24 @@ Diagnostics: -error: value of type `M::R` does not have the `drop` ability +error: value of type `R` does not have the `drop` ability ┌─ tests/ability-check/v1-typing/bind_pop_resource.move:5:13 │ 5 │ let _: R = R{}; │ ^ implicitly dropped here since it is no longer used -error: local `_r` of type `M::R` does not have the `drop` ability +error: local `_r` of type `R` does not have the `drop` ability ┌─ tests/ability-check/v1-typing/bind_pop_resource.move:8:21 │ 8 │ let _r: R = R{}; │ ^^^ implicitly dropped here since it is no longer used -error: value of type `M::R` does not have the `drop` ability +error: value of type `R` does not have the `drop` ability ┌─ tests/ability-check/v1-typing/bind_pop_resource.move:9:14 │ 9 │ let (_, _):(R, R) = (R{}, R{}); │ ^ implicitly dropped here since it is no longer used -error: value of type `M::R` does not have the `drop` ability +error: value of type `R` does not have the `drop` ability ┌─ tests/ability-check/v1-typing/bind_pop_resource.move:9:17 │ 9 │ let (_, _):(R, R) = (R{}, R{}); diff --git a/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/borrow_field_non_ref_non_local_root.exp b/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/borrow_field_non_ref_non_local_root.exp index 3ca8e651183f9..cd06c954f6388 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/borrow_field_non_ref_non_local_root.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/borrow_field_non_ref_non_local_root.exp @@ -1,6 +1,6 @@ Diagnostics: -error: value of type `M::S` does not have the `copy` ability +error: value of type `S` does not have the `copy` ability ┌─ tests/ability-check/v1-typing/borrow_field_non_ref_non_local_root.move:9:22 │ 9 │ (&(if (cond) *foo() else bar()).f : &u64); diff --git a/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/conditional_copy_invalid.exp b/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/conditional_copy_invalid.exp index 25893cff8e123..5c0feae4f836e 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/conditional_copy_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/conditional_copy_invalid.exp @@ -1,60 +1,60 @@ Diagnostics: -error: local `x` of type `M::Box` does not have the `copy` ability +error: local `x` of type `Box` does not have the `copy` ability ┌─ tests/ability-check/v1-typing/conditional_copy_invalid.move:15:16 │ 15 │ ignore(copy x); │ ^^^^^^ explicitly copied here -error: local `x` of type `M::Box>` does not have the `copy` ability +error: local `x` of type `Box>` does not have the `copy` ability ┌─ tests/ability-check/v1-typing/conditional_copy_invalid.move:17:16 │ 17 │ ignore(copy x); │ ^^^^^^ explicitly copied here -error: local `x` of type `M::Box` does not have the `copy` ability +error: local `x` of type `Box` does not have the `copy` ability ┌─ tests/ability-check/v1-typing/conditional_copy_invalid.move:19:16 │ 19 │ ignore(copy x); │ ^^^^^^ explicitly copied here -error: local `x` of type `M::Box>` does not have the `copy` ability +error: local `x` of type `Box>` does not have the `copy` ability ┌─ tests/ability-check/v1-typing/conditional_copy_invalid.move:21:16 │ 21 │ ignore(copy x); │ ^^^^^^ explicitly copied here -error: local `x` of type `M::Pair` does not have the `copy` ability +error: local `x` of type `Pair` does not have the `copy` ability ┌─ tests/ability-check/v1-typing/conditional_copy_invalid.move:23:16 │ 23 │ ignore(copy x); │ ^^^^^^ explicitly copied here -error: local `x` of type `M::Box` does not have the `copy` ability +error: local `x` of type `Box` does not have the `copy` ability ┌─ tests/ability-check/v1-typing/conditional_copy_invalid.move:27:16 │ 27 │ ignore(*x); │ ^^ reference content copied here -error: local `x` of type `M::Box>` does not have the `copy` ability +error: local `x` of type `Box>` does not have the `copy` ability ┌─ tests/ability-check/v1-typing/conditional_copy_invalid.move:29:16 │ 29 │ ignore(*x); │ ^^ reference content copied here -error: local `x` of type `M::Box` does not have the `copy` ability +error: local `x` of type `Box` does not have the `copy` ability ┌─ tests/ability-check/v1-typing/conditional_copy_invalid.move:31:16 │ 31 │ ignore(*x); │ ^^ reference content copied here -error: local `x` of type `M::Box>` does not have the `copy` ability +error: local `x` of type `Box>` does not have the `copy` ability ┌─ tests/ability-check/v1-typing/conditional_copy_invalid.move:33:16 │ 33 │ ignore(*x); │ ^^ reference content copied here -error: local `x` of type `M::Pair` does not have the `copy` ability +error: local `x` of type `Pair` does not have the `copy` ability ┌─ tests/ability-check/v1-typing/conditional_copy_invalid.move:35:16 │ 35 │ ignore(*x); diff --git a/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/conditional_drop_invalid.exp b/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/conditional_drop_invalid.exp index e450ad7e5cc9c..5f8413a07c1a8 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/conditional_drop_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/conditional_drop_invalid.exp @@ -1,66 +1,66 @@ Diagnostics: -error: value of type `M::Box` does not have the `drop` ability +error: value of type `Box` does not have the `drop` ability ┌─ tests/ability-check/v1-typing/conditional_drop_invalid.move:10:9 │ 10 │ Box { f: R{} }; │ ^^^^^^^^^^^^^^^^^ implicitly dropped here since it is no longer used -error: value of type `M::Box>` does not have the `drop` ability +error: value of type `Box>` does not have the `drop` ability ┌─ tests/ability-check/v1-typing/conditional_drop_invalid.move:11:9 │ 11 │ Box> { f: Box { f: R{} } }; │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implicitly dropped here since it is no longer used -error: value of type `M::Box` does not have the `drop` ability +error: value of type `Box` does not have the `drop` ability ┌─ tests/ability-check/v1-typing/conditional_drop_invalid.move:12:9 │ 12 │ Box { f: t }; │ ^^^^^^^^^^^^^^^ implicitly dropped here since it is no longer used -error: value of type `M::Box>` does not have the `drop` ability +error: value of type `Box>` does not have the `drop` ability ┌─ tests/ability-check/v1-typing/conditional_drop_invalid.move:13:9 │ 13 │ Box> { f: Box { f: t } }; │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implicitly dropped here since it is no longer used -error: value of type `M::Pair` does not have the `drop` ability +error: value of type `Pair` does not have the `drop` ability ┌─ tests/ability-check/v1-typing/conditional_drop_invalid.move:14:9 │ 14 │ Pair { f1: S{}, f2: R{} }; │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implicitly dropped here since it is no longer used -error: value of type `M::Pair` does not have the `drop` ability +error: value of type `Pair` does not have the `drop` ability ┌─ tests/ability-check/v1-typing/conditional_drop_invalid.move:15:10 │ 15 │ (Pair { f1: S{}, f2: R{} }, 0, @0x1); │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implicitly dropped here since it is no longer used -error: value of type `M::Box` does not have the `drop` ability +error: value of type `Box` does not have the `drop` ability ┌─ tests/ability-check/v1-typing/conditional_drop_invalid.move:17:9 │ 17 │ Box { f: R {} } == Box { f: R {} }; │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ operator drops value here (consider borrowing the argument) -error: value of type `M::Box>` does not have the `drop` ability +error: value of type `Box>` does not have the `drop` ability ┌─ tests/ability-check/v1-typing/conditional_drop_invalid.move:18:9 │ 18 │ Box> { f: Box { f: R {} } } == Box> { f: Box { f: R {} }}; │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ operator drops value here (consider borrowing the argument) -error: value of type `M::Box` does not have the `drop` ability +error: value of type `Box` does not have the `drop` ability ┌─ tests/ability-check/v1-typing/conditional_drop_invalid.move:19:9 │ 19 │ Box { f: t } == Box { f: t }; │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ operator drops value here (consider borrowing the argument) -error: value of type `M::Box>` does not have the `drop` ability +error: value of type `Box>` does not have the `drop` ability ┌─ tests/ability-check/v1-typing/conditional_drop_invalid.move:20:9 │ 20 │ Box> { f: Box { f: t } } == Box> { f: Box { f: t} }; │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ operator drops value here (consider borrowing the argument) -error: value of type `M::Pair` does not have the `drop` ability +error: value of type `Pair` does not have the `drop` ability ┌─ tests/ability-check/v1-typing/conditional_drop_invalid.move:21:9 │ 21 │ Pair { f1: R{}, f2: S{} } == Pair { f1: R{}, f2: S{} }; diff --git a/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/implicit_deref_borrow_field_not_copyable.exp b/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/implicit_deref_borrow_field_not_copyable.exp index 891b17c507714..f9b7fb8bde20e 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/implicit_deref_borrow_field_not_copyable.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/implicit_deref_borrow_field_not_copyable.exp @@ -1,12 +1,12 @@ Diagnostics: -error: value of type `M::R` does not have the `copy` ability +error: value of type `R` does not have the `copy` ability ┌─ tests/ability-check/v1-typing/implicit_deref_borrow_field_not_copyable.move:8:15 │ 8 │ R{} = b.r; │ ^^^ reference content copied here -error: value of type `M::R` does not have the `copy` ability +error: value of type `R` does not have the `copy` ability ┌─ tests/ability-check/v1-typing/implicit_deref_borrow_field_not_copyable.move:11:15 │ 11 │ R{} = bref.r; diff --git a/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/seq_cannot_ignore_resource.exp b/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/seq_cannot_ignore_resource.exp index 2f2544c85cbb7..a0b416f33dffa 100644 --- a/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/seq_cannot_ignore_resource.exp +++ b/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/seq_cannot_ignore_resource.exp @@ -1,36 +1,36 @@ Diagnostics: -error: value of type `M::R` does not have the `drop` ability +error: value of type `R` does not have the `drop` ability ┌─ tests/ability-check/v1-typing/seq_cannot_ignore_resource.move:5:9 │ 5 │ R{}; │ ^^^ implicitly dropped here since it is no longer used -error: value of type `M::R` does not have the `drop` ability +error: value of type `R` does not have the `drop` ability ┌─ tests/ability-check/v1-typing/seq_cannot_ignore_resource.move:10:9 │ 10 │ r; │ ^ implicitly dropped here since it is no longer used -error: value of type `M::R` does not have the `drop` ability +error: value of type `R` does not have the `drop` ability ┌─ tests/ability-check/v1-typing/seq_cannot_ignore_resource.move:14:20 │ 14 │ (0, false, R{}); │ ^^^ implicitly dropped here since it is no longer used -error: value of type `M::R` does not have the `drop` ability +error: value of type `R` does not have the `drop` ability ┌─ tests/ability-check/v1-typing/seq_cannot_ignore_resource.move:19:30 │ 19 │ if (true) (0, false, R{}) else (0, false, r); │ ^^^ implicitly dropped here since it is no longer used -error: local `r` of type `M::R` does not have the `drop` ability +error: local `r` of type `R` does not have the `drop` ability ┌─ tests/ability-check/v1-typing/seq_cannot_ignore_resource.move:19:19 │ 19 │ if (true) (0, false, R{}) else (0, false, r); │ ^^^^^^^^^^^^^^^ implicitly dropped here since it is no longer used -error: value of type `M::R` does not have the `drop` ability +error: value of type `R` does not have the `drop` ability ┌─ tests/ability-check/v1-typing/seq_cannot_ignore_resource.move:19:51 │ 19 │ if (true) (0, false, R{}) else (0, false, r); diff --git a/third_party/move/move-compiler-v2/tests/ability-transform/borrowed_from_one_path.exp b/third_party/move/move-compiler-v2/tests/ability-transform/borrowed_from_one_path.exp index 322649a3dde34..64fd1e4a61b95 100644 --- a/third_party/move/move-compiler-v2/tests/ability-transform/borrowed_from_one_path.exp +++ b/third_party/move/move-compiler-v2/tests/ability-transform/borrowed_from_one_path.exp @@ -6,7 +6,7 @@ fun m::f($t0: u8, $t1: &vector): u64 { var $t3: &vector var $t4: bool var $t5: u8 - var $t6: &m::R + var $t6: &0x42::m::R var $t7: address var $t8: &u64 var $t9: u64 @@ -15,8 +15,8 @@ fun m::f($t0: u8, $t1: &vector): u64 { 2: if ($t4) goto 3 else goto 8 3: label L0 4: $t7 := 0x1 - 5: $t6 := borrow_global($t7) - 6: $t3 := borrow_field.data($t6) + 5: $t6 := borrow_global<0x42::m::R>($t7) + 6: $t3 := borrow_field<0x42::m::R>.data($t6) 7: goto 10 8: label L1 9: $t3 := infer($t1) @@ -35,7 +35,7 @@ fun m::f($t0: u8, $t1: &vector): u64 { var $t3: &vector var $t4: bool var $t5: u8 - var $t6: &m::R + var $t6: &0x42::m::R var $t7: address var $t8: &u64 var $t9: u64 @@ -50,9 +50,9 @@ fun m::f($t0: u8, $t1: &vector): u64 { # live vars: 4: $t7 := 0x1 # live vars: $t7 - 5: $t6 := borrow_global($t7) + 5: $t6 := borrow_global<0x42::m::R>($t7) # live vars: $t6 - 6: $t3 := borrow_field.data($t6) + 6: $t3 := borrow_field<0x42::m::R>.data($t6) # live vars: $t3 7: goto 10 # live vars: $t1 @@ -79,7 +79,7 @@ fun m::f($t0: u8, $t1: &vector): u64 { var $t3: &vector var $t4: bool var $t5: u8 - var $t6: &m::R + var $t6: &0x42::m::R var $t7: address var $t8: &u64 var $t9: u64 @@ -94,9 +94,9 @@ fun m::f($t0: u8, $t1: &vector): u64 { # live vars: 4: $t7 := 0x1 # live vars: $t7 - 5: $t6 := borrow_global($t7) + 5: $t6 := borrow_global<0x42::m::R>($t7) # live vars: $t6 - 6: $t3 := borrow_field.data($t6) + 6: $t3 := borrow_field<0x42::m::R>.data($t6) # live vars: $t3 7: goto 10 # live vars: $t1 @@ -123,7 +123,7 @@ fun m::f($t0: u8, $t1: &vector): u64 { var $t3: &vector var $t4: bool var $t5: u8 - var $t6: &m::R + var $t6: &0x42::m::R var $t7: address var $t8: &u64 var $t9: u64 @@ -166,7 +166,7 @@ fun m::f($t0: u8, $t1: &vector): u64 { # live vars: $t7 # refs: [] # - 5: $t6 := borrow_global($t7) + 5: $t6 := borrow_global<0x42::m::R>($t7) # live vars: $t6 # refs: [$t6 => #6] # #6 @@ -174,7 +174,7 @@ fun m::f($t0: u8, $t1: &vector): u64 { # #root # -> #6 via [struct `m::R`] at line 12 # - 6: $t3 := borrow_field.data($t6) + 6: $t3 := borrow_field<0x42::m::R>.data($t6) # live vars: $t3 # refs: [$t3 => #3] # #3 @@ -245,7 +245,7 @@ fun m::f($t0: u8, $t1: &vector): u64 { var $t3: &vector var $t4: bool var $t5: u8 - var $t6: &m::R + var $t6: &0x42::m::R var $t7: address var $t8: &u64 var $t9: u64 @@ -294,7 +294,7 @@ fun m::f($t0: u8, $t1: &vector): u64 { # live vars: $t7 # refs: [] # - 5: $t6 := borrow_global($t7) + 5: $t6 := borrow_global<0x42::m::R>($t7) # abort state: {returns,aborts} # live vars: $t6 # refs: [$t6 => #6] @@ -303,7 +303,7 @@ fun m::f($t0: u8, $t1: &vector): u64 { # #root # -> #6 via [struct `m::R`] at line 12 # - 6: $t3 := borrow_field.data($t6) + 6: $t3 := borrow_field<0x42::m::R>.data($t6) # abort state: {returns,aborts} # live vars: $t3 # refs: [$t3 => #3] @@ -382,7 +382,7 @@ fun m::f($t0: u8, $t1: &vector): u64 { var $t3: &vector var $t4: bool var $t5: u8 - var $t6: &m::R + var $t6: &0x42::m::R var $t7: address var $t8: &u64 var $t9: u64 @@ -392,8 +392,8 @@ fun m::f($t0: u8, $t1: &vector): u64 { 3: label L0 4: drop($t1) 5: $t7 := 0x1 - 6: $t6 := borrow_global($t7) - 7: $t3 := borrow_field.data($t6) + 6: $t6 := borrow_global<0x42::m::R>($t7) + 7: $t3 := borrow_field<0x42::m::R>.data($t6) 8: goto 11 9: label L1 10: $t3 := move($t1) diff --git a/third_party/move/move-compiler-v2/tests/ability-transform/copy_ability_tuple.exp b/third_party/move/move-compiler-v2/tests/ability-transform/copy_ability_tuple.exp index f1da3a8a76fdd..3af453f1202a4 100644 --- a/third_party/move/move-compiler-v2/tests/ability-transform/copy_ability_tuple.exp +++ b/third_party/move/move-compiler-v2/tests/ability-transform/copy_ability_tuple.exp @@ -1,8 +1,8 @@ ============ initial bytecode ================ [variant baseline] -public fun M::f($t0: M::R): (M::R, u64) { - var $t1: M::R +public fun M::f($t0: 0x42::M::R): (0x42::M::R, u64) { + var $t1: 0x42::M::R var $t2: u64 0: $t1 := infer($t0) 1: $t2 := 0 @@ -12,22 +12,22 @@ public fun M::f($t0: M::R): (M::R, u64) { [variant baseline] public fun M::g($t0: &signer) { - var $t1: M::R + var $t1: 0x42::M::R var $t2: u64 var $t3: u64 0: $t2 := 1 - 1: $t1 := pack M::R($t2) + 1: $t1 := pack 0x42::M::R($t2) 2: $t3 := 3 3: ($t1, $t3) := M::f($t1) - 4: move_to($t0, $t1) + 4: move_to<0x42::M::R>($t0, $t1) 5: return () } ============ after LiveVarAnalysisProcessor: ================ [variant baseline] -public fun M::f($t0: M::R): (M::R, u64) { - var $t1: M::R +public fun M::f($t0: 0x42::M::R): (0x42::M::R, u64) { + var $t1: 0x42::M::R var $t2: u64 # live vars: $t0 0: $t1 := infer($t0) @@ -40,19 +40,19 @@ public fun M::f($t0: M::R): (M::R, u64) { [variant baseline] public fun M::g($t0: &signer) { - var $t1: M::R + var $t1: 0x42::M::R var $t2: u64 var $t3: u64 # live vars: $t0 0: $t2 := 1 # live vars: $t0, $t2 - 1: $t1 := pack M::R($t2) + 1: $t1 := pack 0x42::M::R($t2) # live vars: $t0, $t1 2: $t3 := 3 # live vars: $t0, $t1 3: ($t1, $t3) := M::f($t1) # live vars: $t0, $t1 - 4: move_to($t0, $t1) + 4: move_to<0x42::M::R>($t0, $t1) # live vars: 5: return () } @@ -60,8 +60,8 @@ public fun M::g($t0: &signer) { ============ after LiveVarAnalysisProcessor: ================ [variant baseline] -public fun M::f($t0: M::R): (M::R, u64) { - var $t1: M::R +public fun M::f($t0: 0x42::M::R): (0x42::M::R, u64) { + var $t1: 0x42::M::R var $t2: u64 # live vars: $t0 0: $t1 := infer($t0) @@ -74,19 +74,19 @@ public fun M::f($t0: M::R): (M::R, u64) { [variant baseline] public fun M::g($t0: &signer) { - var $t1: M::R + var $t1: 0x42::M::R var $t2: u64 var $t3: u64 # live vars: $t0 0: $t2 := 1 # live vars: $t0, $t2 - 1: $t1 := pack M::R($t2) + 1: $t1 := pack 0x42::M::R($t2) # live vars: $t0, $t1 2: $t3 := 3 # live vars: $t0, $t1 3: ($t1, $t3) := M::f($t1) # live vars: $t0, $t1 - 4: move_to($t0, $t1) + 4: move_to<0x42::M::R>($t0, $t1) # live vars: 5: return () } @@ -94,8 +94,8 @@ public fun M::g($t0: &signer) { ============ after ReferenceSafetyProcessor: ================ [variant baseline] -public fun M::f($t0: M::R): (M::R, u64) { - var $t1: M::R +public fun M::f($t0: 0x42::M::R): (0x42::M::R, u64) { + var $t1: 0x42::M::R var $t2: u64 # live vars: $t0 # refs: [] @@ -114,7 +114,7 @@ public fun M::f($t0: M::R): (M::R, u64) { [variant baseline] public fun M::g($t0: &signer) { - var $t1: M::R + var $t1: 0x42::M::R var $t2: u64 var $t3: u64 # live vars: $t0 @@ -132,7 +132,7 @@ public fun M::g($t0: &signer) { # #root # # - 1: $t1 := pack M::R($t2) + 1: $t1 := pack 0x42::M::R($t2) # live vars: $t0, $t1 # refs: [$t0 => #0] # #0 @@ -156,7 +156,7 @@ public fun M::g($t0: &signer) { # #root # # - 4: move_to($t0, $t1) + 4: move_to<0x42::M::R>($t0, $t1) # live vars: # refs: [] # @@ -166,8 +166,8 @@ public fun M::g($t0: &signer) { ============ after AbortAnalysisProcessor: ================ [variant baseline] -public fun M::f($t0: M::R): (M::R, u64) { - var $t1: M::R +public fun M::f($t0: 0x42::M::R): (0x42::M::R, u64) { + var $t1: 0x42::M::R var $t2: u64 # abort state: {returns} # live vars: $t0 @@ -189,7 +189,7 @@ public fun M::f($t0: M::R): (M::R, u64) { [variant baseline] public fun M::g($t0: &signer) { - var $t1: M::R + var $t1: 0x42::M::R var $t2: u64 var $t3: u64 # abort state: {returns,aborts} @@ -209,7 +209,7 @@ public fun M::g($t0: &signer) { # #root # # - 1: $t1 := pack M::R($t2) + 1: $t1 := pack 0x42::M::R($t2) # abort state: {returns,aborts} # live vars: $t0, $t1 # refs: [$t0 => #0] @@ -236,7 +236,7 @@ public fun M::g($t0: &signer) { # #root # # - 4: move_to($t0, $t1) + 4: move_to<0x42::M::R>($t0, $t1) # abort state: {returns} # live vars: # refs: [] @@ -247,8 +247,8 @@ public fun M::g($t0: &signer) { ============ after AbilityProcessor: ================ [variant baseline] -public fun M::f($t0: M::R): (M::R, u64) { - var $t1: M::R +public fun M::f($t0: 0x42::M::R): (0x42::M::R, u64) { + var $t1: 0x42::M::R var $t2: u64 0: $t1 := move($t0) 1: $t2 := 0 @@ -258,13 +258,13 @@ public fun M::f($t0: M::R): (M::R, u64) { [variant baseline] public fun M::g($t0: &signer) { - var $t1: M::R + var $t1: 0x42::M::R var $t2: u64 var $t3: u64 0: $t2 := 1 - 1: $t1 := pack M::R($t2) + 1: $t1 := pack 0x42::M::R($t2) 2: $t3 := 3 3: ($t1, $t3) := M::f($t1) - 4: move_to($t0, $t1) + 4: move_to<0x42::M::R>($t0, $t1) 5: return () } diff --git a/third_party/move/move-compiler-v2/tests/ability-transform/mutate_vector.exp b/third_party/move/move-compiler-v2/tests/ability-transform/mutate_vector.exp index 358ffa25771a9..7259af56e7847 100644 --- a/third_party/move/move-compiler-v2/tests/ability-transform/mutate_vector.exp +++ b/third_party/move/move-compiler-v2/tests/ability-transform/mutate_vector.exp @@ -1,16 +1,16 @@ ============ initial bytecode ================ [variant baseline] -public fun m::new_scalar_from_u8($t0: u8): m::Scalar { - var $t1: m::Scalar - var $t2: m::Scalar +public fun m::new_scalar_from_u8($t0: u8): 0x42::m::Scalar { + var $t1: 0x42::m::Scalar + var $t2: 0x42::m::Scalar var $t3: &mut u8 var $t4: &mut vector - var $t5: &mut m::Scalar + var $t5: &mut 0x42::m::Scalar var $t6: u64 0: $t2 := m::scalar_zero() 1: $t5 := borrow_local($t2) - 2: $t4 := borrow_field.data($t5) + 2: $t4 := borrow_field<0x42::m::Scalar>.data($t5) 3: $t6 := 0 4: $t3 := vector::borrow_mut($t4, $t6) 5: write_ref($t3, $t0) @@ -20,30 +20,30 @@ public fun m::new_scalar_from_u8($t0: u8): m::Scalar { [variant baseline] -public fun m::scalar_zero(): m::Scalar { - var $t0: m::Scalar +public fun m::scalar_zero(): 0x42::m::Scalar { + var $t0: 0x42::m::Scalar var $t1: vector 0: $t1 := [0] - 1: $t0 := pack m::Scalar($t1) + 1: $t0 := pack 0x42::m::Scalar($t1) 2: return $t0 } ============ after LiveVarAnalysisProcessor: ================ [variant baseline] -public fun m::new_scalar_from_u8($t0: u8): m::Scalar { - var $t1: m::Scalar - var $t2: m::Scalar +public fun m::new_scalar_from_u8($t0: u8): 0x42::m::Scalar { + var $t1: 0x42::m::Scalar + var $t2: 0x42::m::Scalar var $t3: &mut u8 var $t4: &mut vector - var $t5: &mut m::Scalar + var $t5: &mut 0x42::m::Scalar var $t6: u64 # live vars: $t0 0: $t2 := m::scalar_zero() # live vars: $t0, $t2 1: $t5 := borrow_local($t2) # live vars: $t0, $t2, $t5 - 2: $t4 := borrow_field.data($t5) + 2: $t4 := borrow_field<0x42::m::Scalar>.data($t5) # live vars: $t0, $t2, $t4 3: $t6 := 0 # live vars: $t0, $t2, $t4, $t6 @@ -58,13 +58,13 @@ public fun m::new_scalar_from_u8($t0: u8): m::Scalar { [variant baseline] -public fun m::scalar_zero(): m::Scalar { - var $t0: m::Scalar +public fun m::scalar_zero(): 0x42::m::Scalar { + var $t0: 0x42::m::Scalar var $t1: vector # live vars: 0: $t1 := [0] # live vars: $t1 - 1: $t0 := pack m::Scalar($t1) + 1: $t0 := pack 0x42::m::Scalar($t1) # live vars: $t0 2: return $t0 } @@ -72,19 +72,19 @@ public fun m::scalar_zero(): m::Scalar { ============ after LiveVarAnalysisProcessor: ================ [variant baseline] -public fun m::new_scalar_from_u8($t0: u8): m::Scalar { - var $t1: m::Scalar - var $t2: m::Scalar +public fun m::new_scalar_from_u8($t0: u8): 0x42::m::Scalar { + var $t1: 0x42::m::Scalar + var $t2: 0x42::m::Scalar var $t3: &mut u8 var $t4: &mut vector - var $t5: &mut m::Scalar + var $t5: &mut 0x42::m::Scalar var $t6: u64 # live vars: $t0 0: $t2 := m::scalar_zero() # live vars: $t0, $t2 1: $t5 := borrow_local($t2) # live vars: $t0, $t2, $t5 - 2: $t4 := borrow_field.data($t5) + 2: $t4 := borrow_field<0x42::m::Scalar>.data($t5) # live vars: $t0, $t2, $t4 3: $t6 := 0 # live vars: $t0, $t2, $t4, $t6 @@ -99,13 +99,13 @@ public fun m::new_scalar_from_u8($t0: u8): m::Scalar { [variant baseline] -public fun m::scalar_zero(): m::Scalar { - var $t0: m::Scalar +public fun m::scalar_zero(): 0x42::m::Scalar { + var $t0: 0x42::m::Scalar var $t1: vector # live vars: 0: $t1 := [0] # live vars: $t1 - 1: $t0 := pack m::Scalar($t1) + 1: $t0 := pack 0x42::m::Scalar($t1) # live vars: $t0 2: return $t0 } @@ -113,12 +113,12 @@ public fun m::scalar_zero(): m::Scalar { ============ after ReferenceSafetyProcessor: ================ [variant baseline] -public fun m::new_scalar_from_u8($t0: u8): m::Scalar { - var $t1: m::Scalar - var $t2: m::Scalar +public fun m::new_scalar_from_u8($t0: u8): 0x42::m::Scalar { + var $t1: 0x42::m::Scalar + var $t2: 0x42::m::Scalar var $t3: &mut u8 var $t4: &mut vector - var $t5: &mut m::Scalar + var $t5: &mut 0x42::m::Scalar var $t6: u64 # live vars: $t0 # refs: [] @@ -135,7 +135,7 @@ public fun m::new_scalar_from_u8($t0: u8): m::Scalar { # #root # => (mut) #5 via [local `s`] at line 11 # - 2: $t4 := borrow_field.data($t5) + 2: $t4 := borrow_field<0x42::m::Scalar>.data($t5) # live vars: $t0, $t2, $t4 # refs: [$t4 => #4] # #4 @@ -172,8 +172,8 @@ public fun m::new_scalar_from_u8($t0: u8): m::Scalar { [variant baseline] -public fun m::scalar_zero(): m::Scalar { - var $t0: m::Scalar +public fun m::scalar_zero(): 0x42::m::Scalar { + var $t0: 0x42::m::Scalar var $t1: vector # live vars: # refs: [] @@ -182,7 +182,7 @@ public fun m::scalar_zero(): m::Scalar { # live vars: $t1 # refs: [] # - 1: $t0 := pack m::Scalar($t1) + 1: $t0 := pack 0x42::m::Scalar($t1) # live vars: $t0 # refs: [] # @@ -192,12 +192,12 @@ public fun m::scalar_zero(): m::Scalar { ============ after AbortAnalysisProcessor: ================ [variant baseline] -public fun m::new_scalar_from_u8($t0: u8): m::Scalar { - var $t1: m::Scalar - var $t2: m::Scalar +public fun m::new_scalar_from_u8($t0: u8): 0x42::m::Scalar { + var $t1: 0x42::m::Scalar + var $t2: 0x42::m::Scalar var $t3: &mut u8 var $t4: &mut vector - var $t5: &mut m::Scalar + var $t5: &mut 0x42::m::Scalar var $t6: u64 # abort state: {returns,aborts} # live vars: $t0 @@ -217,7 +217,7 @@ public fun m::new_scalar_from_u8($t0: u8): m::Scalar { # #root # => (mut) #5 via [local `s`] at line 11 # - 2: $t4 := borrow_field.data($t5) + 2: $t4 := borrow_field<0x42::m::Scalar>.data($t5) # abort state: {returns,aborts} # live vars: $t0, $t2, $t4 # refs: [$t4 => #4] @@ -259,8 +259,8 @@ public fun m::new_scalar_from_u8($t0: u8): m::Scalar { [variant baseline] -public fun m::scalar_zero(): m::Scalar { - var $t0: m::Scalar +public fun m::scalar_zero(): 0x42::m::Scalar { + var $t0: 0x42::m::Scalar var $t1: vector # abort state: {returns} # live vars: @@ -271,7 +271,7 @@ public fun m::scalar_zero(): m::Scalar { # live vars: $t1 # refs: [] # - 1: $t0 := pack m::Scalar($t1) + 1: $t0 := pack 0x42::m::Scalar($t1) # abort state: {returns} # live vars: $t0 # refs: [] @@ -282,16 +282,16 @@ public fun m::scalar_zero(): m::Scalar { ============ after AbilityProcessor: ================ [variant baseline] -public fun m::new_scalar_from_u8($t0: u8): m::Scalar { - var $t1: m::Scalar - var $t2: m::Scalar +public fun m::new_scalar_from_u8($t0: u8): 0x42::m::Scalar { + var $t1: 0x42::m::Scalar + var $t2: 0x42::m::Scalar var $t3: &mut u8 var $t4: &mut vector - var $t5: &mut m::Scalar + var $t5: &mut 0x42::m::Scalar var $t6: u64 0: $t2 := m::scalar_zero() 1: $t5 := borrow_local($t2) - 2: $t4 := borrow_field.data($t5) + 2: $t4 := borrow_field<0x42::m::Scalar>.data($t5) 3: $t6 := 0 4: $t3 := vector::borrow_mut($t4, $t6) 5: write_ref($t3, $t0) @@ -301,10 +301,10 @@ public fun m::new_scalar_from_u8($t0: u8): m::Scalar { [variant baseline] -public fun m::scalar_zero(): m::Scalar { - var $t0: m::Scalar +public fun m::scalar_zero(): 0x42::m::Scalar { + var $t0: 0x42::m::Scalar var $t1: vector 0: $t1 := [0] - 1: $t0 := pack m::Scalar($t1) + 1: $t0 := pack 0x42::m::Scalar($t1) 2: return $t0 } diff --git a/third_party/move/move-compiler-v2/tests/abort-analysis/drop_on_abort.exp b/third_party/move/move-compiler-v2/tests/abort-analysis/drop_on_abort.exp index 702e8dcfb42c3..95b75cc0831fd 100644 --- a/third_party/move/move-compiler-v2/tests/abort-analysis/drop_on_abort.exp +++ b/third_party/move/move-compiler-v2/tests/abort-analysis/drop_on_abort.exp @@ -1,8 +1,8 @@ ============ initial bytecode ================ [variant baseline] -public fun m::from_vec<#0>($t0: vector<#0>): m::Option<#0> { - var $t1: m::Option<#0> +public fun m::from_vec<#0>($t0: vector<#0>): 0x42::m::Option<#0> { + var $t1: 0x42::m::Option<#0> var $t2: bool var $t3: u64 var $t4: &vector<#0> @@ -19,15 +19,15 @@ public fun m::from_vec<#0>($t0: vector<#0>): m::Option<#0> { 8: goto 10 9: label L1 10: label L2 - 11: $t1 := pack m::Option<#0>($t0) + 11: $t1 := pack 0x42::m::Option<#0>($t0) 12: return $t1 } ============ after AbortAnalysisProcessor: ================ [variant baseline] -public fun m::from_vec<#0>($t0: vector<#0>): m::Option<#0> { - var $t1: m::Option<#0> +public fun m::from_vec<#0>($t0: vector<#0>): 0x42::m::Option<#0> { + var $t1: 0x42::m::Option<#0> var $t2: bool var $t3: u64 var $t4: &vector<#0> @@ -94,7 +94,7 @@ public fun m::from_vec<#0>($t0: vector<#0>): m::Option<#0> { # live vars: $t0 # refs: [] # - 11: $t1 := pack m::Option<#0>($t0) + 11: $t1 := pack 0x42::m::Option<#0>($t0) # abort state: {returns} # live vars: $t1 # refs: [] diff --git a/third_party/move/move-compiler-v2/tests/abort-analysis/loop_abort.exp b/third_party/move/move-compiler-v2/tests/abort-analysis/loop_abort.exp index 931538cfa9bf7..2e42d922264cd 100644 --- a/third_party/move/move-compiler-v2/tests/abort-analysis/loop_abort.exp +++ b/third_party/move/move-compiler-v2/tests/abort-analysis/loop_abort.exp @@ -2,10 +2,10 @@ [variant baseline] fun Test::test0() { - var $t0: Test::Impotent + var $t0: 0x42::Test::Impotent var $t1: bool 0: $t1 := false - 1: $t0 := pack Test::Impotent($t1) + 1: $t0 := pack 0x42::Test::Impotent($t1) 2: label L0 3: goto 2 4: label L1 @@ -15,11 +15,11 @@ fun Test::test0() { [variant baseline] fun Test::test1() { - var $t0: Test::Impotent + var $t0: 0x42::Test::Impotent var $t1: bool var $t2: bool 0: $t1 := false - 1: $t0 := pack Test::Impotent($t1) + 1: $t0 := pack 0x42::Test::Impotent($t1) 2: label L0 3: $t2 := true 4: if ($t2) goto 5 else goto 7 @@ -36,11 +36,11 @@ fun Test::test1() { [variant baseline] fun Test::test2($t0: bool) { - var $t1: Test::Impotent + var $t1: 0x42::Test::Impotent var $t2: bool var $t3: u64 0: $t2 := false - 1: $t1 := pack Test::Impotent($t2) + 1: $t1 := pack 0x42::Test::Impotent($t2) 2: if ($t0) goto 3 else goto 8 3: label L0 4: label L3 @@ -58,7 +58,7 @@ fun Test::test2($t0: bool) { [variant baseline] fun Test::test0() { - var $t0: Test::Impotent + var $t0: 0x42::Test::Impotent var $t1: bool # abort state: {} # live vars: @@ -69,7 +69,7 @@ fun Test::test0() { # live vars: $t1 # refs: [] # - 1: $t0 := pack Test::Impotent($t1) + 1: $t0 := pack 0x42::Test::Impotent($t1) # abort state: {} # live vars: # refs: [] @@ -91,7 +91,7 @@ fun Test::test0() { [variant baseline] fun Test::test1() { - var $t0: Test::Impotent + var $t0: 0x42::Test::Impotent var $t1: bool var $t2: bool # abort state: {returns} @@ -103,7 +103,7 @@ fun Test::test1() { # live vars: $t1 # refs: [] # - 1: $t0 := pack Test::Impotent($t1) + 1: $t0 := pack 0x42::Test::Impotent($t1) # abort state: {returns} # live vars: # refs: [] @@ -164,7 +164,7 @@ fun Test::test1() { [variant baseline] fun Test::test2($t0: bool) { - var $t1: Test::Impotent + var $t1: 0x42::Test::Impotent var $t2: bool var $t3: u64 # abort state: {aborts} @@ -176,7 +176,7 @@ fun Test::test2($t0: bool) { # live vars: $t0, $t2 # refs: [] # - 1: $t1 := pack Test::Impotent($t2) + 1: $t1 := pack 0x42::Test::Impotent($t2) # abort state: {aborts} # live vars: $t0 # refs: [] diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/assign.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/assign.exp index 61a31095ee499..deeab73004ab4 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/assign.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/assign.exp @@ -5,32 +5,56 @@ module 0x42::assign { } struct S { f: u64, - g: assign::T, + g: 0x42::assign::T, } - private fun assign_field(s: &mut assign::S,f: u64) { - select assign::S.f<&mut assign::S>(s) = f; + private fun assign_field(s: &mut S,f: u64) { + select assign::S.f<&mut S>(s) = f; Tuple() } private fun assign_int(x: &mut u64) { x = 42; Tuple() } - private fun assign_pattern(s: assign::S,f: u64,h: u64): u64 { + private fun assign_pattern(s: S,f: u64,h: u64): u64 { assign::S{ f, g: assign::T{ h } } = s; Add(f, h) } - private fun assign_struct(s: &mut assign::S) { + private fun assign_struct(s: &mut S) { s = pack assign::S(42, pack assign::T(42)); Tuple() } } // end 0x42::assign +// -- Sourcified model before bytecode pipeline +module 0x42::assign { + struct T has drop { + h: u64, + } + struct S has drop { + f: u64, + g: T, + } + fun assign_field(s: &mut S, f: u64) { + s.f = f; + } + fun assign_int(x: &mut u64) { + *x = 42; + } + fun assign_pattern(s: S, f: u64, h: u64): u64 { + S{f: f,g: T{h: h}} = s; + f + h + } + fun assign_struct(s: &mut S) { + *s = S{f: 42,g: T{h: 42}}; + } +} + ============ initial bytecode ================ [variant baseline] -fun assign::assign_field($t0: &mut assign::S, $t1: u64) { +fun assign::assign_field($t0: &mut 0x42::assign::S, $t1: u64) { var $t2: &mut u64 - 0: $t2 := borrow_field.f($t0) + 0: $t2 := borrow_field<0x42::assign::S>.f($t0) 1: write_ref($t2, $t1) 2: return () } @@ -46,26 +70,26 @@ fun assign::assign_int($t0: &mut u64) { [variant baseline] -fun assign::assign_pattern($t0: assign::S, $t1: u64, $t2: u64): u64 { +fun assign::assign_pattern($t0: 0x42::assign::S, $t1: u64, $t2: u64): u64 { var $t3: u64 - var $t4: assign::T - 0: ($t1, $t4) := unpack assign::S($t0) - 1: $t2 := unpack assign::T($t4) + var $t4: 0x42::assign::T + 0: ($t1, $t4) := unpack 0x42::assign::S($t0) + 1: $t2 := unpack 0x42::assign::T($t4) 2: $t3 := +($t1, $t2) 3: return $t3 } [variant baseline] -fun assign::assign_struct($t0: &mut assign::S) { - var $t1: assign::S +fun assign::assign_struct($t0: &mut 0x42::assign::S) { + var $t1: 0x42::assign::S var $t2: u64 - var $t3: assign::T + var $t3: 0x42::assign::T var $t4: u64 0: $t2 := 42 1: $t4 := 42 - 2: $t3 := pack assign::T($t4) - 3: $t1 := pack assign::S($t2, $t3) + 2: $t3 := pack 0x42::assign::T($t4) + 3: $t1 := pack 0x42::assign::S($t2, $t3) 4: write_ref($t0, $t1) 5: return () } diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/assign_inline.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/assign_inline.exp index 29e5c85a6a3a8..4a09468c4d890 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/assign_inline.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/assign_inline.exp @@ -8,6 +8,16 @@ module 0x42::assign { } } // end 0x42::assign +// -- Sourcified model before bytecode pipeline +module 0x42::assign { + public inline fun expose(x: u64): (u64, u64) { + (1, x) + } + public fun main(): (u64, u64) { + (1, 3) + } +} + ============ initial bytecode ================ [variant baseline] diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/borrow.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/borrow.exp index 1c64fb91482d1..2ede6b56aa928 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/borrow.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/borrow.exp @@ -17,9 +17,9 @@ module 0x42::borrow { struct S { f: u64, } - private fun field(s: &borrow::S): u64 { + private fun field(s: &S): u64 { { - let r: &u64 = Borrow(Immutable)(select borrow::S.f<&borrow::S>(s)); + let r: &u64 = Borrow(Immutable)(select borrow::S.f<&S>(s)); Deref(r) } } @@ -35,9 +35,9 @@ module 0x42::borrow { Deref(r) } } - private fun mut_field(s: &mut borrow::S): u64 { + private fun mut_field(s: &mut S): u64 { { - let r: &mut u64 = Borrow(Mutable)(select borrow::S.f<&mut borrow::S>(s)); + let r: &mut u64 = Borrow(Mutable)(select borrow::S.f<&mut S>(s)); r = 22; Deref(r) } @@ -61,13 +61,48 @@ module 0x42::borrow { } } // end 0x42::borrow +// -- Sourcified model before bytecode pipeline +module 0x42::borrow { + struct S { + f: u64, + } + fun field(s: &S): u64 { + let r = &s.f; + *r + } + fun local(param: u64): u64 { + let r = &33; + *r + } + fun param(param: u64): u64 { + let r = ¶m; + *r + } + fun mut_field(s: &mut S): u64 { + let r = &mut s.f; + *r = 22; + *r + } + fun mut_local(param: u64): u64 { + let local = 33; + let r = &mut local; + *r = 22; + *r + } + fun mut_param(param: u64): u64 { + let r = &mut param; + *r = 22; + *r + } +} + ============ initial bytecode ================ [variant baseline] -fun borrow::field($t0: &borrow::S): u64 { +fun borrow::field($t0: &0x42::borrow::S): u64 { var $t1: u64 var $t2: &u64 - 0: $t2 := borrow_field.f($t0) + 0: $t2 := borrow_field<0x42::borrow::S>.f($t0) 1: $t1 := read_ref($t2) 2: return $t1 } @@ -96,11 +131,11 @@ fun borrow::param($t0: u64): u64 { [variant baseline] -fun borrow::mut_field($t0: &mut borrow::S): u64 { +fun borrow::mut_field($t0: &mut 0x42::borrow::S): u64 { var $t1: u64 var $t2: &mut u64 var $t3: u64 - 0: $t2 := borrow_field.f($t0) + 0: $t2 := borrow_field<0x42::borrow::S>.f($t0) 1: $t3 := 22 2: write_ref($t2, $t3) 3: $t1 := read_ref($t2) diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/borrow_deref_optimize.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/borrow_deref_optimize.exp index a80f9f4e4a890..ae6515bb0501c 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/borrow_deref_optimize.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/borrow_deref_optimize.exp @@ -4,11 +4,11 @@ module 0x42::test { value: bool, } private fun no_optimize_resource(): bool - acquires test::X(*) + acquires 0x42::test::X(*) { { - let x: &mut test::X = Borrow(Mutable)(Deref(BorrowGlobal(Immutable)(0x1))); - select test::X.value<&mut test::X>(x) + let x: &mut X = Borrow(Mutable)(Deref(BorrowGlobal(Immutable)(0x1))); + select test::X.value<&mut X>(x) } } private fun no_optimize_vector() { @@ -18,11 +18,11 @@ module 0x42::test { } } private fun optimize_resource(): bool - acquires test::X(*) + acquires 0x42::test::X(*) { { - let x: &test::X = Borrow(Immutable)(Deref(BorrowGlobal(Immutable)(0x1))); - select test::X.value<&test::X>(x) + let x: &X = Borrow(Immutable)(Deref(BorrowGlobal(Immutable)(0x1))); + select test::X.value<&X>(x) } } private fun optimize_vector() { @@ -36,21 +36,47 @@ module 0x42::test { } } // end 0x42::test +// -- Sourcified model before bytecode pipeline +module 0x42::test { + struct X has copy, drop, key { + value: bool, + } + fun no_optimize_resource(): bool + acquires X + { + let x = &mut *borrow_global(0x1); + x.value + } + fun no_optimize_vector() { + let _ = 0x1::vector::borrow_mut(&mut *0x1::vector::borrow>(&vector[vector[1, 2]], 0), 1); + } + fun optimize_resource(): bool + acquires X + { + let x = &*borrow_global(0x1); + x.value + } + fun optimize_vector() { + let x = vector[vector[1, 2]]; + let _ = 0x1::vector::borrow_mut(&mut *0x1::vector::borrow_mut>(&mut x, 0), 1); + } +} + ============ initial bytecode ================ [variant baseline] fun test::no_optimize_resource(): bool { var $t0: bool - var $t1: &mut test::X - var $t2: test::X - var $t3: &test::X + var $t1: &mut 0x42::test::X + var $t2: 0x42::test::X + var $t3: &0x42::test::X var $t4: address var $t5: &bool 0: $t4 := 0x1 - 1: $t3 := borrow_global($t4) + 1: $t3 := borrow_global<0x42::test::X>($t4) 2: $t2 := read_ref($t3) 3: $t1 := borrow_local($t2) - 4: $t5 := borrow_field.value($t1) + 4: $t5 := borrow_field<0x42::test::X>.value($t1) 5: $t0 := read_ref($t5) 6: return $t0 } @@ -83,12 +109,12 @@ fun test::no_optimize_vector() { [variant baseline] fun test::optimize_resource(): bool { var $t0: bool - var $t1: &test::X + var $t1: &0x42::test::X var $t2: address var $t3: &bool 0: $t2 := 0x1 - 1: $t1 := borrow_global($t2) - 2: $t3 := borrow_field.value($t1) + 1: $t1 := borrow_global<0x42::test::X>($t2) + 2: $t3 := borrow_field<0x42::test::X>.value($t1) 3: $t0 := read_ref($t3) 4: return $t0 } diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14300_update_variant_select.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14300_update_variant_select.exp index 0a25e2fb1e722..453eb08801151 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14300_update_variant_select.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14300_update_variant_select.exp @@ -16,51 +16,84 @@ module 0x815::m { } private fun update_common_field(): u64 { { - let common: m::CommonFields = pack m::CommonFields::Bar(30, 40, 50); - select_variants m::CommonFields.Foo.x|m::CommonFields.Bar.x(common) = 15; - select_variants m::CommonFields.Foo.x|m::CommonFields.Bar.x(common) + let common: CommonFields = pack m::CommonFields::Bar(30, 40, 50); + select_variants m::CommonFields.Foo.x|m::CommonFields.Bar.x(common) = 15; + select_variants m::CommonFields.Foo.x|m::CommonFields.Bar.x(common) } } private fun update_common_field_different_offset(): u8 { { - let common: m::CommonFields = pack m::CommonFields::Bar(30, 40, 50); - select_variants m::CommonFields.Foo.y|m::CommonFields.Bar.y|m::CommonFields.Baz.y(common) = 15; - select_variants m::CommonFields.Foo.y|m::CommonFields.Bar.y|m::CommonFields.Baz.y(common) + let common: CommonFields = pack m::CommonFields::Bar(30, 40, 50); + select_variants m::CommonFields.Foo.y|m::CommonFields.Bar.y|m::CommonFields.Baz.y(common) = 15; + select_variants m::CommonFields.Foo.y|m::CommonFields.Bar.y|m::CommonFields.Baz.y(common) } } private fun update_non_common_field(): u32 { { - let common: m::CommonFields = pack m::CommonFields::Bar(30, 40, 50); - select_variants m::CommonFields.Bar.z(common) = 15; - select_variants m::CommonFields.Bar.z(common) + let common: CommonFields = pack m::CommonFields::Bar(30, 40, 50); + select_variants m::CommonFields.Bar.z(common) = 15; + select_variants m::CommonFields.Bar.z(common) } } } // end 0x815::m +// -- Sourcified model before bytecode pipeline +module 0x815::m { + enum CommonFields has drop { + Foo { + x: u64, + y: u8, + } + Bar { + x: u64, + y: u8, + z: u32, + } + Baz { + y: u8, + } + } + fun update_common_field(): u64 { + let common = CommonFields::Bar{x: 30,y: 40u8,z: 50u32}; + common.Foo.x = 15; + common.Foo.x + } + fun update_common_field_different_offset(): u8 { + let common = CommonFields::Bar{x: 30,y: 40u8,z: 50u32}; + common.Foo.y = 15u8; + common.Foo.y + } + fun update_non_common_field(): u32 { + let common = CommonFields::Bar{x: 30,y: 40u8,z: 50u32}; + common.Bar.z = 15u32; + common.Bar.z + } +} + ============ initial bytecode ================ [variant baseline] fun m::update_common_field(): u64 { var $t0: u64 - var $t1: m::CommonFields + var $t1: 0x815::m::CommonFields var $t2: u64 var $t3: u8 var $t4: u32 var $t5: u64 var $t6: &mut u64 - var $t7: &mut m::CommonFields - var $t8: &m::CommonFields + var $t7: &mut 0x815::m::CommonFields + var $t8: &0x815::m::CommonFields var $t9: &u64 0: $t2 := 30 1: $t3 := 40 2: $t4 := 50 - 3: $t1 := pack_variant m::CommonFields::Bar($t2, $t3, $t4) + 3: $t1 := pack_variant 0x815::m::CommonFields::Bar($t2, $t3, $t4) 4: $t5 := 15 5: $t7 := borrow_local($t1) - 6: $t6 := borrow_variant_field.x($t7) + 6: $t6 := borrow_variant_field<0x815::m::CommonFields::Foo|Bar>.x($t7) 7: write_ref($t6, $t5) 8: $t8 := borrow_local($t1) - 9: $t9 := borrow_variant_field.x($t8) + 9: $t9 := borrow_variant_field<0x815::m::CommonFields::Foo|Bar>.x($t8) 10: $t0 := read_ref($t9) 11: return $t0 } @@ -69,50 +102,50 @@ fun m::update_common_field(): u64 { [variant baseline] fun m::update_common_field_different_offset(): u8 { var $t0: u8 - var $t1: m::CommonFields + var $t1: 0x815::m::CommonFields var $t2: u64 var $t3: u8 var $t4: u32 var $t5: u8 var $t6: &mut u8 - var $t7: &mut m::CommonFields + var $t7: &mut 0x815::m::CommonFields var $t8: bool - var $t9: &m::CommonFields + var $t9: &0x815::m::CommonFields var $t10: &u8 var $t11: bool 0: $t2 := 30 1: $t3 := 40 2: $t4 := 50 - 3: $t1 := pack_variant m::CommonFields::Bar($t2, $t3, $t4) + 3: $t1 := pack_variant 0x815::m::CommonFields::Bar($t2, $t3, $t4) 4: $t5 := 15 5: $t7 := borrow_local($t1) - 6: $t8 := test_variant m::CommonFields::Foo($t7) + 6: $t8 := test_variant 0x815::m::CommonFields::Foo($t7) 7: if ($t8) goto 13 else goto 8 8: label L3 - 9: $t8 := test_variant m::CommonFields::Bar($t7) + 9: $t8 := test_variant 0x815::m::CommonFields::Bar($t7) 10: if ($t8) goto 13 else goto 11 11: label L4 12: goto 16 13: label L2 - 14: $t6 := borrow_variant_field.y($t7) + 14: $t6 := borrow_variant_field<0x815::m::CommonFields::Foo|Bar>.y($t7) 15: goto 18 16: label L1 - 17: $t6 := borrow_variant_field.y($t7) + 17: $t6 := borrow_variant_field<0x815::m::CommonFields::Baz>.y($t7) 18: label L0 19: write_ref($t6, $t5) 20: $t9 := borrow_local($t1) - 21: $t11 := test_variant m::CommonFields::Foo($t9) + 21: $t11 := test_variant 0x815::m::CommonFields::Foo($t9) 22: if ($t11) goto 28 else goto 23 23: label L8 - 24: $t11 := test_variant m::CommonFields::Bar($t9) + 24: $t11 := test_variant 0x815::m::CommonFields::Bar($t9) 25: if ($t11) goto 28 else goto 26 26: label L9 27: goto 31 28: label L7 - 29: $t10 := borrow_variant_field.y($t9) + 29: $t10 := borrow_variant_field<0x815::m::CommonFields::Foo|Bar>.y($t9) 30: goto 33 31: label L6 - 32: $t10 := borrow_variant_field.y($t9) + 32: $t10 := borrow_variant_field<0x815::m::CommonFields::Baz>.y($t9) 33: label L5 34: $t0 := read_ref($t10) 35: return $t0 @@ -122,25 +155,25 @@ fun m::update_common_field_different_offset(): u8 { [variant baseline] fun m::update_non_common_field(): u32 { var $t0: u32 - var $t1: m::CommonFields + var $t1: 0x815::m::CommonFields var $t2: u64 var $t3: u8 var $t4: u32 var $t5: u32 var $t6: &mut u32 - var $t7: &mut m::CommonFields - var $t8: &m::CommonFields + var $t7: &mut 0x815::m::CommonFields + var $t8: &0x815::m::CommonFields var $t9: &u32 0: $t2 := 30 1: $t3 := 40 2: $t4 := 50 - 3: $t1 := pack_variant m::CommonFields::Bar($t2, $t3, $t4) + 3: $t1 := pack_variant 0x815::m::CommonFields::Bar($t2, $t3, $t4) 4: $t5 := 15 5: $t7 := borrow_local($t1) - 6: $t6 := borrow_variant_field.z($t7) + 6: $t6 := borrow_variant_field<0x815::m::CommonFields::Bar>.z($t7) 7: write_ref($t6, $t5) 8: $t8 := borrow_local($t1) - 9: $t9 := borrow_variant_field.z($t8) + 9: $t9 := borrow_variant_field<0x815::m::CommonFields::Bar>.z($t8) 10: $t0 := read_ref($t9) 11: return $t0 } diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14300_variant_select_autoref.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14300_variant_select_autoref.exp index 285f4a28191fe..0d74991c8f9b0 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14300_variant_select_autoref.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14300_variant_select_autoref.exp @@ -10,28 +10,45 @@ module 0x815::m { } private fun test_common_access(): u8 { { - let x: m::Positional = pack m::Positional::A(42); - select_variants m::Positional.A.0|m::Positional.B.0(x) = 19; + let x: Positional = pack m::Positional::A(42); + select_variants m::Positional.A.0|m::Positional.B.0(x) = 19; 20 } } } // end 0x815::m +// -- Sourcified model before bytecode pipeline +module 0x815::m { + enum Positional has drop { + A { + 0: u8, + } + B { + 0: u8, + } + } + fun test_common_access(): u8 { + let x = Positional::A(42u8); + x.A.0 = 19u8; + 20u8 + } +} + ============ initial bytecode ================ [variant baseline] fun m::test_common_access(): u8 { var $t0: u8 - var $t1: m::Positional + var $t1: 0x815::m::Positional var $t2: u8 var $t3: u8 var $t4: &mut u8 - var $t5: &mut m::Positional + var $t5: &mut 0x815::m::Positional 0: $t2 := 42 - 1: $t1 := pack_variant m::Positional::A($t2) + 1: $t1 := pack_variant 0x815::m::Positional::A($t2) 2: $t3 := 19 3: $t5 := borrow_local($t1) - 4: $t4 := borrow_variant_field.0($t5) + 4: $t4 := borrow_variant_field<0x815::m::Positional::A|B>.0($t5) 5: write_ref($t4, $t3) 6: $t0 := 20 7: return $t0 diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14471_receiver_inference.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14471_receiver_inference.exp index c8a13847d8cae..e89103eda02a7 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14471_receiver_inference.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14471_receiver_inference.exp @@ -1,7 +1,7 @@ // -- Model dump before bytecode pipeline module 0x815::m { struct MyMap { - table: m::Table, + table: 0x815::m::Table, } struct Table { x: #0, @@ -10,21 +10,21 @@ module 0x815::m { struct ValueWrap { val: u64, } - private fun contains(self: &m::Table<#0, #1>,_key: #0): bool { + private fun contains(self: &Table,_key: T1): bool { true } - private fun add(self: &mut m::Table<#0, #1>,_key: #0,_val: #1) { + private fun add(self: &mut Table,_key: T1,_val: T2) { Tuple() } public fun add_when_missing(key: address,val: u64) - acquires m::MyMap(*) + acquires 0x815::m::MyMap(*) { { - let my_map: &mut m::MyMap = BorrowGlobal(Mutable)(0x815); - if Not(m::contains(Borrow(Immutable)(select m::MyMap.table<&mut m::MyMap>(my_map)), key)) { + let my_map: &mut MyMap = BorrowGlobal(Mutable)(0x815); + if Not(m::contains(Borrow(Immutable)(select m::MyMap.table<&mut MyMap>(my_map)), key)) { { - let wrap: m::ValueWrap = pack m::ValueWrap(val); - m::add(Borrow(Mutable)(select m::MyMap.table<&mut m::MyMap>(my_map)), key, wrap); + let wrap: ValueWrap = pack m::ValueWrap(val); + m::add(Borrow(Mutable)(select m::MyMap.table<&mut MyMap>(my_map)), key, wrap); Tuple() } } else { @@ -34,10 +34,38 @@ module 0x815::m { } } // end 0x815::m +// -- Sourcified model before bytecode pipeline +module 0x815::m { + struct MyMap has key { + table: Table, + } + struct Table has store { + x: T1, + y: T2, + } + struct ValueWrap has drop, store { + val: u64, + } + fun contains(self: &Table, _key: T1): bool { + true + } + fun add(self: &mut Table, _key: T1, _val: T2) { + } + public fun add_when_missing(key: address, val: u64) + acquires MyMap + { + let my_map = borrow_global_mut(0x815); + if (!contains(&my_map.table, key)) { + let wrap = ValueWrap{val: val}; + add(&mut my_map.table, key, wrap); + } + } +} + ============ initial bytecode ================ [variant baseline] -fun m::contains<#0, #1>($t0: &m::Table<#0, #1>, $t1: #0): bool { +fun m::contains<#0, #1>($t0: &0x815::m::Table<#0, #1>, $t1: #0): bool { var $t2: bool 0: $t2 := true 1: return $t2 @@ -45,30 +73,30 @@ fun m::contains<#0, #1>($t0: &m::Table<#0, #1>, $t1: #0): bool { [variant baseline] -fun m::add<#0, #1>($t0: &mut m::Table<#0, #1>, $t1: #0, $t2: #1) { +fun m::add<#0, #1>($t0: &mut 0x815::m::Table<#0, #1>, $t1: #0, $t2: #1) { 0: return () } [variant baseline] public fun m::add_when_missing($t0: address, $t1: u64) { - var $t2: &mut m::MyMap + var $t2: &mut 0x815::m::MyMap var $t3: address var $t4: bool var $t5: bool - var $t6: &m::Table - var $t7: m::ValueWrap - var $t8: &mut m::Table + var $t6: &0x815::m::Table + var $t7: 0x815::m::ValueWrap + var $t8: &mut 0x815::m::Table 0: $t3 := 0x815 - 1: $t2 := borrow_global($t3) - 2: $t6 := borrow_field.table($t2) - 3: $t5 := m::contains($t6, $t0) + 1: $t2 := borrow_global<0x815::m::MyMap>($t3) + 2: $t6 := borrow_field<0x815::m::MyMap>.table($t2) + 3: $t5 := m::contains($t6, $t0) 4: $t4 := !($t5) 5: if ($t4) goto 6 else goto 11 6: label L0 - 7: $t7 := pack m::ValueWrap($t1) - 8: $t8 := borrow_field.table($t2) - 9: m::add($t8, $t0, $t7) + 7: $t7 := pack 0x815::m::ValueWrap($t1) + 8: $t8 := borrow_field<0x815::m::MyMap>.table($t2) + 9: m::add($t8, $t0, $t7) 10: goto 12 11: label L1 12: label L2 diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/conditional_borrow.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/conditional_borrow.exp index 9c7e360aea5b9..2e4693e518bd7 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/conditional_borrow.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/conditional_borrow.exp @@ -47,39 +47,39 @@ module 0x8675::M { } } } - private fun test1b(r: M::S): u64 { + private fun test1b(r: S): u64 { { - let x: M::S = pack M::S(3); + let x: S = pack M::S(3); { - let tref: &mut M::S = Borrow(Mutable)(if Lt(select M::S.f(r), 4) { + let tref: &mut S = Borrow(Mutable)(if Lt(select M::S.f(r), 4) { r } else { x }); - select M::S.f(Deref(tref)) = 10; + select M::S.f(Deref(tref)) = 10; { - let y: M::S = r; + let y: S = r; { - let tref2: &mut M::S = Borrow(Mutable)(y); - select M::S.f(Deref(tref2)) = Add(select M::S.f(Deref(tref2)), 1); + let tref2: &mut S = Borrow(Mutable)(y); + select M::S.f(Deref(tref2)) = Add(select M::S.f(Deref(tref2)), 1); { - let z: M::S = y; + let z: S = y; { - let tref3: &mut u64 = Borrow(Mutable)(select M::S.f(z)); + let tref3: &mut u64 = Borrow(Mutable)(select M::S.f(z)); tref3 = Add(Deref(tref3), 1); { - let a: M::S = z; + let a: S = z; { - let tref4: &mut u64 = Borrow(Mutable)(select M::S.f(a)); + let tref4: &mut u64 = Borrow(Mutable)(select M::S.f(a)); tref4 = Add(Deref(tref4), 1); { - let tref5: &mut u64 = Borrow(Mutable)(select M::S.f(a)); + let tref5: &mut u64 = Borrow(Mutable)(select M::S.f(a)); tref5 = Add(Deref(tref5), 8); { let tref6: &mut u64 = Borrow(Mutable)(3; - select M::S.f(a)); + select M::S.f(a)); tref6 = Add(Deref(tref6), 16); - select M::S.f(a) + select M::S.f(a) } } } @@ -96,6 +96,62 @@ module 0x8675::M { } } // end 0x8675::M +// -- Sourcified model before bytecode pipeline +module 0x8675::M { + struct S has copy, drop { + f: u64, + } + public fun test(): u64 { + test1(7) + test1(2) + } + fun test1(r: u64): u64 { + let tref = &mut (if (r < 4) r else 3); + *tref = 10; + let y = r; + let tref2 = &mut y; + *tref2 = *tref2 + 1; + let z = y; + let tref3 = &mut (z + 0); + *tref3 = *tref3 + 2; + let a = z; + let tref4 = &mut a; + *tref4 = *tref4 + 4; + let tref5 = &mut a; + *tref5 = *tref5 + 8; + let tref6 = &mut { + 3; + a + }; + *tref6 = *tref6 + 16; + a + } + fun test1b(r: S): u64 { + let x = S{f: 3}; + let tref = &mut (if (r.f < 4) r else x); + (*tref).f = 10; + let y = r; + let tref2 = &mut y; + (*tref2).f = (*tref2).f + 1; + let z = y; + let tref3 = &mut z.f; + *tref3 = *tref3 + 1; + let a = z; + let tref4 = &mut a.f; + *tref4 = *tref4 + 1; + let tref5 = &mut a.f; + *tref5 = *tref5 + 8; + let tref6 = &mut { + 3; + a.f + }; + *tref6 = *tref6 + 16; + a.f + } + public fun testb(): u64 { + test1b(S{f: 7}) + test1b(S{f: 2}) + } +} + ============ initial bytecode ================ [variant baseline] @@ -203,49 +259,49 @@ fun M::test1($t0: u64): u64 { [variant baseline] -fun M::test1b($t0: M::S): u64 { +fun M::test1b($t0: 0x8675::M::S): u64 { var $t1: u64 - var $t2: M::S + var $t2: 0x8675::M::S var $t3: u64 - var $t4: &mut M::S - var $t5: M::S + var $t4: &mut 0x8675::M::S + var $t5: 0x8675::M::S var $t6: bool var $t7: u64 - var $t8: &M::S + var $t8: &0x8675::M::S var $t9: &u64 var $t10: u64 var $t11: u64 var $t12: &mut u64 - var $t13: M::S - var $t14: &mut M::S - var $t15: M::S - var $t16: &mut M::S + var $t13: 0x8675::M::S + var $t14: &mut 0x8675::M::S + var $t15: 0x8675::M::S + var $t16: &mut 0x8675::M::S var $t17: u64 var $t18: u64 - var $t19: M::S - var $t20: &M::S + var $t19: 0x8675::M::S + var $t20: &0x8675::M::S var $t21: &u64 var $t22: u64 var $t23: &mut u64 - var $t24: M::S - var $t25: &mut M::S - var $t26: M::S + var $t24: 0x8675::M::S + var $t25: &mut 0x8675::M::S + var $t26: 0x8675::M::S var $t27: &mut u64 - var $t28: &mut M::S + var $t28: &mut 0x8675::M::S var $t29: u64 var $t30: u64 var $t31: u64 - var $t32: M::S + var $t32: 0x8675::M::S var $t33: &mut u64 var $t34: u64 - var $t35: &M::S + var $t35: &0x8675::M::S var $t36: &u64 var $t37: u64 var $t38: u64 var $t39: u64 var $t40: &mut u64 var $t41: u64 - var $t42: &M::S + var $t42: &0x8675::M::S var $t43: &u64 var $t44: u64 var $t45: u64 @@ -253,17 +309,17 @@ fun M::test1b($t0: M::S): u64 { var $t47: &mut u64 var $t48: u64 var $t49: u64 - var $t50: &M::S + var $t50: &0x8675::M::S var $t51: &u64 var $t52: u64 var $t53: u64 var $t54: u64 - var $t55: &M::S + var $t55: &0x8675::M::S var $t56: &u64 0: $t3 := 3 - 1: $t2 := pack M::S($t3) + 1: $t2 := pack 0x8675::M::S($t3) 2: $t8 := borrow_local($t0) - 3: $t9 := borrow_field.f($t8) + 3: $t9 := borrow_field<0x8675::M::S>.f($t8) 4: $t7 := read_ref($t9) 5: $t10 := 4 6: $t6 := <($t7, $t10) @@ -278,30 +334,30 @@ fun M::test1b($t0: M::S): u64 { 15: $t11 := 10 16: $t13 := read_ref($t4) 17: $t14 := borrow_local($t13) - 18: $t12 := borrow_field.f($t14) + 18: $t12 := borrow_field<0x8675::M::S>.f($t14) 19: write_ref($t12, $t11) 20: $t15 := infer($t0) 21: $t16 := borrow_local($t15) 22: $t19 := read_ref($t16) 23: $t20 := borrow_local($t19) - 24: $t21 := borrow_field.f($t20) + 24: $t21 := borrow_field<0x8675::M::S>.f($t20) 25: $t18 := read_ref($t21) 26: $t22 := 1 27: $t17 := +($t18, $t22) 28: $t24 := read_ref($t16) 29: $t25 := borrow_local($t24) - 30: $t23 := borrow_field.f($t25) + 30: $t23 := borrow_field<0x8675::M::S>.f($t25) 31: write_ref($t23, $t17) 32: $t26 := infer($t15) 33: $t28 := borrow_local($t26) - 34: $t27 := borrow_field.f($t28) + 34: $t27 := borrow_field<0x8675::M::S>.f($t28) 35: $t30 := read_ref($t27) 36: $t31 := 1 37: $t29 := +($t30, $t31) 38: write_ref($t27, $t29) 39: $t32 := infer($t26) 40: $t35 := borrow_local($t32) - 41: $t36 := borrow_field.f($t35) + 41: $t36 := borrow_field<0x8675::M::S>.f($t35) 42: $t34 := read_ref($t36) 43: $t33 := borrow_local($t34) 44: $t38 := read_ref($t33) @@ -309,7 +365,7 @@ fun M::test1b($t0: M::S): u64 { 46: $t37 := +($t38, $t39) 47: write_ref($t33, $t37) 48: $t42 := borrow_local($t32) - 49: $t43 := borrow_field.f($t42) + 49: $t43 := borrow_field<0x8675::M::S>.f($t42) 50: $t41 := read_ref($t43) 51: $t40 := borrow_local($t41) 52: $t45 := read_ref($t40) @@ -318,7 +374,7 @@ fun M::test1b($t0: M::S): u64 { 55: write_ref($t40, $t44) 56: $t49 := 3 57: $t50 := borrow_local($t32) - 58: $t51 := borrow_field.f($t50) + 58: $t51 := borrow_field<0x8675::M::S>.f($t50) 59: $t48 := read_ref($t51) 60: $t47 := borrow_local($t48) 61: $t53 := read_ref($t47) @@ -326,7 +382,7 @@ fun M::test1b($t0: M::S): u64 { 63: $t52 := +($t53, $t54) 64: write_ref($t47, $t52) 65: $t55 := borrow_local($t32) - 66: $t56 := borrow_field.f($t55) + 66: $t56 := borrow_field<0x8675::M::S>.f($t55) 67: $t1 := read_ref($t56) 68: return $t1 } @@ -336,16 +392,16 @@ fun M::test1b($t0: M::S): u64 { public fun M::testb(): u64 { var $t0: u64 var $t1: u64 - var $t2: M::S + var $t2: 0x8675::M::S var $t3: u64 var $t4: u64 - var $t5: M::S + var $t5: 0x8675::M::S var $t6: u64 0: $t3 := 7 - 1: $t2 := pack M::S($t3) + 1: $t2 := pack 0x8675::M::S($t3) 2: $t1 := M::test1b($t2) 3: $t6 := 2 - 4: $t5 := pack M::S($t6) + 4: $t5 := pack 0x8675::M::S($t6) 5: $t4 := M::test1b($t5) 6: $t0 := +($t1, $t4) 7: return $t0 diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/escape_autoref.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/escape_autoref.exp index 3dfca1c2c5e39..9b8e310000ede 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/escape_autoref.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/escape_autoref.exp @@ -6,32 +6,59 @@ module 0x42::m { struct ObjectCore { owner: address, } - private fun make(): m::Object { + private fun make(): Object { Abort(0) } - private fun owner_correct(o: m::Object): address - acquires m::ObjectCore(*) + private fun owner_correct(o: Object): address + acquires 0x42::m::ObjectCore(*) { { - let addr: address = select m::Object.inner(o); - select m::ObjectCore.owner<&m::ObjectCore>(BorrowGlobal(Immutable)(addr)) + let addr: address = select m::Object.inner(o); + select m::ObjectCore.owner<&ObjectCore>(BorrowGlobal(Immutable)(addr)) } } - private fun owner_read_ref_missing(o: m::Object): address - acquires m::ObjectCore(*) + private fun owner_read_ref_missing(o: Object): address + acquires 0x42::m::ObjectCore(*) { - select m::ObjectCore.owner<&m::ObjectCore>(BorrowGlobal(Immutable)(select m::Object.inner(o))) + select m::ObjectCore.owner<&ObjectCore>(BorrowGlobal(Immutable)(select m::Object.inner(o))) } private fun will_autoref(): address { - select m::Object.inner(m::make()) + select m::Object.inner(m::make()) } } // end 0x42::m +// -- Sourcified model before bytecode pipeline +module 0x42::m { + struct Object has copy, drop { + inner: address, + } + struct ObjectCore has key { + owner: address, + } + fun make(): Object { + abort 0 + } + fun owner_correct(o: Object): address + acquires ObjectCore + { + let addr = o.inner; + borrow_global(addr).owner + } + fun owner_read_ref_missing(o: Object): address + acquires ObjectCore + { + borrow_global(o.inner).owner + } + fun will_autoref(): address { + make().inner + } +} + ============ initial bytecode ================ [variant baseline] -fun m::make(): m::Object { - var $t0: m::Object +fun m::make(): 0x42::m::Object { + var $t0: 0x42::m::Object var $t1: u64 0: $t1 := 0 1: abort($t1) @@ -40,36 +67,36 @@ fun m::make(): m::Object { [variant baseline] -fun m::owner_correct($t0: m::Object): address { +fun m::owner_correct($t0: 0x42::m::Object): address { var $t1: address var $t2: address - var $t3: &m::Object + var $t3: &0x42::m::Object var $t4: &address - var $t5: &m::ObjectCore + var $t5: &0x42::m::ObjectCore var $t6: &address 0: $t3 := borrow_local($t0) - 1: $t4 := borrow_field.inner($t3) + 1: $t4 := borrow_field<0x42::m::Object>.inner($t3) 2: $t2 := read_ref($t4) - 3: $t5 := borrow_global($t2) - 4: $t6 := borrow_field.owner($t5) + 3: $t5 := borrow_global<0x42::m::ObjectCore>($t2) + 4: $t6 := borrow_field<0x42::m::ObjectCore>.owner($t5) 5: $t1 := read_ref($t6) 6: return $t1 } [variant baseline] -fun m::owner_read_ref_missing($t0: m::Object): address { +fun m::owner_read_ref_missing($t0: 0x42::m::Object): address { var $t1: address - var $t2: &m::ObjectCore + var $t2: &0x42::m::ObjectCore var $t3: address - var $t4: &m::Object + var $t4: &0x42::m::Object var $t5: &address var $t6: &address 0: $t4 := borrow_local($t0) - 1: $t5 := borrow_field.inner($t4) + 1: $t5 := borrow_field<0x42::m::Object>.inner($t4) 2: $t3 := read_ref($t5) - 3: $t2 := borrow_global($t3) - 4: $t6 := borrow_field.owner($t2) + 3: $t2 := borrow_global<0x42::m::ObjectCore>($t3) + 4: $t6 := borrow_field<0x42::m::ObjectCore>.owner($t2) 5: $t1 := read_ref($t6) 6: return $t1 } @@ -78,12 +105,12 @@ fun m::owner_read_ref_missing($t0: m::Object): address { [variant baseline] fun m::will_autoref(): address { var $t0: address - var $t1: m::Object - var $t2: &m::Object + var $t1: 0x42::m::Object + var $t2: &0x42::m::Object var $t3: &address 0: $t1 := m::make() 1: $t2 := borrow_local($t1) - 2: $t3 := borrow_field.inner($t2) + 2: $t3 := borrow_field<0x42::m::Object>.inner($t2) 3: $t0 := read_ref($t3) 4: return $t0 } diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/fields.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/fields.exp index 9a0e87baab823..8806b10eaaeaf 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/fields.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/fields.exp @@ -8,125 +8,175 @@ module 0x42::fields { } struct S { f: u64, - g: fields::T, + g: 0x42::fields::T, } - private fun read_generic_val(x: fields::G): u64 { - select fields::G.f>(x) + private fun read_generic_val(x: G): u64 { + select fields::G.f>(x) } - private fun read_ref(x: &fields::S): u64 { - select fields::T.h(select fields::S.g<&fields::S>(x)) + private fun read_ref(x: &S): u64 { + select fields::T.h(select fields::S.g<&S>(x)) } - private fun read_val(x: fields::S): u64 { - select fields::T.h(select fields::S.g(x)) + private fun read_val(x: S): u64 { + select fields::T.h(select fields::S.g(x)) } - private fun write_generic_val(x: &mut fields::G,v: u64) { - select fields::G.f<&mut fields::G>(x) = v + private fun write_generic_val(x: &mut G,v: u64) { + select fields::G.f<&mut G>(x) = v } - private fun write_local_direct(): fields::S { + private fun write_local_direct(): S { { - let x: fields::S = pack fields::S(0, pack fields::T(0)); - select fields::T.h(select fields::S.g(x)) = 42; + let x: S = pack fields::S(0, pack fields::T(0)); + select fields::T.h(select fields::S.g(x)) = 42; x } } - private fun write_local_via_ref(): fields::S { + private fun write_local_via_ref(): S { { - let x: fields::S = pack fields::S(0, pack fields::T(0)); + let x: S = pack fields::S(0, pack fields::T(0)); { - let r: &mut fields::S = Borrow(Mutable)(x); - select fields::T.h(select fields::S.g<&mut fields::S>(r)) = 42; + let r: &mut S = Borrow(Mutable)(x); + select fields::T.h(select fields::S.g<&mut S>(r)) = 42; x } } } - private fun write_local_via_ref_2(): fields::S { + private fun write_local_via_ref_2(): S { { - let x: fields::S = pack fields::S(0, pack fields::T(0)); + let x: S = pack fields::S(0, pack fields::T(0)); { - let r: &mut u64 = Borrow(Mutable)(select fields::T.h(select fields::S.g(x))); + let r: &mut u64 = Borrow(Mutable)(select fields::T.h(select fields::S.g(x))); r = 42; x } } } - private fun write_param(x: &mut fields::S) { - select fields::T.h(select fields::S.g<&mut fields::S>(x)) = 42; + private fun write_param(x: &mut S) { + select fields::T.h(select fields::S.g<&mut S>(x)) = 42; Tuple() } - private fun write_val(x: fields::S): fields::S { - select fields::T.h(select fields::S.g(x)) = 42; + private fun write_val(x: S): S { + select fields::T.h(select fields::S.g(x)) = 42; x } } // end 0x42::fields +// -- Sourcified model before bytecode pipeline +module 0x42::fields { + struct T has drop { + h: u64, + } + struct G has drop { + f: X, + } + struct S has drop { + f: u64, + g: T, + } + fun read_generic_val(x: G): u64 { + x.f + } + fun read_ref(x: &S): u64 { + x.g.h + } + fun read_val(x: S): u64 { + x.g.h + } + fun write_generic_val(x: &mut G, v: u64) { + x.f = v + } + fun write_local_direct(): S { + let x = S{f: 0,g: T{h: 0}}; + x.g.h = 42; + x + } + fun write_local_via_ref(): S { + let x = S{f: 0,g: T{h: 0}}; + let r = &mut x; + r.g.h = 42; + x + } + fun write_local_via_ref_2(): S { + let x = S{f: 0,g: T{h: 0}}; + let r = &mut x.g.h; + *r = 42; + x + } + fun write_param(x: &mut S) { + x.g.h = 42; + } + fun write_val(x: S): S { + x.g.h = 42; + x + } +} + ============ initial bytecode ================ [variant baseline] -fun fields::read_generic_val($t0: fields::G): u64 { +fun fields::read_generic_val($t0: 0x42::fields::G): u64 { var $t1: u64 - var $t2: &fields::G + var $t2: &0x42::fields::G var $t3: &u64 0: $t2 := borrow_local($t0) - 1: $t3 := borrow_field>.f($t2) + 1: $t3 := borrow_field<0x42::fields::G>.f($t2) 2: $t1 := read_ref($t3) 3: return $t1 } [variant baseline] -fun fields::read_ref($t0: &fields::S): u64 { +fun fields::read_ref($t0: &0x42::fields::S): u64 { var $t1: u64 - var $t2: &fields::T + var $t2: &0x42::fields::T var $t3: &u64 - 0: $t2 := borrow_field.g($t0) - 1: $t3 := borrow_field.h($t2) + 0: $t2 := borrow_field<0x42::fields::S>.g($t0) + 1: $t3 := borrow_field<0x42::fields::T>.h($t2) 2: $t1 := read_ref($t3) 3: return $t1 } [variant baseline] -fun fields::read_val($t0: fields::S): u64 { +fun fields::read_val($t0: 0x42::fields::S): u64 { var $t1: u64 - var $t2: &fields::T - var $t3: &fields::S + var $t2: &0x42::fields::T + var $t3: &0x42::fields::S var $t4: &u64 0: $t3 := borrow_local($t0) - 1: $t2 := borrow_field.g($t3) - 2: $t4 := borrow_field.h($t2) + 1: $t2 := borrow_field<0x42::fields::S>.g($t3) + 2: $t4 := borrow_field<0x42::fields::T>.h($t2) 3: $t1 := read_ref($t4) 4: return $t1 } [variant baseline] -fun fields::write_generic_val($t0: &mut fields::G, $t1: u64) { +fun fields::write_generic_val($t0: &mut 0x42::fields::G, $t1: u64) { var $t2: &mut u64 - 0: $t2 := borrow_field>.f($t0) + 0: $t2 := borrow_field<0x42::fields::G>.f($t0) 1: write_ref($t2, $t1) 2: return () } [variant baseline] -fun fields::write_local_direct(): fields::S { - var $t0: fields::S - var $t1: fields::S +fun fields::write_local_direct(): 0x42::fields::S { + var $t0: 0x42::fields::S + var $t1: 0x42::fields::S var $t2: u64 - var $t3: fields::T + var $t3: 0x42::fields::T var $t4: u64 var $t5: u64 var $t6: &mut u64 - var $t7: &mut fields::T - var $t8: &mut fields::S + var $t7: &mut 0x42::fields::T + var $t8: &mut 0x42::fields::S 0: $t2 := 0 1: $t4 := 0 - 2: $t3 := pack fields::T($t4) - 3: $t1 := pack fields::S($t2, $t3) + 2: $t3 := pack 0x42::fields::T($t4) + 3: $t1 := pack 0x42::fields::S($t2, $t3) 4: $t5 := 42 5: $t8 := borrow_local($t1) - 6: $t7 := borrow_field.g($t8) - 7: $t6 := borrow_field.h($t7) + 6: $t7 := borrow_field<0x42::fields::S>.g($t8) + 7: $t6 := borrow_field<0x42::fields::T>.h($t7) 8: write_ref($t6, $t5) 9: $t0 := infer($t1) 10: return $t0 @@ -134,24 +184,24 @@ fun fields::write_local_direct(): fields::S { [variant baseline] -fun fields::write_local_via_ref(): fields::S { - var $t0: fields::S - var $t1: fields::S +fun fields::write_local_via_ref(): 0x42::fields::S { + var $t0: 0x42::fields::S + var $t1: 0x42::fields::S var $t2: u64 - var $t3: fields::T + var $t3: 0x42::fields::T var $t4: u64 - var $t5: &mut fields::S + var $t5: &mut 0x42::fields::S var $t6: u64 var $t7: &mut u64 - var $t8: &mut fields::T + var $t8: &mut 0x42::fields::T 0: $t2 := 0 1: $t4 := 0 - 2: $t3 := pack fields::T($t4) - 3: $t1 := pack fields::S($t2, $t3) + 2: $t3 := pack 0x42::fields::T($t4) + 3: $t1 := pack 0x42::fields::S($t2, $t3) 4: $t5 := borrow_local($t1) 5: $t6 := 42 - 6: $t8 := borrow_field.g($t5) - 7: $t7 := borrow_field.h($t8) + 6: $t8 := borrow_field<0x42::fields::S>.g($t5) + 7: $t7 := borrow_field<0x42::fields::T>.h($t8) 8: write_ref($t7, $t6) 9: $t0 := infer($t1) 10: return $t0 @@ -159,23 +209,23 @@ fun fields::write_local_via_ref(): fields::S { [variant baseline] -fun fields::write_local_via_ref_2(): fields::S { - var $t0: fields::S - var $t1: fields::S +fun fields::write_local_via_ref_2(): 0x42::fields::S { + var $t0: 0x42::fields::S + var $t1: 0x42::fields::S var $t2: u64 - var $t3: fields::T + var $t3: 0x42::fields::T var $t4: u64 var $t5: &mut u64 - var $t6: &mut fields::T - var $t7: &mut fields::S + var $t6: &mut 0x42::fields::T + var $t7: &mut 0x42::fields::S var $t8: u64 0: $t2 := 0 1: $t4 := 0 - 2: $t3 := pack fields::T($t4) - 3: $t1 := pack fields::S($t2, $t3) + 2: $t3 := pack 0x42::fields::T($t4) + 3: $t1 := pack 0x42::fields::S($t2, $t3) 4: $t7 := borrow_local($t1) - 5: $t6 := borrow_field.g($t7) - 6: $t5 := borrow_field.h($t6) + 5: $t6 := borrow_field<0x42::fields::S>.g($t7) + 6: $t5 := borrow_field<0x42::fields::T>.h($t6) 7: $t8 := 42 8: write_ref($t5, $t8) 9: $t0 := infer($t1) @@ -184,29 +234,29 @@ fun fields::write_local_via_ref_2(): fields::S { [variant baseline] -fun fields::write_param($t0: &mut fields::S) { +fun fields::write_param($t0: &mut 0x42::fields::S) { var $t1: u64 var $t2: &mut u64 - var $t3: &mut fields::T + var $t3: &mut 0x42::fields::T 0: $t1 := 42 - 1: $t3 := borrow_field.g($t0) - 2: $t2 := borrow_field.h($t3) + 1: $t3 := borrow_field<0x42::fields::S>.g($t0) + 2: $t2 := borrow_field<0x42::fields::T>.h($t3) 3: write_ref($t2, $t1) 4: return () } [variant baseline] -fun fields::write_val($t0: fields::S): fields::S { - var $t1: fields::S +fun fields::write_val($t0: 0x42::fields::S): 0x42::fields::S { + var $t1: 0x42::fields::S var $t2: u64 var $t3: &mut u64 - var $t4: &mut fields::T - var $t5: &mut fields::S + var $t4: &mut 0x42::fields::T + var $t5: &mut 0x42::fields::S 0: $t2 := 42 1: $t5 := borrow_local($t0) - 2: $t4 := borrow_field.g($t5) - 3: $t3 := borrow_field.h($t4) + 2: $t4 := borrow_field<0x42::fields::S>.g($t5) + 3: $t3 := borrow_field<0x42::fields::T>.h($t4) 4: write_ref($t3, $t2) 5: $t1 := infer($t0) 6: return $t1 diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/fields_invalid.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/fields_invalid.exp index b8cd6367f2bae..4911ab49100bf 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/fields_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/fields_invalid.exp @@ -5,17 +5,31 @@ module 0x42::fields { } struct S { f: u64, - g: fields::T, + g: 0x42::fields::T, } - private fun write_ref(x: &fields::S) { - select fields::T.h(select fields::S.g<&fields::S>(x)) = 42; + private fun write_ref(x: &S) { + select fields::T.h(select fields::S.g<&S>(x)) = 42; Tuple() } } // end 0x42::fields +// -- Sourcified model before bytecode pipeline +module 0x42::fields { + struct T { + h: u64, + } + struct S { + f: u64, + g: T, + } + fun write_ref(x: &S) { + x.g.h = 42; + } +} + Diagnostics: -error: expected `&mut` but found `&fields::S` +error: expected `&mut` but found `&S` ┌─ tests/bytecode-generator/fields_invalid.move:13:9 │ 13 │ x.g.h = 42; diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/freeze_mut_ref.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/freeze_mut_ref.exp index 4e123090b3f54..cf24cf3290946 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/freeze_mut_ref.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/freeze_mut_ref.exp @@ -7,20 +7,20 @@ module 0x42::freeze_mut_ref { struct S { dummy_field: bool, } - public fun borrow_mut(map: &mut vector<#0>): � { + public fun borrow_mut(map: &mut vector): &Element { Freeze(false)(vector::borrow_mut(map, 0)) } - public fun borrow_mut2(v: &mut #0): � { + public fun borrow_mut2(v: &mut Element): &Element { Freeze(false)(v) } - public fun borrow_mut3(v1: &mut #0,v2: �): � { + public fun borrow_mut3(v1: &mut Element,v2: &Element): &Element { if true { Freeze(false)(v1) } else { v2 } } - public fun borrow_mut4(v: &mut #0): � { + public fun borrow_mut4(v: &mut Element): &Element { return Freeze(false)(v) } private fun t0() { @@ -30,7 +30,7 @@ module 0x42::freeze_mut_ref { Tuple() } } - private fun t1(s: &mut freeze_mut_ref::S): &freeze_mut_ref::S { + private fun t1(s: &mut S): &S { Freeze(false)(s) } private fun t2(u1: &mut u64,u2: &mut u64): (&u64, &mut u64) { @@ -46,14 +46,14 @@ module 0x42::freeze_mut_ref { } } } - public fun t5(s: &mut freeze_mut_ref::G) { + public fun t5(s: &mut G) { { let x: u64 = 0; { - let f: &mut u64 = Borrow(Mutable)(select freeze_mut_ref::G.f<&mut freeze_mut_ref::G>(x: u64 = Add(x, 1); + let f: &mut u64 = Borrow(Mutable)(select freeze_mut_ref::G.f<&mut G>(x: u64 = Add(x, 1); s)); { - let g: &mut u64 = Borrow(Mutable)(select freeze_mut_ref::G.f<&mut freeze_mut_ref::G>(x: u64 = Add(x, 1); + let g: &mut u64 = Borrow(Mutable)(select freeze_mut_ref::G.f<&mut G>(x: u64 = Add(x, 1); s)); { let y: &mut u64 = Borrow(Mutable)(2); @@ -69,21 +69,21 @@ module 0x42::freeze_mut_ref { } } } - private fun t6(cond: bool,s: &mut freeze_mut_ref::S,other: &freeze_mut_ref::S) { + private fun t6(cond: bool,s: &mut S,other: &S) { { - let x: &freeze_mut_ref::S; + let x: &S; if cond { - x: &freeze_mut_ref::S = Freeze(false)(Copy(s)) + x: &S = Freeze(false)(Copy(s)) } else { - x: &freeze_mut_ref::S = other + x: &S = other }; Tuple() } } - private fun t7(cond: bool,s: &mut freeze_mut_ref::S,other: &freeze_mut_ref::S) { + private fun t7(cond: bool,s: &mut S,other: &S) { { - let _x: &freeze_mut_ref::S; - _x: &freeze_mut_ref::S = if cond { + let _x: &S; + _x: &S = if cond { Freeze(false)(s) } else { other @@ -91,9 +91,9 @@ module 0x42::freeze_mut_ref { Tuple() } } - private fun t8(cond: bool,s: &mut freeze_mut_ref::S,other: &freeze_mut_ref::S) { + private fun t8(cond: bool,s: &mut S,other: &S) { { - let _x: &freeze_mut_ref::S = if cond { + let _x: &S = if cond { Freeze(false)(s) } else { other @@ -103,6 +103,71 @@ module 0x42::freeze_mut_ref { } } // end 0x42::freeze_mut_ref +// -- Sourcified model before bytecode pipeline +module 0x42::freeze_mut_ref { + struct G { + f: u64, + } + struct S has drop { + } + public fun borrow_mut(map: &mut vector): &Element { + /*freeze*/0x1::vector::borrow_mut(map, 0) + } + public fun borrow_mut2(v: &mut Element): &Element { + /*freeze*/v + } + public fun borrow_mut3(v1: &mut Element, v2: &Element): &Element { + if (true) /*freeze*/v1 else v2 + } + public fun borrow_mut4(v: &mut Element): &Element { + /*freeze*/v + } + fun t0() { + let x = /*freeze*/&mut 0; + x; + } + fun t1(s: &mut S): &S { + /*freeze*/s + } + fun t2(u1: &mut u64, u2: &mut u64): (&u64, &mut u64) { + (/*freeze*/u1, u2) + } + public fun t4() { + let x; + let y; + (x,y) = (/*freeze*/&mut 0, /*freeze*/&mut 0); + } + public fun t5(s: &mut G) { + let x = 0; + let f = &mut { + x = x + 1; + s + }.f; + let g = &mut { + x = x + 1; + s + }.f; + let y = &mut 2; + let z; + *{ + *f = 0; + z = /*freeze*/y; + g + } = 2; + } + fun t6(cond: bool, s: &mut S, other: &S) { + let x; + if (cond) x = /*freeze*/copy s else x = other; + } + fun t7(cond: bool, s: &mut S, other: &S) { + let _x; + _x = if (cond) /*freeze*/s else other; + } + fun t8(cond: bool, s: &mut S, other: &S) { + let _x = if (cond) /*freeze*/s else other; + } +} + ============ initial bytecode ================ [variant baseline] @@ -165,8 +230,8 @@ fun freeze_mut_ref::t0() { [variant baseline] -fun freeze_mut_ref::t1($t0: &mut freeze_mut_ref::S): &freeze_mut_ref::S { - var $t1: &freeze_mut_ref::S +fun freeze_mut_ref::t1($t0: &mut 0x42::freeze_mut_ref::S): &0x42::freeze_mut_ref::S { + var $t1: &0x42::freeze_mut_ref::S 0: $t1 := freeze_ref(implicit)($t0) 1: return $t1 } @@ -205,14 +270,14 @@ public fun freeze_mut_ref::t4() { [variant baseline] -public fun freeze_mut_ref::t5($t0: &mut freeze_mut_ref::G) { +public fun freeze_mut_ref::t5($t0: &mut 0x42::freeze_mut_ref::G) { var $t1: u64 var $t2: &mut u64 - var $t3: &mut freeze_mut_ref::G + var $t3: &mut 0x42::freeze_mut_ref::G var $t4: u64 var $t5: u64 var $t6: &mut u64 - var $t7: &mut freeze_mut_ref::G + var $t7: &mut 0x42::freeze_mut_ref::G var $t8: u64 var $t9: u64 var $t10: &mut u64 @@ -227,12 +292,12 @@ public fun freeze_mut_ref::t5($t0: &mut freeze_mut_ref::G) { 2: $t4 := +($t1, $t5) 3: $t1 := infer($t4) 4: $t3 := infer($t0) - 5: $t2 := borrow_field.f($t3) + 5: $t2 := borrow_field<0x42::freeze_mut_ref::G>.f($t3) 6: $t9 := 1 7: $t8 := +($t1, $t9) 8: $t1 := infer($t8) 9: $t7 := infer($t0) - 10: $t6 := borrow_field.f($t7) + 10: $t6 := borrow_field<0x42::freeze_mut_ref::G>.f($t7) 11: $t11 := 2 12: $t10 := borrow_local($t11) 13: $t13 := 2 @@ -247,10 +312,10 @@ public fun freeze_mut_ref::t5($t0: &mut freeze_mut_ref::G) { [variant baseline] -fun freeze_mut_ref::t6($t0: bool, $t1: &mut freeze_mut_ref::S, $t2: &freeze_mut_ref::S) { - var $t3: &freeze_mut_ref::S - var $t4: &freeze_mut_ref::S - var $t5: &mut freeze_mut_ref::S +fun freeze_mut_ref::t6($t0: bool, $t1: &mut 0x42::freeze_mut_ref::S, $t2: &0x42::freeze_mut_ref::S) { + var $t3: &0x42::freeze_mut_ref::S + var $t4: &0x42::freeze_mut_ref::S + var $t5: &mut 0x42::freeze_mut_ref::S 0: if ($t0) goto 1 else goto 6 1: label L0 2: $t5 := copy($t1) @@ -265,9 +330,9 @@ fun freeze_mut_ref::t6($t0: bool, $t1: &mut freeze_mut_ref::S, $t2: &freeze_mut_ [variant baseline] -fun freeze_mut_ref::t7($t0: bool, $t1: &mut freeze_mut_ref::S, $t2: &freeze_mut_ref::S) { - var $t3: &freeze_mut_ref::S - var $t4: &freeze_mut_ref::S +fun freeze_mut_ref::t7($t0: bool, $t1: &mut 0x42::freeze_mut_ref::S, $t2: &0x42::freeze_mut_ref::S) { + var $t3: &0x42::freeze_mut_ref::S + var $t4: &0x42::freeze_mut_ref::S 0: if ($t0) goto 1 else goto 4 1: label L0 2: $t4 := freeze_ref(implicit)($t1) @@ -281,8 +346,8 @@ fun freeze_mut_ref::t7($t0: bool, $t1: &mut freeze_mut_ref::S, $t2: &freeze_mut_ [variant baseline] -fun freeze_mut_ref::t8($t0: bool, $t1: &mut freeze_mut_ref::S, $t2: &freeze_mut_ref::S) { - var $t3: &freeze_mut_ref::S +fun freeze_mut_ref::t8($t0: bool, $t1: &mut 0x42::freeze_mut_ref::S, $t2: &0x42::freeze_mut_ref::S) { + var $t3: &0x42::freeze_mut_ref::S 0: if ($t0) goto 1 else goto 4 1: label L0 2: $t3 := freeze_ref(implicit)($t1) diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/globals.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/globals.exp index 5015f6fb1c18f..60f8155f1393d 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/globals.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/globals.exp @@ -12,48 +12,74 @@ module 0x42::globals { f: u64, } private fun check(a: address): bool { - exists(a) + exists(a) } private fun publish(s: &signer) { - MoveTo(s, pack globals::R(1)); + MoveTo(s, pack globals::R(1)); Tuple() } private fun read(a: address): u64 - acquires globals::R(*) + acquires 0x42::globals::R(*) { { - let r: &globals::R = BorrowGlobal(Immutable)(a); - select globals::R.f<&globals::R>(r) + let r: &R = BorrowGlobal(Immutable)(a); + select globals::R.f<&R>(r) } } private fun write(a: address,x: u64): u64 - acquires globals::R(*) + acquires 0x42::globals::R(*) { { - let r: &mut globals::R = BorrowGlobal(Mutable)(a); - select globals::R.f<&mut globals::R>(r) = 2; + let r: &mut R = BorrowGlobal(Mutable)(a); + select globals::R.f<&mut R>(r) = 2; 9 } } } // end 0x42::globals +// -- Sourcified model before bytecode pipeline +module 0x42::globals { + struct R has store, key { + f: u64, + } + fun check(a: address): bool { + exists(a) + } + fun publish(s: &signer) { + move_to(s, R{f: 1}); + } + fun read(a: address): u64 + acquires R + { + let r = borrow_global(a); + r.f + } + fun write(a: address, x: u64): u64 + acquires R + { + let r = borrow_global_mut(a); + r.f = 2; + 9 + } +} + ============ initial bytecode ================ [variant baseline] fun globals::check($t0: address): bool { var $t1: bool - 0: $t1 := exists($t0) + 0: $t1 := exists<0x42::globals::R>($t0) 1: return $t1 } [variant baseline] fun globals::publish($t0: &signer) { - var $t1: globals::R + var $t1: 0x42::globals::R var $t2: u64 0: $t2 := 1 - 1: $t1 := pack globals::R($t2) - 2: move_to($t0, $t1) + 1: $t1 := pack 0x42::globals::R($t2) + 2: move_to<0x42::globals::R>($t0, $t1) 3: return () } @@ -61,10 +87,10 @@ fun globals::publish($t0: &signer) { [variant baseline] fun globals::read($t0: address): u64 { var $t1: u64 - var $t2: &globals::R + var $t2: &0x42::globals::R var $t3: &u64 - 0: $t2 := borrow_global($t0) - 1: $t3 := borrow_field.f($t2) + 0: $t2 := borrow_global<0x42::globals::R>($t0) + 1: $t3 := borrow_field<0x42::globals::R>.f($t2) 2: $t1 := read_ref($t3) 3: return $t1 } @@ -73,12 +99,12 @@ fun globals::read($t0: address): u64 { [variant baseline] fun globals::write($t0: address, $t1: u64): u64 { var $t2: u64 - var $t3: &mut globals::R + var $t3: &mut 0x42::globals::R var $t4: u64 var $t5: &mut u64 - 0: $t3 := borrow_global($t0) + 0: $t3 := borrow_global<0x42::globals::R>($t0) 1: $t4 := 2 - 2: $t5 := borrow_field.f($t3) + 2: $t5 := borrow_field<0x42::globals::R>.f($t3) 3: write_ref($t5, $t4) 4: $t2 := 9 5: return $t2 diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/if_else.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/if_else.exp index b8f50f7ed5fbf..a8faa766b2a7a 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/if_else.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/if_else.exp @@ -20,6 +20,16 @@ module 0x42::if_else { } } // end 0x42::if_else +// -- Sourcified model before bytecode pipeline +module 0x42::if_else { + fun if_else(cond: bool, x: u64): u64 { + if (cond) x + 1 else x - 1 + } + fun if_else_nested(cond: bool, x: u64): u64 { + if ((if (cond) x + 1 else x - 1) > 10) x * 2 else x / 2 + } +} + ============ initial bytecode ================ [variant baseline] diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/inline_specs.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/inline_specs.exp index 523f94760adc5..2f77eb1351425 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/inline_specs.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/inline_specs.exp @@ -20,6 +20,30 @@ module 0x42::inline_specs { } } // end 0x42::inline_specs +// -- Sourcified model before bytecode pipeline +module 0x42::inline_specs { + fun specs(): u64 { + let x = 0; + + /* spec { + assert Eq(x, 0); + } + */ + ; + x = succ(x); + + /* spec { + assert Eq(x, 1); + } + */ + ; + x + } + fun succ(x: u64): u64 { + x + 1 + } +} + ============ initial bytecode ================ [variant baseline] diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/loop.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/loop.exp index 7c1cc30de33ce..85bca4397bfc9 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/loop.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/loop.exp @@ -55,6 +55,35 @@ module 0x42::loops { } } // end 0x42::loops +// -- Sourcified model before bytecode pipeline +module 0x42::loops { + fun nested_loop(x: u64): u64 { + while (x > 0) { + while (x > 10) { + x = x - 1; + break; + }; + x = x - 1; + continue; + }; + x + } + fun while_loop(x: u64): u64 { + while (x > 0) { + x = x - 1; + }; + x + } + fun while_loop_with_break_and_continue(x: u64): u64 { + while (x > 0) { + if (x == 42) break; + if (x == 21) continue; + x = x - 1; + }; + x + } +} + ============ initial bytecode ================ [variant baseline] diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/loop_invalid.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/loop_invalid.exp index ba517bb313e92..d5397a3b06b12 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/loop_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/loop_invalid.exp @@ -24,6 +24,20 @@ module 0x42::loop_invalid { } } // end 0x42::loop_invalid +// -- Sourcified model before bytecode pipeline +module 0x42::loop_invalid { + fun misplaced_break(x: u64): u64 { + while (x > 0) break; + break; + x + } + fun misplaced_continue(x: u64): u64 { + continue; + while (x > 0) continue; + x + } +} + Diagnostics: error: missing enclosing loop statement diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_ability_err.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_ability_err.exp index efb2eb10cc3cd..a3dfa3d3f7cab 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_ability_err.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_ability_err.exp @@ -15,25 +15,25 @@ module 0xc0ffee::m { enum Outer { None, One { - i: m::Inner, + i: 0xc0ffee::m::Inner, } Two { - i: m::Inner, - b: m::Box, + i: 0xc0ffee::m::Inner, + b: 0xc0ffee::m::Box, } } - public fun condition_requires_copy(o: m::Outer): m::Outer { + public fun condition_requires_copy(o: Outer): Outer { match (o) { m::Outer::One{ i } if m::consume(i) => { pack m::Outer::One(i) } - o: m::Outer => { + o: Outer => { o } } } - private fun consume(self: m::Inner): bool { + private fun consume(self: Inner): bool { match (self) { m::Inner::Inner1{ x: _ } => { Tuple() @@ -45,12 +45,12 @@ module 0xc0ffee::m { ; true } - public fun matched_value_not_consumed(o: m::Outer) { + public fun matched_value_not_consumed(o: Outer) { match (o) { m::Outer::One{ i: _ } => { Tuple() } - _: m::Outer => { + _: Outer => { Tuple() } } @@ -58,29 +58,74 @@ module 0xc0ffee::m { } } // end 0xc0ffee::m +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::m { + struct Box has drop { + x: u64, + } + enum Inner { + Inner1 { + x: u64, + } + Inner2 { + x: u64, + y: u64, + } + } + enum Outer { + None, + One { + i: Inner, + } + Two { + i: Inner, + b: Box, + } + } + public fun condition_requires_copy(o: Outer): Outer { + match (o) { + Outer::One{i: i} if consume(i) => Outer::One{i: i}, + o => o, + } + } + fun consume(self: Inner): bool { + match (self) { + Inner::Inner1{x: _} => (), + Inner::Inner2{x: _,y: _} => (), + }; + true + } + public fun matched_value_not_consumed(o: Outer) { + match (o) { + Outer::One{i: _} => (), + _ => (), + } + } +} + ============ initial bytecode ================ [variant baseline] -public fun m::condition_requires_copy($t0: m::Outer): m::Outer { - var $t1: m::Outer - var $t2: &m::Outer +public fun m::condition_requires_copy($t0: 0xc0ffee::m::Outer): 0xc0ffee::m::Outer { + var $t1: 0xc0ffee::m::Outer + var $t2: &0xc0ffee::m::Outer var $t3: bool - var $t4: &m::Inner - var $t5: m::Inner - var $t6: m::Inner - var $t7: m::Outer + var $t4: &0xc0ffee::m::Inner + var $t5: 0xc0ffee::m::Inner + var $t6: 0xc0ffee::m::Inner + var $t7: 0xc0ffee::m::Outer var $t8: u64 0: $t2 := borrow_local($t0) - 1: $t3 := test_variant m::Outer::One($t2) + 1: $t3 := test_variant 0xc0ffee::m::Outer::One($t2) 2: if ($t3) goto 3 else goto 12 3: label L2 - 4: $t4 := borrow_variant_field.i($t2) + 4: $t4 := borrow_variant_field<0xc0ffee::m::Outer::One>.i($t2) 5: $t5 := read_ref($t4) 6: $t3 := m::consume($t5) 7: if ($t3) goto 8 else goto 12 8: label L3 - 9: $t6 := unpack_variant m::Outer::One($t0) - 10: $t1 := pack_variant m::Outer::One($t6) + 9: $t6 := unpack_variant 0xc0ffee::m::Outer::One($t0) + 10: $t1 := pack_variant 0xc0ffee::m::Outer::One($t6) 11: goto 19 12: label L1 13: $t7 := infer($t0) @@ -95,25 +140,25 @@ public fun m::condition_requires_copy($t0: m::Outer): m::Outer { [variant baseline] -fun m::consume($t0: m::Inner): bool { +fun m::consume($t0: 0xc0ffee::m::Inner): bool { var $t1: bool - var $t2: &m::Inner + var $t2: &0xc0ffee::m::Inner var $t3: bool var $t4: u64 var $t5: u64 var $t6: u64 var $t7: u64 0: $t2 := borrow_local($t0) - 1: $t3 := test_variant m::Inner::Inner1($t2) + 1: $t3 := test_variant 0xc0ffee::m::Inner::Inner1($t2) 2: if ($t3) goto 3 else goto 6 3: label L2 - 4: $t4 := unpack_variant m::Inner::Inner1($t0) + 4: $t4 := unpack_variant 0xc0ffee::m::Inner::Inner1($t0) 5: goto 15 6: label L1 - 7: $t3 := test_variant m::Inner::Inner2($t2) + 7: $t3 := test_variant 0xc0ffee::m::Inner::Inner2($t2) 8: if ($t3) goto 9 else goto 12 9: label L4 - 10: ($t5, $t6) := unpack_variant m::Inner::Inner2($t0) + 10: ($t5, $t6) := unpack_variant 0xc0ffee::m::Inner::Inner2($t0) 11: goto 15 12: label L3 13: $t7 := 14566554180833181697 @@ -125,17 +170,17 @@ fun m::consume($t0: m::Inner): bool { [variant baseline] -public fun m::matched_value_not_consumed($t0: m::Outer) { - var $t1: &m::Outer +public fun m::matched_value_not_consumed($t0: 0xc0ffee::m::Outer) { + var $t1: &0xc0ffee::m::Outer var $t2: bool - var $t3: m::Inner - var $t4: m::Outer + var $t3: 0xc0ffee::m::Inner + var $t4: 0xc0ffee::m::Outer var $t5: u64 0: $t1 := borrow_local($t0) - 1: $t2 := test_variant m::Outer::One($t1) + 1: $t2 := test_variant 0xc0ffee::m::Outer::One($t1) 2: if ($t2) goto 3 else goto 6 3: label L2 - 4: $t3 := unpack_variant m::Outer::One($t0) + 4: $t3 := unpack_variant 0xc0ffee::m::Outer::One($t0) 5: goto 12 6: label L1 7: $t4 := infer($t0) @@ -149,19 +194,19 @@ public fun m::matched_value_not_consumed($t0: m::Outer) { Diagnostics: -error: value of type `m::Inner` does not have the `drop` ability +error: value of type `Inner` does not have the `drop` ability ┌─ tests/bytecode-generator/matching_ability_err.move:28:13 │ 28 │ One{i: _} => {} │ ^^^^^^^^^ implicitly dropped here since it is no longer used -error: value of type `m::Outer` does not have the `drop` ability +error: value of type `Outer` does not have the `drop` ability ┌─ tests/bytecode-generator/matching_ability_err.move:29:13 │ 29 │ _ => {} │ ^ implicitly dropped here since it is no longer used -error: local `i` of type `m::Inner` does not have the `copy` ability +error: local `i` of type `Inner` does not have the `copy` ability ┌─ tests/bytecode-generator/matching_ability_err.move:35:31 │ 35 │ One{i} if consume(i) => Outer::One{i}, diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_coverage_err.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_coverage_err.exp index bd94845343123..805678cbb5cf7 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_coverage_err.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_coverage_err.exp @@ -15,25 +15,25 @@ module 0xc0ffee::m { enum Outer { None, One { - i: m::Inner, + i: 0xc0ffee::m::Inner, } Two { - i: m::Inner, - b: m::Box, + i: 0xc0ffee::m::Inner, + b: 0xc0ffee::m::Box, } } - public fun exhaustive_tuple(i: &m::Inner) { + public fun exhaustive_tuple(i: &Inner) { match (Tuple(i, i)) { - (m::Inner::Inner1{ x: _ }, _: &m::Inner): (&m::Inner, &m::Inner) => { + (m::Inner::Inner1{ x: _ }, _: &Inner): (&Inner, &Inner) => { Tuple() } - (m::Inner::Inner2{ x: _, y: _ }, _: &m::Inner): (&m::Inner, &m::Inner) => { + (m::Inner::Inner2{ x: _, y: _ }, _: &Inner): (&Inner, &Inner) => { Tuple() } } } - public fun exhaustive_via_merge(o: &m::Outer) { + public fun exhaustive_via_merge(o: &Outer) { match (o) { m::Outer::None => { Tuple() @@ -50,7 +50,7 @@ module 0xc0ffee::m { } } - public fun non_exhaustive(o: &m::Outer) { + public fun non_exhaustive(o: &Outer) { match (o) { m::Outer::None => { Tuple() @@ -61,7 +61,7 @@ module 0xc0ffee::m { } } - public fun non_exhaustive_because_of_cond(o: &m::Outer) { + public fun non_exhaustive_because_of_cond(o: &Outer) { match (o) { m::Outer::None => { Tuple() @@ -69,13 +69,13 @@ module 0xc0ffee::m { m::Outer::One{ i: _ } => { Tuple() } - m::Outer::Two{ i: _, b } if Gt(select m::Box.x<&m::Box>(b), 0) => { + m::Outer::Two{ i: _, b } if Gt(select m::Box.x<&Box>(b), 0) => { Tuple() } } } - public fun non_exhaustive_because_of_nested(o: &m::Outer) { + public fun non_exhaustive_because_of_nested(o: &Outer) { match (o) { m::Outer::None => { Tuple() @@ -89,26 +89,26 @@ module 0xc0ffee::m { } } - public fun non_exhaustive_tuple(i: &m::Inner) { + public fun non_exhaustive_tuple(i: &Inner) { match (Tuple(i, i)) { - (m::Inner::Inner1{ x: _ }, _: &m::Inner): (&m::Inner, &m::Inner) => { + (m::Inner::Inner1{ x: _ }, _: &Inner): (&Inner, &Inner) => { Tuple() } } } - public fun non_exhaustive_tuple2(i: &m::Inner) { + public fun non_exhaustive_tuple2(i: &Inner) { match (Tuple(i, i)) { - (m::Inner::Inner1{ x: _ }, _: &m::Inner): (&m::Inner, &m::Inner) => { + (m::Inner::Inner1{ x: _ }, _: &Inner): (&Inner, &Inner) => { Tuple() } - (_: &m::Inner, m::Inner::Inner2{ x: _, y: _ }): (&m::Inner, &m::Inner) => { + (_: &Inner, m::Inner::Inner2{ x: _, y: _ }): (&Inner, &Inner) => { Tuple() } } } - public fun unreachable(o: &m::Outer) { + public fun unreachable(o: &Outer) { match (o) { m::Outer::None => { Tuple() @@ -119,13 +119,13 @@ module 0xc0ffee::m { m::Outer::Two{ i: _, b: _ } => { Tuple() } - _: &m::Outer => { + _: &Outer => { Tuple() } } } - public fun unreachable_via_overlaying_pattern(o: &m::Outer) { + public fun unreachable_via_overlaying_pattern(o: &Outer) { match (o) { m::Outer::None => { Tuple() @@ -139,13 +139,13 @@ module 0xc0ffee::m { m::Outer::One{ i: m::Inner::Inner1{ x: _ } } => { Tuple() } - _: &m::Outer => { + _: &Outer => { Tuple() } } } - public fun unreachable_via_repeated_pattern(o: &m::Outer) { + public fun unreachable_via_repeated_pattern(o: &Outer) { match (o) { m::Outer::None => { Tuple() @@ -156,7 +156,7 @@ module 0xc0ffee::m { m::Outer::One{ i: _ } => { Tuple() } - _: &m::Outer => { + _: &Outer => { Tuple() } } @@ -164,6 +164,102 @@ module 0xc0ffee::m { } } // end 0xc0ffee::m +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::m { + struct Box has drop { + x: u64, + } + enum Inner { + Inner1 { + x: u64, + } + Inner2 { + x: u64, + y: u64, + } + } + enum Outer { + None, + One { + i: Inner, + } + Two { + i: Inner, + b: Box, + } + } + public fun exhaustive_tuple(i: &Inner) { + match ((i, i)) { + (Inner::Inner1{x: _},_) => (), + (Inner::Inner2{x: _,y: _},_) => (), + } + } + public fun exhaustive_via_merge(o: &Outer) { + match (o) { + Outer::None{} => (), + Outer::One{i: Inner::Inner1{x: _}} => (), + Outer::One{i: Inner::Inner2{x: _,y: _}} => (), + Outer::Two{i: _,b: _} => (), + } + } + public fun non_exhaustive(o: &Outer) { + match (o) { + Outer::None{} => (), + Outer::One{i: _} => (), + } + } + public fun non_exhaustive_because_of_cond(o: &Outer) { + match (o) { + Outer::None{} => (), + Outer::One{i: _} => (), + Outer::Two{i: _,b: b} if b.x > 0 => (), + } + } + public fun non_exhaustive_because_of_nested(o: &Outer) { + match (o) { + Outer::None{} => (), + Outer::One{i: Inner::Inner1{x: _}} => (), + Outer::Two{i: _,b: _} => (), + } + } + public fun non_exhaustive_tuple(i: &Inner) { + match ((i, i)) { + (Inner::Inner1{x: _},_) => (), + } + } + public fun non_exhaustive_tuple2(i: &Inner) { + match ((i, i)) { + (Inner::Inner1{x: _},_) => (), + (_,Inner::Inner2{x: _,y: _}) => (), + } + } + public fun unreachable(o: &Outer) { + match (o) { + Outer::None{} => (), + Outer::One{i: _} => (), + Outer::Two{i: _,b: _} => (), + _ => (), + } + } + public fun unreachable_via_overlaying_pattern(o: &Outer) { + match (o) { + Outer::None{} => (), + Outer::One{i: Inner::Inner1{x: _}} => (), + Outer::One{i: _} => (), + Outer::One{i: Inner::Inner1{x: _}} => (), + _ => (), + } + } + public fun unreachable_via_repeated_pattern(o: &Outer) { + match (o) { + Outer::None{} => (), + Outer::One{i: _} => (), + Outer::One{i: _} => (), + _ => (), + } + } +} + Diagnostics: error: match not exhaustive diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_ok.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_ok.exp index 27c69ad451e84..c7116654488be 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_ok.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_ok.exp @@ -48,14 +48,14 @@ module 0xc0ffee::m { enum Outer { None, One { - i: m::Inner, + i: 0xc0ffee::m::Inner, } Two { - i: m::Inner, - b: m::Box, + i: 0xc0ffee::m::Inner, + b: 0xc0ffee::m::Box, } } - public fun inner_value(self: m::Inner): u64 { + public fun inner_value(self: Inner): u64 { match (self) { m::Inner::Inner1{ x } => { x @@ -66,18 +66,18 @@ module 0xc0ffee::m { } } - public fun is_inner1(self: &m::Inner): bool { + public fun is_inner1(self: &Inner): bool { match (self) { m::Inner::Inner1{ x: _ } => { true } - _: &m::Inner => { + _: &Inner => { false } } } - public fun is_some(x: &m::Option<#0>): bool { + public fun is_some(x: &Option): bool { match (x) { m::Option::None => { false @@ -88,32 +88,32 @@ module 0xc0ffee::m { } } - public fun is_some_dropped(x: m::Option<#0>): bool { + public fun is_some_dropped(x: Option): bool { match (x) { m::Option::None => { false } - _: m::Option => { + _: Option => { true } } } - public fun is_some_specialized(x: &m::Option>): bool { + public fun is_some_specialized(x: &Option>): bool { match (x) { - m::Option::None> => { + m::Option::None> => { false } - m::Option::Some>{ value: m::Option::None } => { + m::Option::Some>{ value: m::Option::None } => { false } - m::Option::Some>{ value: m::Option::Some{ value: _ } } => { + m::Option::Some>{ value: m::Option::Some{ value: _ } } => { true } } } - public fun outer_value(o: m::Outer): u64 { + public fun outer_value(o: Outer): u64 { match (o) { m::Outer::None => { 0 @@ -122,12 +122,12 @@ module 0xc0ffee::m { m::inner_value(i) } m::Outer::Two{ i, b } => { - Add(m::inner_value(i), select m::Box.x(b)) + Add(m::inner_value(i), select m::Box.x(b)) } } } - public fun outer_value_nested(o: m::Outer): u64 { + public fun outer_value_nested(o: Outer): u64 { match (o) { m::Outer::None => { 0 @@ -139,12 +139,12 @@ module 0xc0ffee::m { m::inner_value(i) } m::Outer::Two{ i, b } => { - Add(m::inner_value(i), select m::Box.x(b)) + Add(m::inner_value(i), select m::Box.x(b)) } } } - public fun outer_value_with_cond(o: m::Outer): u64 { + public fun outer_value_with_cond(o: Outer): u64 { match (o) { m::Outer::None => { 0 @@ -156,12 +156,12 @@ module 0xc0ffee::m { m::inner_value(i) } m::Outer::Two{ i, b } => { - Add(m::inner_value(i), select m::Box.x(b)) + Add(m::inner_value(i), select m::Box.x(b)) } } } - public fun outer_value_with_cond_ref(o: &m::Outer): bool { + public fun outer_value_with_cond_ref(o: &Outer): bool { match (o) { m::Outer::None => { false @@ -178,8 +178,8 @@ module 0xc0ffee::m { } } - private fun select_common_fields(s: m::CommonFields): u64 { - Add(select_variants m::CommonFields.Foo.x|m::CommonFields.Bar.x(s), match (s) { + private fun select_common_fields(s: CommonFields): u64 { + Add(select_variants m::CommonFields.Foo.x|m::CommonFields.Bar.x(s), match (s) { m::CommonFields::Foo{ x: _, y } => { y } @@ -189,40 +189,176 @@ module 0xc0ffee::m { } ) } - private fun select_common_fields_different_offset(s: m::CommonFieldsAtDifferentOffset): u64 { - select_variants m::CommonFieldsAtDifferentOffset.Bar.z|m::CommonFieldsAtDifferentOffset.Baz.z|m::CommonFieldsAtDifferentOffset.Balt.z(s) + private fun select_common_fields_different_offset(s: CommonFieldsAtDifferentOffset): u64 { + select_variants m::CommonFieldsAtDifferentOffset.Bar.z|m::CommonFieldsAtDifferentOffset.Baz.z|m::CommonFieldsAtDifferentOffset.Balt.z(s) } - private fun test_common(s: m::CommonFields): bool { + private fun test_common(s: CommonFields): bool { test_variants m::CommonFields::Foo|Bar(s) } - private fun test_common_ref(s: &m::CommonFields): bool { + private fun test_common_ref(s: &CommonFields): bool { test_variants m::CommonFields::Foo|Bar(s) } } // end 0xc0ffee::m +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::m { + struct Box has drop { + x: u64, + } + enum CommonFields { + Foo { + x: u64, + y: u64, + } + Bar { + x: u64, + z: u64, + } + } + enum CommonFieldsAtDifferentOffset has drop { + Foo { + x: u64, + y: u64, + } + Bar { + x: u64, + z: u64, + } + Baz { + z: u64, + } + Balt { + foo: u8, + z: u64, + } + } + enum Inner { + Inner1 { + x: u64, + } + Inner2 { + x: u64, + y: u64, + } + } + enum Option has drop { + None, + Some { + value: A, + } + } + enum Outer { + None, + One { + i: Inner, + } + Two { + i: Inner, + b: Box, + } + } + public fun inner_value(self: Inner): u64 { + match (self) { + Inner::Inner1{x: x} => x, + Inner::Inner2{x: x,y: y} => x + y, + } + } + public fun is_inner1(self: &Inner): bool { + match (self) { + Inner::Inner1{x: _} => true, + _ => false, + } + } + public fun is_some(x: &Option): bool { + match (x) { + Option::None{} => false, + Option::Some{value: _} => true, + } + } + public fun is_some_dropped(x: Option): bool { + match (x) { + Option::None{} => false, + _ => true, + } + } + public fun is_some_specialized(x: &Option>): bool { + match (x) { + Option::None>{} => false, + Option::Some>{value: Option::None{}} => false, + Option::Some>{value: Option::Some{value: _}} => true, + } + } + public fun outer_value(o: Outer): u64 { + match (o) { + Outer::None{} => 0, + Outer::One{i: i} => inner_value(i), + Outer::Two{i: i,b: b} => inner_value(i) + b.x, + } + } + public fun outer_value_nested(o: Outer): u64 { + match (o) { + Outer::None{} => 0, + Outer::One{i: Inner::Inner1{x: x}} => x, + Outer::One{i: i} => inner_value(i), + Outer::Two{i: i,b: b} => inner_value(i) + b.x, + } + } + public fun outer_value_with_cond(o: Outer): u64 { + match (o) { + Outer::None{} => 0, + Outer::One{i: i} if is_inner1(&i) => inner_value(i) % 2, + Outer::One{i: i} => inner_value(i), + Outer::Two{i: i,b: b} => inner_value(i) + b.x, + } + } + public fun outer_value_with_cond_ref(o: &Outer): bool { + match (o) { + Outer::None{} => false, + Outer::One{i: i} if is_inner1(i) => true, + Outer::One{i: i} => is_inner1(i), + Outer::Two{i: i,b: _} => is_inner1(i), + } + } + fun select_common_fields(s: CommonFields): u64 { + s.Foo.x + (match (s) { + CommonFields::Foo{x: _,y: y} => y, + CommonFields::Bar{x: _,z: z} => z, + }) + } + fun select_common_fields_different_offset(s: CommonFieldsAtDifferentOffset): u64 { + s.Bar.z + } + fun test_common(s: CommonFields): bool { + s is Foo | Bar + } + fun test_common_ref(s: &CommonFields): bool { + s is Foo | Bar + } +} + ============ initial bytecode ================ [variant baseline] -public fun m::inner_value($t0: m::Inner): u64 { +public fun m::inner_value($t0: 0xc0ffee::m::Inner): u64 { var $t1: u64 - var $t2: &m::Inner + var $t2: &0xc0ffee::m::Inner var $t3: bool var $t4: u64 var $t5: u64 var $t6: u64 var $t7: u64 0: $t2 := borrow_local($t0) - 1: $t3 := test_variant m::Inner::Inner1($t2) + 1: $t3 := test_variant 0xc0ffee::m::Inner::Inner1($t2) 2: if ($t3) goto 3 else goto 7 3: label L2 - 4: $t4 := unpack_variant m::Inner::Inner1($t0) + 4: $t4 := unpack_variant 0xc0ffee::m::Inner::Inner1($t0) 5: $t1 := infer($t4) 6: goto 17 7: label L1 - 8: $t3 := test_variant m::Inner::Inner2($t2) + 8: $t3 := test_variant 0xc0ffee::m::Inner::Inner2($t2) 9: if ($t3) goto 10 else goto 14 10: label L4 - 11: ($t5, $t6) := unpack_variant m::Inner::Inner2($t0) + 11: ($t5, $t6) := unpack_variant 0xc0ffee::m::Inner::Inner2($t0) 12: $t1 := +($t5, $t6) 13: goto 17 14: label L3 @@ -234,12 +370,12 @@ public fun m::inner_value($t0: m::Inner): u64 { [variant baseline] -public fun m::is_inner1($t0: &m::Inner): bool { +public fun m::is_inner1($t0: &0xc0ffee::m::Inner): bool { var $t1: bool var $t2: bool - var $t3: &m::Inner + var $t3: &0xc0ffee::m::Inner var $t4: u64 - 0: $t2 := test_variant m::Inner::Inner1($t0) + 0: $t2 := test_variant 0xc0ffee::m::Inner::Inner1($t0) 1: if ($t2) goto 2 else goto 5 2: label L2 3: $t1 := true @@ -257,17 +393,17 @@ public fun m::is_inner1($t0: &m::Inner): bool { [variant baseline] -public fun m::is_some<#0>($t0: &m::Option<#0>): bool { +public fun m::is_some<#0>($t0: &0xc0ffee::m::Option<#0>): bool { var $t1: bool var $t2: bool var $t3: u64 - 0: $t2 := test_variant m::Option<#0>::None($t0) + 0: $t2 := test_variant 0xc0ffee::m::Option<#0>::None($t0) 1: if ($t2) goto 2 else goto 5 2: label L2 3: $t1 := false 4: goto 14 5: label L1 - 6: $t2 := test_variant m::Option<#0>::Some($t0) + 6: $t2 := test_variant 0xc0ffee::m::Option<#0>::Some($t0) 7: if ($t2) goto 8 else goto 11 8: label L4 9: $t1 := true @@ -281,17 +417,17 @@ public fun m::is_some<#0>($t0: &m::Option<#0>): bool { [variant baseline] -public fun m::is_some_dropped<#0>($t0: m::Option<#0>): bool { +public fun m::is_some_dropped<#0>($t0: 0xc0ffee::m::Option<#0>): bool { var $t1: bool - var $t2: &m::Option<#0> + var $t2: &0xc0ffee::m::Option<#0> var $t3: bool - var $t4: m::Option<#0> + var $t4: 0xc0ffee::m::Option<#0> var $t5: u64 0: $t2 := borrow_local($t0) - 1: $t3 := test_variant m::Option<#0>::None($t2) + 1: $t3 := test_variant 0xc0ffee::m::Option<#0>::None($t2) 2: if ($t3) goto 3 else goto 7 3: label L2 - 4: unpack_variant m::Option<#0>::None($t0) + 4: unpack_variant 0xc0ffee::m::Option<#0>::None($t0) 5: $t1 := false 6: goto 14 7: label L1 @@ -307,33 +443,33 @@ public fun m::is_some_dropped<#0>($t0: m::Option<#0>): bool { [variant baseline] -public fun m::is_some_specialized($t0: &m::Option>): bool { +public fun m::is_some_specialized($t0: &0xc0ffee::m::Option<0xc0ffee::m::Option>): bool { var $t1: bool var $t2: bool - var $t3: &m::Option - var $t4: &m::Option + var $t3: &0xc0ffee::m::Option + var $t4: &0xc0ffee::m::Option var $t5: u64 - 0: $t2 := test_variant m::Option>::None($t0) + 0: $t2 := test_variant 0xc0ffee::m::Option<0xc0ffee::m::Option>::None($t0) 1: if ($t2) goto 2 else goto 5 2: label L2 3: $t1 := false 4: goto 28 5: label L1 - 6: $t2 := test_variant m::Option>::Some($t0) + 6: $t2 := test_variant 0xc0ffee::m::Option<0xc0ffee::m::Option>::Some($t0) 7: if ($t2) goto 8 else goto 15 8: label L4 - 9: $t3 := borrow_variant_field>::Some>.value($t0) - 10: $t2 := test_variant m::Option::None($t3) + 9: $t3 := borrow_variant_field<0xc0ffee::m::Option<0xc0ffee::m::Option>::Some>.value($t0) + 10: $t2 := test_variant 0xc0ffee::m::Option::None($t3) 11: if ($t2) goto 12 else goto 15 12: label L5 13: $t1 := false 14: goto 28 15: label L3 - 16: $t2 := test_variant m::Option>::Some($t0) + 16: $t2 := test_variant 0xc0ffee::m::Option<0xc0ffee::m::Option>::Some($t0) 17: if ($t2) goto 18 else goto 25 18: label L7 - 19: $t4 := borrow_variant_field>::Some>.value($t0) - 20: $t2 := test_variant m::Option::Some($t4) + 19: $t4 := borrow_variant_field<0xc0ffee::m::Option<0xc0ffee::m::Option>::Some>.value($t0) + 20: $t2 := test_variant 0xc0ffee::m::Option::Some($t4) 21: if ($t2) goto 22 else goto 25 22: label L8 23: $t1 := true @@ -347,40 +483,40 @@ public fun m::is_some_specialized($t0: &m::Option>): bool { [variant baseline] -public fun m::outer_value($t0: m::Outer): u64 { +public fun m::outer_value($t0: 0xc0ffee::m::Outer): u64 { var $t1: u64 - var $t2: &m::Outer + var $t2: &0xc0ffee::m::Outer var $t3: bool - var $t4: m::Inner - var $t5: m::Inner - var $t6: m::Box + var $t4: 0xc0ffee::m::Inner + var $t5: 0xc0ffee::m::Inner + var $t6: 0xc0ffee::m::Box var $t7: u64 var $t8: u64 - var $t9: &m::Box + var $t9: &0xc0ffee::m::Box var $t10: &u64 var $t11: u64 0: $t2 := borrow_local($t0) - 1: $t3 := test_variant m::Outer::None($t2) + 1: $t3 := test_variant 0xc0ffee::m::Outer::None($t2) 2: if ($t3) goto 3 else goto 7 3: label L2 - 4: unpack_variant m::Outer::None($t0) + 4: unpack_variant 0xc0ffee::m::Outer::None($t0) 5: $t1 := 0 6: goto 28 7: label L1 - 8: $t3 := test_variant m::Outer::One($t2) + 8: $t3 := test_variant 0xc0ffee::m::Outer::One($t2) 9: if ($t3) goto 10 else goto 14 10: label L4 - 11: $t4 := unpack_variant m::Outer::One($t0) + 11: $t4 := unpack_variant 0xc0ffee::m::Outer::One($t0) 12: $t1 := m::inner_value($t4) 13: goto 28 14: label L3 - 15: $t3 := test_variant m::Outer::Two($t2) + 15: $t3 := test_variant 0xc0ffee::m::Outer::Two($t2) 16: if ($t3) goto 17 else goto 25 17: label L6 - 18: ($t5, $t6) := unpack_variant m::Outer::Two($t0) + 18: ($t5, $t6) := unpack_variant 0xc0ffee::m::Outer::Two($t0) 19: $t7 := m::inner_value($t5) 20: $t9 := borrow_local($t6) - 21: $t10 := borrow_field.x($t9) + 21: $t10 := borrow_field<0xc0ffee::m::Box>.x($t9) 22: $t8 := read_ref($t10) 23: $t1 := +($t7, $t8) 24: goto 28 @@ -393,55 +529,55 @@ public fun m::outer_value($t0: m::Outer): u64 { [variant baseline] -public fun m::outer_value_nested($t0: m::Outer): u64 { +public fun m::outer_value_nested($t0: 0xc0ffee::m::Outer): u64 { var $t1: u64 - var $t2: &m::Outer + var $t2: &0xc0ffee::m::Outer var $t3: bool - var $t4: &m::Inner + var $t4: &0xc0ffee::m::Inner var $t5: u64 - var $t6: m::Inner - var $t7: m::Inner - var $t8: m::Inner - var $t9: m::Box + var $t6: 0xc0ffee::m::Inner + var $t7: 0xc0ffee::m::Inner + var $t8: 0xc0ffee::m::Inner + var $t9: 0xc0ffee::m::Box var $t10: u64 var $t11: u64 - var $t12: &m::Box + var $t12: &0xc0ffee::m::Box var $t13: &u64 var $t14: u64 0: $t2 := borrow_local($t0) - 1: $t3 := test_variant m::Outer::None($t2) + 1: $t3 := test_variant 0xc0ffee::m::Outer::None($t2) 2: if ($t3) goto 3 else goto 7 3: label L2 - 4: unpack_variant m::Outer::None($t0) + 4: unpack_variant 0xc0ffee::m::Outer::None($t0) 5: $t1 := 0 6: goto 40 7: label L1 - 8: $t3 := test_variant m::Outer::One($t2) + 8: $t3 := test_variant 0xc0ffee::m::Outer::One($t2) 9: if ($t3) goto 10 else goto 19 10: label L4 - 11: $t4 := borrow_variant_field.i($t2) - 12: $t3 := test_variant m::Inner::Inner1($t4) + 11: $t4 := borrow_variant_field<0xc0ffee::m::Outer::One>.i($t2) + 12: $t3 := test_variant 0xc0ffee::m::Inner::Inner1($t4) 13: if ($t3) goto 14 else goto 19 14: label L5 - 15: $t6 := unpack_variant m::Outer::One($t0) - 16: $t5 := unpack_variant m::Inner::Inner1($t6) + 15: $t6 := unpack_variant 0xc0ffee::m::Outer::One($t0) + 16: $t5 := unpack_variant 0xc0ffee::m::Inner::Inner1($t6) 17: $t1 := infer($t5) 18: goto 40 19: label L3 - 20: $t3 := test_variant m::Outer::One($t2) + 20: $t3 := test_variant 0xc0ffee::m::Outer::One($t2) 21: if ($t3) goto 22 else goto 26 22: label L7 - 23: $t7 := unpack_variant m::Outer::One($t0) + 23: $t7 := unpack_variant 0xc0ffee::m::Outer::One($t0) 24: $t1 := m::inner_value($t7) 25: goto 40 26: label L6 - 27: $t3 := test_variant m::Outer::Two($t2) + 27: $t3 := test_variant 0xc0ffee::m::Outer::Two($t2) 28: if ($t3) goto 29 else goto 37 29: label L9 - 30: ($t8, $t9) := unpack_variant m::Outer::Two($t0) + 30: ($t8, $t9) := unpack_variant 0xc0ffee::m::Outer::Two($t0) 31: $t10 := m::inner_value($t8) 32: $t12 := borrow_local($t9) - 33: $t13 := borrow_field.x($t12) + 33: $t13 := borrow_field<0xc0ffee::m::Box>.x($t12) 34: $t11 := read_ref($t13) 35: $t1 := +($t10, $t11) 36: goto 40 @@ -454,59 +590,59 @@ public fun m::outer_value_nested($t0: m::Outer): u64 { [variant baseline] -public fun m::outer_value_with_cond($t0: m::Outer): u64 { +public fun m::outer_value_with_cond($t0: 0xc0ffee::m::Outer): u64 { var $t1: u64 - var $t2: &m::Outer + var $t2: &0xc0ffee::m::Outer var $t3: bool - var $t4: &m::Inner - var $t5: &m::Inner - var $t6: m::Inner + var $t4: &0xc0ffee::m::Inner + var $t5: &0xc0ffee::m::Inner + var $t6: 0xc0ffee::m::Inner var $t7: u64 var $t8: u64 - var $t9: m::Inner - var $t10: m::Inner - var $t11: m::Box + var $t9: 0xc0ffee::m::Inner + var $t10: 0xc0ffee::m::Inner + var $t11: 0xc0ffee::m::Box var $t12: u64 var $t13: u64 - var $t14: &m::Box + var $t14: &0xc0ffee::m::Box var $t15: &u64 var $t16: u64 0: $t2 := borrow_local($t0) - 1: $t3 := test_variant m::Outer::None($t2) + 1: $t3 := test_variant 0xc0ffee::m::Outer::None($t2) 2: if ($t3) goto 3 else goto 7 3: label L2 - 4: unpack_variant m::Outer::None($t0) + 4: unpack_variant 0xc0ffee::m::Outer::None($t0) 5: $t1 := 0 6: goto 42 7: label L1 - 8: $t3 := test_variant m::Outer::One($t2) + 8: $t3 := test_variant 0xc0ffee::m::Outer::One($t2) 9: if ($t3) goto 10 else goto 21 10: label L4 - 11: $t4 := borrow_variant_field.i($t2) + 11: $t4 := borrow_variant_field<0xc0ffee::m::Outer::One>.i($t2) 12: $t5 := infer($t4) 13: $t3 := m::is_inner1($t5) 14: if ($t3) goto 15 else goto 21 15: label L5 - 16: $t6 := unpack_variant m::Outer::One($t0) + 16: $t6 := unpack_variant 0xc0ffee::m::Outer::One($t0) 17: $t7 := m::inner_value($t6) 18: $t8 := 2 19: $t1 := %($t7, $t8) 20: goto 42 21: label L3 - 22: $t3 := test_variant m::Outer::One($t2) + 22: $t3 := test_variant 0xc0ffee::m::Outer::One($t2) 23: if ($t3) goto 24 else goto 28 24: label L7 - 25: $t9 := unpack_variant m::Outer::One($t0) + 25: $t9 := unpack_variant 0xc0ffee::m::Outer::One($t0) 26: $t1 := m::inner_value($t9) 27: goto 42 28: label L6 - 29: $t3 := test_variant m::Outer::Two($t2) + 29: $t3 := test_variant 0xc0ffee::m::Outer::Two($t2) 30: if ($t3) goto 31 else goto 39 31: label L9 - 32: ($t10, $t11) := unpack_variant m::Outer::Two($t0) + 32: ($t10, $t11) := unpack_variant 0xc0ffee::m::Outer::Two($t0) 33: $t12 := m::inner_value($t10) 34: $t14 := borrow_local($t11) - 35: $t15 := borrow_field.x($t14) + 35: $t15 := borrow_field<0xc0ffee::m::Box>.x($t14) 36: $t13 := read_ref($t15) 37: $t1 := +($t12, $t13) 38: goto 42 @@ -519,40 +655,40 @@ public fun m::outer_value_with_cond($t0: m::Outer): u64 { [variant baseline] -public fun m::outer_value_with_cond_ref($t0: &m::Outer): bool { +public fun m::outer_value_with_cond_ref($t0: &0xc0ffee::m::Outer): bool { var $t1: bool var $t2: bool - var $t3: &m::Inner - var $t4: &m::Inner - var $t5: &m::Inner + var $t3: &0xc0ffee::m::Inner + var $t4: &0xc0ffee::m::Inner + var $t5: &0xc0ffee::m::Inner var $t6: u64 - 0: $t2 := test_variant m::Outer::None($t0) + 0: $t2 := test_variant 0xc0ffee::m::Outer::None($t0) 1: if ($t2) goto 2 else goto 5 2: label L2 3: $t1 := false 4: goto 32 5: label L1 - 6: $t2 := test_variant m::Outer::One($t0) + 6: $t2 := test_variant 0xc0ffee::m::Outer::One($t0) 7: if ($t2) goto 8 else goto 15 8: label L4 - 9: $t3 := borrow_variant_field.i($t0) + 9: $t3 := borrow_variant_field<0xc0ffee::m::Outer::One>.i($t0) 10: $t2 := m::is_inner1($t3) 11: if ($t2) goto 12 else goto 15 12: label L5 13: $t1 := true 14: goto 32 15: label L3 - 16: $t2 := test_variant m::Outer::One($t0) + 16: $t2 := test_variant 0xc0ffee::m::Outer::One($t0) 17: if ($t2) goto 18 else goto 22 18: label L7 - 19: $t4 := borrow_variant_field.i($t0) + 19: $t4 := borrow_variant_field<0xc0ffee::m::Outer::One>.i($t0) 20: $t1 := m::is_inner1($t4) 21: goto 32 22: label L6 - 23: $t2 := test_variant m::Outer::Two($t0) + 23: $t2 := test_variant 0xc0ffee::m::Outer::Two($t0) 24: if ($t2) goto 25 else goto 29 25: label L9 - 26: $t5 := borrow_variant_field.i($t0) + 26: $t5 := borrow_variant_field<0xc0ffee::m::Outer::Two>.i($t0) 27: $t1 := m::is_inner1($t5) 28: goto 32 29: label L8 @@ -564,13 +700,13 @@ public fun m::outer_value_with_cond_ref($t0: &m::Outer): bool { [variant baseline] -fun m::select_common_fields($t0: m::CommonFields): u64 { +fun m::select_common_fields($t0: 0xc0ffee::m::CommonFields): u64 { var $t1: u64 var $t2: u64 - var $t3: &m::CommonFields + var $t3: &0xc0ffee::m::CommonFields var $t4: &u64 var $t5: u64 - var $t6: &m::CommonFields + var $t6: &0xc0ffee::m::CommonFields var $t7: bool var $t8: u64 var $t9: u64 @@ -578,20 +714,20 @@ fun m::select_common_fields($t0: m::CommonFields): u64 { var $t11: u64 var $t12: u64 0: $t3 := borrow_local($t0) - 1: $t4 := borrow_variant_field.x($t3) + 1: $t4 := borrow_variant_field<0xc0ffee::m::CommonFields::Foo|Bar>.x($t3) 2: $t2 := read_ref($t4) 3: $t6 := borrow_local($t0) - 4: $t7 := test_variant m::CommonFields::Foo($t6) + 4: $t7 := test_variant 0xc0ffee::m::CommonFields::Foo($t6) 5: if ($t7) goto 6 else goto 10 6: label L2 - 7: ($t9, $t8) := unpack_variant m::CommonFields::Foo($t0) + 7: ($t9, $t8) := unpack_variant 0xc0ffee::m::CommonFields::Foo($t0) 8: $t5 := infer($t8) 9: goto 20 10: label L1 - 11: $t7 := test_variant m::CommonFields::Bar($t6) + 11: $t7 := test_variant 0xc0ffee::m::CommonFields::Bar($t6) 12: if ($t7) goto 13 else goto 17 13: label L4 - 14: ($t11, $t10) := unpack_variant m::CommonFields::Bar($t0) + 14: ($t11, $t10) := unpack_variant 0xc0ffee::m::CommonFields::Bar($t0) 15: $t5 := infer($t10) 16: goto 20 17: label L3 @@ -604,24 +740,24 @@ fun m::select_common_fields($t0: m::CommonFields): u64 { [variant baseline] -fun m::select_common_fields_different_offset($t0: m::CommonFieldsAtDifferentOffset): u64 { +fun m::select_common_fields_different_offset($t0: 0xc0ffee::m::CommonFieldsAtDifferentOffset): u64 { var $t1: u64 - var $t2: &m::CommonFieldsAtDifferentOffset + var $t2: &0xc0ffee::m::CommonFieldsAtDifferentOffset var $t3: &u64 var $t4: bool 0: $t2 := borrow_local($t0) - 1: $t4 := test_variant m::CommonFieldsAtDifferentOffset::Bar($t2) + 1: $t4 := test_variant 0xc0ffee::m::CommonFieldsAtDifferentOffset::Bar($t2) 2: if ($t4) goto 8 else goto 3 3: label L3 - 4: $t4 := test_variant m::CommonFieldsAtDifferentOffset::Balt($t2) + 4: $t4 := test_variant 0xc0ffee::m::CommonFieldsAtDifferentOffset::Balt($t2) 5: if ($t4) goto 8 else goto 6 6: label L4 7: goto 11 8: label L2 - 9: $t3 := borrow_variant_field.z($t2) + 9: $t3 := borrow_variant_field<0xc0ffee::m::CommonFieldsAtDifferentOffset::Bar|Balt>.z($t2) 10: goto 13 11: label L1 - 12: $t3 := borrow_variant_field.z($t2) + 12: $t3 := borrow_variant_field<0xc0ffee::m::CommonFieldsAtDifferentOffset::Baz>.z($t2) 13: label L0 14: $t1 := read_ref($t3) 15: return $t1 @@ -629,14 +765,14 @@ fun m::select_common_fields_different_offset($t0: m::CommonFieldsAtDifferentOffs [variant baseline] -fun m::test_common($t0: m::CommonFields): bool { +fun m::test_common($t0: 0xc0ffee::m::CommonFields): bool { var $t1: bool - var $t2: &m::CommonFields + var $t2: &0xc0ffee::m::CommonFields 0: $t2 := borrow_local($t0) - 1: $t1 := test_variant m::CommonFields::Foo($t2) + 1: $t1 := test_variant 0xc0ffee::m::CommonFields::Foo($t2) 2: if ($t1) goto 7 else goto 3 3: label L1 - 4: $t1 := test_variant m::CommonFields::Bar($t2) + 4: $t1 := test_variant 0xc0ffee::m::CommonFields::Bar($t2) 5: if ($t1) goto 7 else goto 6 6: label L2 7: label L0 @@ -645,12 +781,12 @@ fun m::test_common($t0: m::CommonFields): bool { [variant baseline] -fun m::test_common_ref($t0: &m::CommonFields): bool { +fun m::test_common_ref($t0: &0xc0ffee::m::CommonFields): bool { var $t1: bool - 0: $t1 := test_variant m::CommonFields::Foo($t0) + 0: $t1 := test_variant 0xc0ffee::m::CommonFields::Foo($t0) 1: if ($t1) goto 6 else goto 2 2: label L1 - 3: $t1 := test_variant m::CommonFields::Bar($t0) + 3: $t1 := test_variant 0xc0ffee::m::CommonFields::Bar($t0) 4: if ($t1) goto 6 else goto 5 5: label L2 6: label L0 @@ -659,7 +795,7 @@ fun m::test_common_ref($t0: &m::CommonFields): bool { Diagnostics: -error: local `s` of type `m::CommonFields` does not have the `drop` ability +error: local `s` of type `CommonFields` does not have the `drop` ability ┌─ tests/bytecode-generator/matching_ok.move:128:10 │ 128 │ (s is Foo|Bar) diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_refutable_err.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_refutable_err.exp index 2072c014526ea..c930a13a552b1 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_refutable_err.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_refutable_err.exp @@ -6,7 +6,7 @@ module 0x815::m { 0: u64, } } - private fun t(self: m::E): u64 { + private fun t(self: E): u64 { { let m::E::Some{ 0: x } = self; x @@ -14,13 +14,27 @@ module 0x815::m { } } // end 0x815::m +// -- Sourcified model before bytecode pipeline +module 0x815::m { + enum E { + None, + Some { + 0: u64, + } + } + fun t(self: E): u64 { + let E::Some(x) = self; + x + } +} + ============ initial bytecode ================ [variant baseline] -fun m::t($t0: m::E): u64 { +fun m::t($t0: 0x815::m::E): u64 { var $t1: u64 var $t2: u64 - 0: $t2 := unpack_variant m::E::Some($t0) + 0: $t2 := unpack_variant 0x815::m::E::Some($t0) 1: $t1 := infer($t2) 2: return $t1 } diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/moved_var_not_simplified3.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/moved_var_not_simplified3.exp index fa669c34cd583..b46e5b602e42e 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/moved_var_not_simplified3.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/moved_var_not_simplified3.exp @@ -14,6 +14,16 @@ module 0xc0ffee::m { } } // end 0xc0ffee::m +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::m { + public fun test(): u8 { + let x = 40u8; + let y = move x; + let _ = x; + y + } +} + ============ initial bytecode ================ [variant baseline] diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/mutate_immutable_cmp.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/mutate_immutable_cmp.exp index 7acf2de5d5ae7..f78da5ffeca47 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/mutate_immutable_cmp.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/mutate_immutable_cmp.exp @@ -1,7 +1,7 @@ // -- Model dump before bytecode pipeline module 0x8675309::M { struct T { - s: M::S, + s: 0x8675309::M::S, } struct G { dummy_field: bool, @@ -9,7 +9,7 @@ module 0x8675309::M { struct S { f: u64, } - private fun t0(s: &mut M::S) { + private fun t0(s: &mut S) { s = pack M::S(2); s = pack M::S(0); Borrow(Immutable)(0) = 1; @@ -21,20 +21,20 @@ module 0x8675309::M { let x_ref: &u64 = Freeze(false)(x_ref); x_ref = 0; { - let g: M::S = pack M::S(0); + let g: S = pack M::S(0); { - let g_ref: &mut M::S = Borrow(Mutable)(g); + let g_ref: &mut S = Borrow(Mutable)(g); g_ref = pack M::S(2); { - let t: M::T = pack M::T(g); + let t: T = pack M::T(g); { - let t_ref: &mut M::T = Borrow(Mutable)(t); + let t_ref: &mut T = Borrow(Mutable)(t); { - let g: M::S = pack M::S(2); - select M::T.s<&mut M::T>(t_ref) = g; + let g: S = pack M::S(2); + select M::T.s<&mut T>(t_ref) = g; { - let g: M::S = pack M::S(3); - select M::T.s<&M::T>(t_ref) = g; + let g: S = pack M::S(3); + select M::T.s<&T>(t_ref) = g; Tuple() } } @@ -55,9 +55,43 @@ module 0x8675309::M { } } // end 0x8675309::M +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct T has drop { + s: S, + } + struct G has drop, key { + } + struct S has drop { + f: u64, + } + fun t0(s: &mut S) { + *s = S{f: 2}; + *s = S{f: 0}; + *&0 = 1; + let x = 0; + let x_ref = &mut x; + let x_ref = /*freeze*/x_ref; + *x_ref = 0; + let g = S{f: 0}; + let g_ref = &mut g; + *g_ref = S{f: 2}; + let t = T{s: g}; + let t_ref = &mut t; + let g = S{f: 2}; + t_ref.s = g; + let g = S{f: 3}; + t_ref.s = g; + } + fun t1() { + let x = 3; + *&mut x = 5; + } +} + Diagnostics: -error: expected `&mut` but found `&M::S` +error: expected `&mut` but found `&S` ┌─ tests/bytecode-generator/mutate_immutable_cmp.move:7:11 │ 7 │ *(s: &S) = S { f: 0 }; // this is not OK @@ -75,13 +109,13 @@ error: expected `&mut` but found `&u64` 12 │ *x_ref = 0; │ ^^^^^ -error: expected `&mut` but found `&M::S` +error: expected `&mut` but found `&S` ┌─ tests/bytecode-generator/mutate_immutable_cmp.move:15:11 │ 15 │ *(g_ref: &S) = S {f : 2}; │ ^^^^^ -error: expected `&mut` but found `&M::T` +error: expected `&mut` but found `&T` ┌─ tests/bytecode-generator/mutate_immutable_cmp.move:21:10 │ 21 │ (t_ref: &T).s = g; // this is not OK diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/operators.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/operators.exp index 0dad714bc08b3..3260942440feb 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/operators.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/operators.exp @@ -9,10 +9,10 @@ module 0x42::operators { private fun bools(x: bool,y: bool): bool { Or(Or(Or(And(x, y), And(x, Not(y))), And(Not(x), y)), And(Not(x), Not(y))) } - private fun equality(x: #0,y: #0): bool { + private fun equality(x: T,y: T): bool { Eq(x, y) } - private fun inequality(x: #0,y: #0): bool { + private fun inequality(x: T,y: T): bool { Neq(x, y) } private fun order(x: u64,y: u64): bool { @@ -20,6 +20,28 @@ module 0x42::operators { } } // end 0x42::operators +// -- Sourcified model before bytecode pipeline +module 0x42::operators { + fun arithm(x: u64, y: u64): u64 { + x + y / (x - y) * y % x + } + fun bits(x: u64, y: u8): u64 { + x << y & x + } + fun bools(x: bool, y: bool): bool { + x && y || x && !y || !x && y || !x && !y + } + fun equality(x: T, y: T): bool { + x == y + } + fun inequality(x: T, y: T): bool { + x != y + } + fun order(x: u64, y: u64): bool { + x < y && x <= y && !(x > y) && !(x >= y) + } +} + ============ initial bytecode ================ [variant baseline] diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/pack_order.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/pack_order.exp index 813c92392ef60..52cea517af73a 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/pack_order.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/pack_order.exp @@ -5,10 +5,10 @@ module 0x42::pack_unpack { f2: u8, f3: u8, } - private fun pack1(x: u8,y: u8,z: u8): pack_unpack::S { + private fun pack1(x: u8,y: u8,z: u8): S { pack pack_unpack::S(x, y, z) } - private fun pack2(x: u8,y: u8,z: u8): pack_unpack::S { + private fun pack2(x: u8,y: u8,z: u8): S { { let $f1: u8 = x; { @@ -17,13 +17,13 @@ module 0x42::pack_unpack { } } } - private fun pack3(x: u8,y: u8,z: u8): pack_unpack::S { + private fun pack3(x: u8,y: u8,z: u8): S { { let $f2: u8 = x; pack pack_unpack::S(y, $f2, z) } } - private fun pack4(x: u8,y: u8,z: u8): pack_unpack::S { + private fun pack4(x: u8,y: u8,z: u8): S { { let $f2: u8 = x; { @@ -32,13 +32,13 @@ module 0x42::pack_unpack { } } } - private fun pack5(x: u8,y: u8,z: u8): pack_unpack::S { + private fun pack5(x: u8,y: u8,z: u8): S { { let $f3: u8 = x; pack pack_unpack::S(y, z, $f3) } } - private fun pack6(x: u8,y: u8,z: u8): pack_unpack::S { + private fun pack6(x: u8,y: u8,z: u8): S { { let $f3: u8 = x; { @@ -49,68 +49,103 @@ module 0x42::pack_unpack { } } // end 0x42::pack_unpack +// -- Sourcified model before bytecode pipeline +module 0x42::pack_unpack { + struct S { + f1: u8, + f2: u8, + f3: u8, + } + fun pack1(x: u8, y: u8, z: u8): S { + S{f1: x,f2: y,f3: z} + } + fun pack2(x: u8, y: u8, z: u8): S { + let $f1 = x; + let $f3 = y; + S{f1: $f1,f2: z,f3: $f3} + } + fun pack3(x: u8, y: u8, z: u8): S { + let $f2 = x; + S{f1: y,f2: $f2,f3: z} + } + fun pack4(x: u8, y: u8, z: u8): S { + let $f2 = x; + let $f3 = y; + S{f1: z,f2: $f2,f3: $f3} + } + fun pack5(x: u8, y: u8, z: u8): S { + let $f3 = x; + S{f1: y,f2: z,f3: $f3} + } + fun pack6(x: u8, y: u8, z: u8): S { + let $f3 = x; + let $f2 = y; + S{f1: z,f2: $f2,f3: $f3} + } +} + ============ initial bytecode ================ [variant baseline] -fun pack_unpack::pack1($t0: u8, $t1: u8, $t2: u8): pack_unpack::S { - var $t3: pack_unpack::S - 0: $t3 := pack pack_unpack::S($t0, $t1, $t2) +fun pack_unpack::pack1($t0: u8, $t1: u8, $t2: u8): 0x42::pack_unpack::S { + var $t3: 0x42::pack_unpack::S + 0: $t3 := pack 0x42::pack_unpack::S($t0, $t1, $t2) 1: return $t3 } [variant baseline] -fun pack_unpack::pack2($t0: u8, $t1: u8, $t2: u8): pack_unpack::S { - var $t3: pack_unpack::S +fun pack_unpack::pack2($t0: u8, $t1: u8, $t2: u8): 0x42::pack_unpack::S { + var $t3: 0x42::pack_unpack::S var $t4: u8 var $t5: u8 0: $t4 := infer($t0) 1: $t5 := infer($t1) - 2: $t3 := pack pack_unpack::S($t4, $t2, $t5) + 2: $t3 := pack 0x42::pack_unpack::S($t4, $t2, $t5) 3: return $t3 } [variant baseline] -fun pack_unpack::pack3($t0: u8, $t1: u8, $t2: u8): pack_unpack::S { - var $t3: pack_unpack::S +fun pack_unpack::pack3($t0: u8, $t1: u8, $t2: u8): 0x42::pack_unpack::S { + var $t3: 0x42::pack_unpack::S var $t4: u8 0: $t4 := infer($t0) - 1: $t3 := pack pack_unpack::S($t1, $t4, $t2) + 1: $t3 := pack 0x42::pack_unpack::S($t1, $t4, $t2) 2: return $t3 } [variant baseline] -fun pack_unpack::pack4($t0: u8, $t1: u8, $t2: u8): pack_unpack::S { - var $t3: pack_unpack::S +fun pack_unpack::pack4($t0: u8, $t1: u8, $t2: u8): 0x42::pack_unpack::S { + var $t3: 0x42::pack_unpack::S var $t4: u8 var $t5: u8 0: $t4 := infer($t0) 1: $t5 := infer($t1) - 2: $t3 := pack pack_unpack::S($t2, $t4, $t5) + 2: $t3 := pack 0x42::pack_unpack::S($t2, $t4, $t5) 3: return $t3 } [variant baseline] -fun pack_unpack::pack5($t0: u8, $t1: u8, $t2: u8): pack_unpack::S { - var $t3: pack_unpack::S +fun pack_unpack::pack5($t0: u8, $t1: u8, $t2: u8): 0x42::pack_unpack::S { + var $t3: 0x42::pack_unpack::S var $t4: u8 0: $t4 := infer($t0) - 1: $t3 := pack pack_unpack::S($t1, $t2, $t4) + 1: $t3 := pack 0x42::pack_unpack::S($t1, $t2, $t4) 2: return $t3 } [variant baseline] -fun pack_unpack::pack6($t0: u8, $t1: u8, $t2: u8): pack_unpack::S { - var $t3: pack_unpack::S +fun pack_unpack::pack6($t0: u8, $t1: u8, $t2: u8): 0x42::pack_unpack::S { + var $t3: 0x42::pack_unpack::S var $t4: u8 var $t5: u8 0: $t4 := infer($t0) 1: $t5 := infer($t1) - 2: $t3 := pack pack_unpack::S($t2, $t5, $t4) + 2: $t3 := pack 0x42::pack_unpack::S($t2, $t5, $t4) 3: return $t3 } diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/pack_unpack.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/pack_unpack.exp index 2bb77b7ee5e8e..50897a53c5ba0 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/pack_unpack.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/pack_unpack.exp @@ -5,12 +5,12 @@ module 0x42::pack_unpack { } struct S { f: u64, - g: pack_unpack::T, + g: 0x42::pack_unpack::T, } - private fun pack(x: u64,y: u64): pack_unpack::S { + private fun pack(x: u64,y: u64): S { pack pack_unpack::S(x, pack pack_unpack::T(y)) } - private fun unpack(s: pack_unpack::S): (u64, u64) { + private fun unpack(s: S): (u64, u64) { { let pack_unpack::S{ f, g: pack_unpack::T{ h } } = s; Tuple(f, h) @@ -18,27 +18,45 @@ module 0x42::pack_unpack { } } // end 0x42::pack_unpack +// -- Sourcified model before bytecode pipeline +module 0x42::pack_unpack { + struct T { + h: u64, + } + struct S { + f: u64, + g: T, + } + fun pack(x: u64, y: u64): S { + S{f: x,g: T{h: y}} + } + fun unpack(s: S): (u64, u64) { + let S{f: f,g: T{h: h}} = s; + (f, h) + } +} + ============ initial bytecode ================ [variant baseline] -fun pack_unpack::pack($t0: u64, $t1: u64): pack_unpack::S { - var $t2: pack_unpack::S - var $t3: pack_unpack::T - 0: $t3 := pack pack_unpack::T($t1) - 1: $t2 := pack pack_unpack::S($t0, $t3) +fun pack_unpack::pack($t0: u64, $t1: u64): 0x42::pack_unpack::S { + var $t2: 0x42::pack_unpack::S + var $t3: 0x42::pack_unpack::T + 0: $t3 := pack 0x42::pack_unpack::T($t1) + 1: $t2 := pack 0x42::pack_unpack::S($t0, $t3) 2: return $t2 } [variant baseline] -fun pack_unpack::unpack($t0: pack_unpack::S): (u64, u64) { +fun pack_unpack::unpack($t0: 0x42::pack_unpack::S): (u64, u64) { var $t1: u64 var $t2: u64 var $t3: u64 var $t4: u64 - var $t5: pack_unpack::T - 0: ($t3, $t5) := unpack pack_unpack::S($t0) - 1: $t4 := unpack pack_unpack::T($t5) + var $t5: 0x42::pack_unpack::T + 0: ($t3, $t5) := unpack 0x42::pack_unpack::S($t0) + 1: $t4 := unpack 0x42::pack_unpack::T($t5) 2: $t1 := infer($t3) 3: $t2 := infer($t4) 4: return ($t1, $t2) diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/reference_conversion.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/reference_conversion.exp index 406be0d625315..587b47b31883a 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/reference_conversion.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/reference_conversion.exp @@ -15,6 +15,19 @@ module 0x42::reference_conversion { } } // end 0x42::reference_conversion +// -- Sourcified model before bytecode pipeline +module 0x42::reference_conversion { + fun deref(r: &u64): u64 { + *r + } + fun use_it(): u64 { + let x = 42; + let r = &mut x; + *r = 43; + deref(/*freeze*/r) + } +} + ============ initial bytecode ================ [variant baseline] diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/spec_construct.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/spec_construct.exp index d304b793db035..906f7604749fa 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/spec_construct.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/spec_construct.exp @@ -5,26 +5,39 @@ module 0x42::m { k: u8, } struct S { - data: vector, + data: vector<0x42::m::E>, } - public fun foo(v: &m::S): u8 { - select m::E.k<&m::E>(vector::borrow(Borrow(Immutable)(select m::S.data<&m::S>(v)), 0)) + public fun foo(v: &S): u8 { + select m::E.k<&E>(vector::borrow(Borrow(Immutable)(select m::S.data<&S>(v)), 0)) } } // end 0x42::m +// -- Sourcified model before bytecode pipeline +module 0x42::m { + struct E { + k: u8, + } + struct S { + data: vector, + } + public fun foo(v: &S): u8 { + 0x1::vector::borrow(&v.data, 0).k + } +} + ============ initial bytecode ================ [variant baseline] -public fun m::foo($t0: &m::S): u8 { +public fun m::foo($t0: &0x42::m::S): u8 { var $t1: u8 - var $t2: &m::E - var $t3: &vector + var $t2: &0x42::m::E + var $t3: &vector<0x42::m::E> var $t4: u64 var $t5: &u8 - 0: $t3 := borrow_field.data($t0) + 0: $t3 := borrow_field<0x42::m::S>.data($t0) 1: $t4 := 0 - 2: $t2 := vector::borrow($t3, $t4) - 3: $t5 := borrow_field.k($t2) + 2: $t2 := vector::borrow<0x42::m::E>($t3, $t4) + 3: $t5 := borrow_field<0x42::m::E>.k($t2) 4: $t1 := read_ref($t5) 5: return $t1 } diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-commands/break_outside_loop.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-commands/break_outside_loop.exp index 65d9bf167c6fb..30aff0255e225 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-commands/break_outside_loop.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-commands/break_outside_loop.exp @@ -5,6 +5,13 @@ module _0 { } } // end _0 +// -- Sourcified model before bytecode pipeline +script { + fun main() { + break + } +} + Diagnostics: error: missing enclosing loop statement diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-commands/break_outside_loop_in_else.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-commands/break_outside_loop_in_else.exp index fd3592ca4a473..d527f8cbda14d 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-commands/break_outside_loop_in_else.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-commands/break_outside_loop_in_else.exp @@ -10,6 +10,13 @@ module _0 { } } // end _0 +// -- Sourcified model before bytecode pipeline +script { + fun main() { + if (false) () else break; + } +} + Diagnostics: error: missing enclosing loop statement diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-commands/break_outside_loop_in_if.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-commands/break_outside_loop_in_if.exp index 4ba118a1a902b..37b5c4c56ce10 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-commands/break_outside_loop_in_if.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-commands/break_outside_loop_in_if.exp @@ -9,6 +9,13 @@ module _0 { } } // end _0 +// -- Sourcified model before bytecode pipeline +script { + fun main() { + if (true) break + } +} + Diagnostics: error: missing enclosing loop statement diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-commands/continue_outside_loop.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-commands/continue_outside_loop.exp index dd49daa2df427..53b0d1c9d22b9 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-commands/continue_outside_loop.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-commands/continue_outside_loop.exp @@ -5,6 +5,13 @@ module _0 { } } // end _0 +// -- Sourcified model before bytecode pipeline +script { + fun main() { + continue + } +} + Diagnostics: error: missing enclosing loop statement diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-commands/continue_outside_loop_in_if.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-commands/continue_outside_loop_in_if.exp index 9bca0da5da53c..5d59d11e23937 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-commands/continue_outside_loop_in_if.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-commands/continue_outside_loop_in_if.exp @@ -10,6 +10,13 @@ module _0 { } } // end _0 +// -- Sourcified model before bytecode pipeline +script { + fun main() { + if (true) continue; + } +} + Diagnostics: error: missing enclosing loop statement diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-typing/global_invalid.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-typing/global_invalid.exp index 21c2baac2a0de..34f06097556ec 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-typing/global_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-typing/global_invalid.exp @@ -14,6 +14,15 @@ module 0x42::m { } } // end 0x42::m +// -- Sourcified model before bytecode pipeline +module 0x42::m { + fun invalid(addr: address) { + if (exists(addr)) () else abort 0; + let _ = borrow_global(addr); + move_from(addr); + } +} + Diagnostics: error: Expected a struct type. Global storage operations are restricted to struct types declared in the current module. Found: 'T' diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-typing/mutate_immutable.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-typing/mutate_immutable.exp index 6f70d7b27924b..232c30beb914d 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-typing/mutate_immutable.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/v1-typing/mutate_immutable.exp @@ -3,7 +3,7 @@ module 0x8675309::M { struct S { f: u64, } - private fun t0(s: &mut M::S) { + private fun t0(s: &mut S) { s = pack M::S(0); Borrow(Immutable)(0) = 1; { @@ -20,9 +20,24 @@ module 0x8675309::M { } } // end 0x8675309::M +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct S has drop { + f: u64, + } + fun t0(s: &mut S) { + *s = S{f: 0}; + *&0 = 1; + let x = 0; + let x_ref = &mut x; + let x_ref = /*freeze*/x_ref; + *x_ref = 0; + } +} + Diagnostics: -error: expected `&mut` but found `&M::S` +error: expected `&mut` but found `&S` ┌─ tests/bytecode-generator/v1-typing/mutate_immutable.move:5:11 │ 5 │ *(s: &S) = S { f: 0 }; diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/vector.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/vector.exp index 278b6ca0e9eda..8843ffc5a4ac7 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/vector.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/vector.exp @@ -5,6 +5,13 @@ module 0x42::vector { } } // end 0x42::vector +// -- Sourcified model before bytecode pipeline +module 0x42::vector { + fun create(): vector { + vector[1, 2, 3] + } +} + ============ initial bytecode ================ [variant baseline] diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard2.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard2.exp index dd31701d7fac8..ac8b896a9e622 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard2.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard2.exp @@ -11,6 +11,14 @@ module 0xc0ffee::m { } } // end 0xc0ffee::m +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::m { + public fun baz() { + let x; + let _ = x; + } +} + ============ initial bytecode ================ [variant baseline] diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard3.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard3.exp index 8b17531c4b9e8..d88443f618863 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard3.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard3.exp @@ -5,51 +5,64 @@ module 0xc0ffee::m { } public fun bar() { { - let s: m::S = pack m::S(false); + let s: S = pack m::S(false); { - let _: m::S = s; + let _: S = s; Tuple() } } } - public fun foo(s: m::S) { + public fun foo(s: S) { { - let _: m::S = s; + let _: S = s; Tuple() } } } // end 0xc0ffee::m +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::m { + struct S { + } + public fun bar() { + let s = S{}; + let _ = s; + } + public fun foo(s: S) { + let _ = s; + } +} + ============ initial bytecode ================ [variant baseline] public fun m::bar() { - var $t0: m::S + var $t0: 0xc0ffee::m::S var $t1: bool - var $t2: m::S + var $t2: 0xc0ffee::m::S 0: $t1 := false - 1: $t0 := pack m::S($t1) + 1: $t0 := pack 0xc0ffee::m::S($t1) 2: $t2 := infer($t0) 3: return () } [variant baseline] -public fun m::foo($t0: m::S) { - var $t1: m::S +public fun m::foo($t0: 0xc0ffee::m::S) { + var $t1: 0xc0ffee::m::S 0: $t1 := infer($t0) 1: return () } Diagnostics: -error: value of type `m::S` does not have the `drop` ability +error: value of type `S` does not have the `drop` ability ┌─ tests/bytecode-generator/wildcard3.move:5:13 │ 5 │ let _ = s; │ ^ implicitly dropped here since it is no longer used -error: value of type `m::S` does not have the `drop` ability +error: value of type `S` does not have the `drop` ability ┌─ tests/bytecode-generator/wildcard3.move:10:13 │ 10 │ let _ = s; diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard4.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard4.exp index 10580ab9b060f..60d6ee1b6c7c2 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard4.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard4.exp @@ -18,6 +18,17 @@ module 0xc0ffee::m { } } // end 0xc0ffee::m +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::m { + fun test() { + let x = 3; + let r = &mut x; + let y = &mut x; + let _ = /*freeze*/y; + *r = 4; + } +} + ============ initial bytecode ================ [variant baseline] diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard5.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard5.exp index 1608427e72ff7..44dca347d8756 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard5.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard5.exp @@ -6,7 +6,7 @@ module 0xc0ffee::m { } public fun test() { { - let s: m::S = pack m::S(3, 4); + let s: S = pack m::S(3, 4); { let m::S{ x: _, y: _ } = s; Tuple() @@ -15,19 +15,31 @@ module 0xc0ffee::m { } } // end 0xc0ffee::m +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::m { + struct S { + x: u64, + y: u64, + } + public fun test() { + let s = S{x: 3,y: 4}; + let S{x: _,y: _} = s; + } +} + ============ initial bytecode ================ [variant baseline] public fun m::test() { - var $t0: m::S + var $t0: 0xc0ffee::m::S var $t1: u64 var $t2: u64 var $t3: u64 var $t4: u64 0: $t1 := 3 1: $t2 := 4 - 2: $t0 := pack m::S($t1, $t2) - 3: ($t3, $t4) := unpack m::S($t0) + 2: $t0 := pack 0xc0ffee::m::S($t1, $t2) + 3: ($t3, $t4) := unpack 0xc0ffee::m::S($t0) 4: return () } diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard6.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard6.exp index a7e13399a8a0e..da81e9dba809e 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard6.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard6.exp @@ -11,6 +11,15 @@ module 0xc0ffee::m { } } // end 0xc0ffee::m +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::m { + public fun test2(): u64 { + let x = 40; + let (y,_) = (move x, x); + y + } +} + ============ initial bytecode ================ [variant baseline] diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard7.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard7.exp index 86431acca3905..255518c657e76 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard7.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard7.exp @@ -22,6 +22,16 @@ module 0xc0ffee::m { } } // end 0xc0ffee::m +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::m { + public fun test(): u8 { + let x = 40u8; + let y = move x; + let (_,q) = (x, 30); + y + } +} + ============ initial bytecode ================ [variant baseline] diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard8.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard8.exp index 5b6d62f20943e..f564b6003d986 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard8.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard8.exp @@ -11,6 +11,14 @@ module 0xc0ffee::m { } } // end 0xc0ffee::m +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::m { + public fun test() { + let x; + let (_,_) = (x, x); + } +} + ============ initial bytecode ================ [variant baseline] diff --git a/third_party/move/move-compiler-v2/tests/checking-lang-v1/entry_inline_err_no_report.exp b/third_party/move/move-compiler-v2/tests/checking-lang-v1/entry_inline_err_no_report.exp index 65d74465d64d0..3483724ff69a6 100644 --- a/third_party/move/move-compiler-v2/tests/checking-lang-v1/entry_inline_err_no_report.exp +++ b/third_party/move/move-compiler-v2/tests/checking-lang-v1/entry_inline_err_no_report.exp @@ -12,3 +12,16 @@ module 0x123::b { b::a() } } // end 0x123::b + +// -- Sourcified model before bytecode pipeline +module 0x123::a { + friend entry fun a() { + } +} +module 0x123::b { + entry fun a() { + } + fun b() { + a() + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking-lang-v1/eq_inline_typed.exp b/third_party/move/move-compiler-v2/tests/checking-lang-v1/eq_inline_typed.exp index 7eecb2c8d0891..13aa78ff14597 100644 --- a/third_party/move/move-compiler-v2/tests/checking-lang-v1/eq_inline_typed.exp +++ b/third_party/move/move-compiler-v2/tests/checking-lang-v1/eq_inline_typed.exp @@ -16,3 +16,12 @@ module 0x42::m { Tuple() } } // end 0x42::m + +// -- Sourcified model before bytecode pipeline +module 0x42::m { + inline fun foo(f: |&u64|) { + } + fun g() { + (); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking-lang-v1/use_struct_overlap_with_module.exp b/third_party/move/move-compiler-v2/tests/checking-lang-v1/use_struct_overlap_with_module.exp index 8b717c666f02b..e9e0328eb51f1 100644 --- a/third_party/move/move-compiler-v2/tests/checking-lang-v1/use_struct_overlap_with_module.exp +++ b/third_party/move/move-compiler-v2/tests/checking-lang-v1/use_struct_overlap_with_module.exp @@ -6,8 +6,21 @@ module 0x2::X { } // end 0x2::X module 0x2::M { use 0x2::X::{Self, S as X}; // resolved as: 0x2::X + struct A { + f1: 0x2::X::S, + f2: 0x2::X::S, + } +} // end 0x2::M + +// -- Sourcified model before bytecode pipeline +module 0x2::X { + struct S { + } +} +module 0x2::M { + use 0x2::X; struct A { f1: X::S, f2: X::S, } -} // end 0x2::M +} diff --git a/third_party/move/move-compiler-v2/tests/checking/abilities/tuple.exp b/third_party/move/move-compiler-v2/tests/checking/abilities/tuple.exp index 132846113b36a..2b347473d4478 100644 --- a/third_party/move/move-compiler-v2/tests/checking/abilities/tuple.exp +++ b/third_party/move/move-compiler-v2/tests/checking/abilities/tuple.exp @@ -3,13 +3,27 @@ module 0x42::tuple { struct S { f: u64, } - private fun tuple(x: u64): (u64, tuple::S) { + private fun tuple(x: u64): (u64, S) { Tuple(x, pack tuple::S(Add(x, 1))) } private fun use_tuple(x: u64): u64 { { - let (x: u64, tuple::S{ f: y }): (u64, tuple::S) = tuple::tuple(x); + let (x: u64, tuple::S{ f: y }): (u64, S) = tuple::tuple(x); Add(x, y) } } } // end 0x42::tuple + +// -- Sourcified model before bytecode pipeline +module 0x42::tuple { + struct S { + f: u64, + } + fun tuple(x: u64): (u64, S) { + (x, S{f: x + 1}) + } + fun use_tuple(x: u64): u64 { + let (x,S{f: y}) = tuple(x); + x + y + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraints.exp b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraints.exp index 93bcfd12e634f..dcaf90f90259f 100644 --- a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraints.exp +++ b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraints.exp @@ -125,75 +125,75 @@ module 0x42::M { let M::Ssk{ dummy_field: _ } = pack M::Ssk(false); { let M::Scds{ dummy_field: _ } = pack M::Scds(false); - M::c(); - M::c>(); - M::c, M::S>>(); - M::d(); - M::d>(); - M::d, M::S>>(); - M::s(); - M::s(); - M::s>(); - M::s>(); - M::s, M::S>>(); - M::s>>>(); - M::k(); - M::k>(); - M::k>>(); - M::k>>>(); - M::sk(); - M::sk>(); - M::sk>>(); - M::sk>>>(); - M::cds(); - M::cds>(); - M::cds, M::S>>(); + M::c(); + M::c>(); + M::c, S>>(); + M::d(); + M::d>(); + M::d, S>>(); + M::s(); + M::s(); + M::s>(); + M::s>(); + M::s, S>>(); + M::s>>>(); + M::k(); + M::k>(); + M::k>>(); + M::k>>>(); + M::sk(); + M::sk>(); + M::sk>>(); + M::sk>>>(); + M::cds(); + M::cds>(); + M::cds, S>>(); { - let M::Sc{ dummy_field: _ } = pack M::Sc(false); + let M::Sc{ dummy_field: _ } = pack M::Sc(false); { - let M::Sc>{ dummy_field: _ } = pack M::Sc>(false); + let M::Sc>{ dummy_field: _ } = pack M::Sc>(false); { - let M::Sc, M::S>>{ dummy_field: _ } = pack M::Sc, M::S>>(false); + let M::Sc, S>>{ dummy_field: _ } = pack M::Sc, S>>(false); { - let M::Sd{ dummy_field: _ } = pack M::Sd(false); + let M::Sd{ dummy_field: _ } = pack M::Sd(false); { - let M::Sd>{ dummy_field: _ } = pack M::Sd>(false); + let M::Sd>{ dummy_field: _ } = pack M::Sd>(false); { - let M::Sd, M::S>>{ dummy_field: _ } = pack M::Sd, M::S>>(false); + let M::Sd, S>>{ dummy_field: _ } = pack M::Sd, S>>(false); { - let M::Ss{ dummy_field: _ } = pack M::Ss(false); + let M::Ss{ dummy_field: _ } = pack M::Ss(false); { - let M::Ss{ dummy_field: _ } = pack M::Ss(false); + let M::Ss{ dummy_field: _ } = pack M::Ss(false); { - let M::Ss>{ dummy_field: _ } = pack M::Ss>(false); + let M::Ss>{ dummy_field: _ } = pack M::Ss>(false); { - let M::Ss>{ dummy_field: _ } = pack M::Ss>(false); + let M::Ss>{ dummy_field: _ } = pack M::Ss>(false); { - let M::Ss, M::S>>{ dummy_field: _ } = pack M::Ss, M::S>>(false); + let M::Ss, S>>{ dummy_field: _ } = pack M::Ss, S>>(false); { - let M::Ss>>>{ dummy_field: _ } = pack M::Ss>>>(false); + let M::Ss>>>{ dummy_field: _ } = pack M::Ss>>>(false); { - let M::Sk{ dummy_field: _ } = pack M::Sk(false); + let M::Sk{ dummy_field: _ } = pack M::Sk(false); { - let M::Sk>{ dummy_field: _ } = pack M::Sk>(false); + let M::Sk>{ dummy_field: _ } = pack M::Sk>(false); { - let M::Sk>>{ dummy_field: _ } = pack M::Sk>>(false); + let M::Sk>>{ dummy_field: _ } = pack M::Sk>>(false); { - let M::Sk>>>{ dummy_field: _ } = pack M::Sk>>>(false); + let M::Sk>>>{ dummy_field: _ } = pack M::Sk>>>(false); { - let M::Ssk{ dummy_field: _ } = pack M::Ssk(false); + let M::Ssk{ dummy_field: _ } = pack M::Ssk(false); { - let M::Ssk>{ dummy_field: _ } = pack M::Ssk>(false); + let M::Ssk>{ dummy_field: _ } = pack M::Ssk>(false); { - let M::Ssk>>{ dummy_field: _ } = pack M::Ssk>>(false); + let M::Ssk>>{ dummy_field: _ } = pack M::Ssk>>(false); { - let M::Ssk>>>{ dummy_field: _ } = pack M::Ssk>>>(false); + let M::Ssk>>>{ dummy_field: _ } = pack M::Ssk>>>(false); { - let M::Scds{ dummy_field: _ } = pack M::Scds(false); + let M::Scds{ dummy_field: _ } = pack M::Scds(false); { - let M::Scds>{ dummy_field: _ } = pack M::Scds>(false); + let M::Scds>{ dummy_field: _ } = pack M::Scds>(false); { - let M::Scds, M::S>>{ dummy_field: _ } = pack M::Scds, M::S>>(false); + let M::Scds, S>>{ dummy_field: _ } = pack M::Scds, S>>(false); Tuple() } } @@ -245,3 +245,140 @@ module 0x42::M { } } } // end 0x42::M + +// -- Sourcified model before bytecode pipeline +module 0x42::M { + struct Box has copy, drop, store, key { + f: T, + } + struct Pair has copy, drop, store, key { + f1: T1, + f2: T2, + } + struct R has store, key { + } + struct S has copy, drop, store, key { + } + struct Sc { + } + struct Scds { + } + struct Sd { + } + struct Sk { + } + struct Ss { + } + struct Ssk { + } + fun c() { + } + fun cds() { + } + fun d() { + } + fun k() { + } + fun s() { + } + fun sk() { + } + fun t1() { + c(); + d(); + s(); + cds
(); + c>(); + d>(); + s>(); + cds>(); + let Sc{} = Sc{}; + let Sd{} = Sd{}; + let Ss{} = Ss{}; + let Scds
{} = Scds
{}; + let Sc>{} = Sc>{}; + let Sd>{} = Sd>{}; + let Ss>{} = Ss>{}; + let Scds>{} = Scds>{}; + c(); + c(); + c(); + c(); + d(); + d(); + d(); + d(); + s(); + s(); + s(); + s(); + s(); + k(); + k(); + sk(); + cds(); + let Sc{} = Sc{}; + let Sc{} = Sc{}; + let Sc{} = Sc{}; + let Sc{} = Sc{}; + let Sd{} = Sd{}; + let Sd{} = Sd{}; + let Sd{} = Sd{}; + let Sd{} = Sd{}; + let Ss{} = Ss{}; + let Ss{} = Ss{}; + let Ss{} = Ss{}; + let Ss{} = Ss{}; + let Ss{} = Ss{}; + let Sk{} = Sk{}; + let Sk{} = Sk{}; + let Ssk{} = Ssk{}; + let Scds{} = Scds{}; + c(); + c>(); + c, S>>(); + d(); + d>(); + d, S>>(); + s(); + s(); + s>(); + s>(); + s, S>>(); + s>>>(); + k(); + k>(); + k>>(); + k>>>(); + sk(); + sk>(); + sk>>(); + sk>>>(); + cds(); + cds>(); + cds, S>>(); + let Sc{} = Sc{}; + let Sc>{} = Sc>{}; + let Sc, S>>{} = Sc, S>>{}; + let Sd{} = Sd{}; + let Sd>{} = Sd>{}; + let Sd, S>>{} = Sd, S>>{}; + let Ss{} = Ss{}; + let Ss{} = Ss{}; + let Ss>{} = Ss>{}; + let Ss>{} = Ss>{}; + let Ss, S>>{} = Ss, S>>{}; + let Ss>>>{} = Ss>>>{}; + let Sk{} = Sk{}; + let Sk>{} = Sk>{}; + let Sk>>{} = Sk>>{}; + let Sk>>>{} = Sk>>>{}; + let Ssk{} = Ssk{}; + let Ssk>{} = Ssk>{}; + let Ssk>>{} = Ssk>>{}; + let Ssk>>>{} = Ssk>>>{}; + let Scds{} = Scds{}; + let Scds>{} = Scds>{}; + let Scds, S>>{} = Scds, S>>{}; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_param_op_abilities.exp b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_param_op_abilities.exp index 438f27a7322ab..21ea211538722 100644 --- a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_param_op_abilities.exp +++ b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_param_op_abilities.exp @@ -18,33 +18,79 @@ module 0x42::M { struct RequireStore { a: #0, } - private fun f1(ref: &mut M::HasDrop) { - ref = pack M::HasDrop(1); + private fun f1(ref: &mut HasDrop) { + ref = pack M::HasDrop(1); Tuple() } private fun f2() { - _: M::HasDrop = pack M::HasDrop(1); + _: HasDrop = pack M::HasDrop(1); Tuple() } - private fun f3(_x: M::HasDrop) { + private fun f3(_x: HasDrop) { Tuple() } - private fun f4(x: M::HasCopy): (M::HasCopy, M::HasCopy) { + private fun f4(x: HasCopy): (HasCopy, HasCopy) { Tuple(Copy(x), x) } - private fun f5(s: &signer,x: M::HasKey) { - MoveTo>(s, x); + private fun f5(s: &signer,x: HasKey) { + MoveTo>(s, x); Tuple() } - private fun f6(): M::HasKey - acquires M::HasKey(*) + private fun f6(): HasKey + acquires 0x42::M::HasKey(*) { - MoveFrom>(0x0) + MoveFrom>(0x0) } private fun f7(): bool { - exists>(0x0) + exists>(0x0) } - private fun f8(): M::RequireStore> { - pack M::RequireStore>(pack M::HasStore(1)) + private fun f8(): RequireStore> { + pack M::RequireStore>(pack M::HasStore(1)) } } // end 0x42::M + +// -- Sourcified model before bytecode pipeline +module 0x42::M { + struct HasCopy has copy { + a: T2, + } + struct HasDrop has drop { + a: T2, + } + struct HasKey has key { + a: T2, + } + struct HasStore has store { + a: T2, + } + struct NoAbilities { + } + struct RequireStore { + a: T, + } + fun f1(ref: &mut HasDrop) { + *ref = HasDrop{a: 1}; + } + fun f2() { + _ = HasDrop{a: 1}; + } + fun f3(_x: HasDrop) { + } + fun f4(x: HasCopy): (HasCopy, HasCopy) { + (copy x, x) + } + fun f5(s: &signer, x: HasKey) { + move_to>(s, x); + } + fun f6(): HasKey + acquires HasKey + { + move_from>(0x0) + } + fun f7(): bool { + exists>(0x0) + } + fun f8(): RequireStore> { + RequireStore>{a: HasStore{a: 1}} + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_params_constraint_abilities.exp b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_params_constraint_abilities.exp index cbc230acd5142..5666042391855 100644 --- a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_params_constraint_abilities.exp +++ b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_params_constraint_abilities.exp @@ -22,7 +22,7 @@ module 0x42::M { a: #0, } struct S2 { - a: M::S1>, + a: 0x42::M::S1<0x42::M::HasAbilities<0x42::M::NoAbilities, u64>>, } struct S3 { a: #0, @@ -31,20 +31,67 @@ module 0x42::M { d: #3, } struct S4 { - a: M::S3, M::HasCopy, M::HasStore, M::HasKey>, + a: 0x42::M::S3<0x42::M::HasDrop<0x42::M::NoAbilities, u64>, 0x42::M::HasCopy<0x42::M::NoAbilities, u64>, 0x42::M::HasStore<0x42::M::NoAbilities, u64>, 0x42::M::HasKey<0x42::M::NoAbilities, u64>>, } private fun f1() { Tuple() } private fun f2() { - M::f1>(); + M::f1>(); Tuple() } private fun f3() { Tuple() } private fun f4() { - M::f3, M::HasCopy, M::HasStore, M::HasKey>(); + M::f3, HasCopy, HasStore, HasKey>(); Tuple() } } // end 0x42::M + +// -- Sourcified model before bytecode pipeline +module 0x42::M { + struct HasAbilities has copy, drop, store, key { + a: T2, + } + struct HasCopy has copy { + a: T2, + } + struct HasDrop has drop { + a: T2, + } + struct HasKey has key { + a: T2, + } + struct HasStore has store { + a: T2, + } + struct NoAbilities { + a: bool, + } + struct S1 { + a: T, + } + struct S2 { + a: S1>, + } + struct S3 { + a: T1, + b: T2, + c: T3, + d: T4, + } + struct S4 { + a: S3, HasCopy, HasStore, HasKey>, + } + fun f1() { + } + fun f2() { + f1>(); + } + fun f3() { + } + fun f4() { + f3,HasCopy,HasStore,HasKey>(); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_params_field_abilities.exp b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_params_field_abilities.exp index bfa5c712d716a..c9c9943eb3973 100644 --- a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_params_field_abilities.exp +++ b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_params_field_abilities.exp @@ -16,15 +16,45 @@ module 0x42::M { dummy_field: bool, } struct S1 { - a: M::HasDrop, + a: 0x42::M::HasDrop<0x42::M::NoAbilities, u64>, } struct S2 { - a: M::HasCopy, + a: 0x42::M::HasCopy<0x42::M::NoAbilities, u64>, } struct S3 { - a: M::HasStore, + a: 0x42::M::HasStore<0x42::M::NoAbilities, u64>, } struct S4 { - a: M::HasStore, + a: 0x42::M::HasStore<0x42::M::NoAbilities, u64>, } } // end 0x42::M + +// -- Sourcified model before bytecode pipeline +module 0x42::M { + struct HasCopy has copy { + a: T2, + } + struct HasDrop has drop { + a: T2, + } + struct HasKey has key { + a: T2, + } + struct HasStore has store { + a: T2, + } + struct NoAbilities { + } + struct S1 has drop { + a: HasDrop, + } + struct S2 has copy { + a: HasCopy, + } + struct S3 has store { + a: HasStore, + } + struct S4 has key { + a: HasStore, + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/access_specifiers/access_ok.exp b/third_party/move/move-compiler-v2/tests/checking/access_specifiers/access_ok.exp index b2e3bc2231280..6482442cfa288 100644 --- a/third_party/move/move-compiler-v2/tests/checking/access_specifiers/access_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/access_specifiers/access_ok.exp @@ -33,7 +33,7 @@ module 0x42::m { dummy_field: bool, } private fun f1() - acquires m::S(*) + acquires 0x42::m::S(*) { Tuple() } @@ -53,17 +53,17 @@ module 0x42::m { Tuple() } private fun f2() - reads m::S(*) + reads 0x42::m::S(*) { Tuple() } private fun f3() - writes m::S(*) + writes 0x42::m::S(*) { Tuple() } private fun f4() - acquires m::S(*) + acquires 0x42::m::S(*) { Tuple() } @@ -93,11 +93,11 @@ module 0x42::m { Tuple() } private fun f_multiple() - acquires m::R(*) - reads m::R(*) - writes m::T(*) - writes m::S(*) - reads m::G(*) + acquires 0x42::m::R(*) + reads 0x42::m::R(*) + writes 0x42::m::T(*) + writes 0x42::m::S(*) + reads 0x42::m::G(*) { Tuple() } @@ -105,3 +105,75 @@ module 0x42::m { 0x42 } } // end 0x42::m + +// -- Sourcified model before bytecode pipeline +module 0x42::m { + struct T has store { + } + struct G has store { + } + struct R has store { + } + struct S has store { + } + fun f1() + acquires S + { + } + fun f10(x: u64) + acquires *(m::make_up_address(x)) + + { + } + fun f11() + !reads *(0x42) + !reads *(0x43) + + { + } + fun f12() + + { + } + fun f2() + reads S + { + } + fun f3() + writes S + { + } + fun f4() + acquires S + { + } + fun f5() + acquires 0x42::* + { + } + fun f6() + acquires 0x42::m::* + { + } + fun f7() + acquires * + { + } + fun f8() + acquires *(0x42) + + { + } + fun f9(a: address) + acquires *(a) + + { + } + fun f_multiple() + acquires Rreads Rwrites Twrites Sreads G + { + } + fun make_up_address(x: u64): address { + 0x42 + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/access_specifiers/acquires_list_generic.exp b/third_party/move/move-compiler-v2/tests/checking/access_specifiers/acquires_list_generic.exp index fa0d50a8ea13d..1c78e50c8f0b2 100644 --- a/third_party/move/move-compiler-v2/tests/checking/access_specifiers/acquires_list_generic.exp +++ b/third_party/move/move-compiler-v2/tests/checking/access_specifiers/acquires_list_generic.exp @@ -10,8 +10,23 @@ module 0x42::M { dummy_field: bool, } private fun foo() - acquires M::B>(*) + acquires 0x42::M::B<0x42::M::CupC<0x42::M::R>>(*) { Abort(0) } } // end 0x42::M + +// -- Sourcified model before bytecode pipeline +module 0x42::M { + struct B { + } + struct CupC { + } + struct R { + } + fun foo() + acquires B> + { + abort 0 + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/attributes/aptos_stdlib_attributes2.exp b/third_party/move/move-compiler-v2/tests/checking/attributes/aptos_stdlib_attributes2.exp index 094f58d19cec5..0b0e0375c67f8 100644 --- a/third_party/move/move-compiler-v2/tests/checking/attributes/aptos_stdlib_attributes2.exp +++ b/third_party/move/move-compiler-v2/tests/checking/attributes/aptos_stdlib_attributes2.exp @@ -15,3 +15,11 @@ module 0x1::M { Tuple() } } // end 0x1::M + +// -- Sourcified model before bytecode pipeline +module 0x1::M { + fun bar() { + } + fun foo() { + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/attributes/attribute_placement.exp b/third_party/move/move-compiler-v2/tests/checking/attributes/attribute_placement.exp index 9798299691c27..082f863b09a34 100644 --- a/third_party/move/move-compiler-v2/tests/checking/attributes/attribute_placement.exp +++ b/third_party/move/move-compiler-v2/tests/checking/attributes/attribute_placement.exp @@ -106,3 +106,24 @@ module _0 { Tuple() } } // end _0 + +// -- Sourcified model before bytecode pipeline +module 0x42::N { + friend 0x42::M; + public fun bar() { + } +} +module 0x42::M { + use 0x42::N; + struct S { + } + public fun foo() { + N::bar() + } +} +script { + use 0x42::M; + fun main() { + M::foo(); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/attributes/attribute_variants.exp b/third_party/move/move-compiler-v2/tests/checking/attributes/attribute_variants.exp index c8f499f0d0cbe..9f6a73399eca2 100644 --- a/third_party/move/move-compiler-v2/tests/checking/attributes/attribute_variants.exp +++ b/third_party/move/move-compiler-v2/tests/checking/attributes/attribute_variants.exp @@ -63,3 +63,7 @@ warning: unknown attribute // -- Model dump before bytecode pipeline module 0x42::M { } // end 0x42::M + +// -- Sourcified model before bytecode pipeline +module 0x42::M { +} diff --git a/third_party/move/move-compiler-v2/tests/checking/control_flow/loop_after_loop.exp b/third_party/move/move-compiler-v2/tests/checking/control_flow/loop_after_loop.exp index 08bf31d7ac079..74054ff1f182e 100644 --- a/third_party/move/move-compiler-v2/tests/checking/control_flow/loop_after_loop.exp +++ b/third_party/move/move-compiler-v2/tests/checking/control_flow/loop_after_loop.exp @@ -9,3 +9,11 @@ module _0 { } } } // end _0 + +// -- Sourcified model before bytecode pipeline +script { + fun main() { + loop break; + loop () + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/dotdot/dotdot_valid.exp b/third_party/move/move-compiler-v2/tests/checking/dotdot/dotdot_valid.exp index cd061f4b76d74..8de9c715617c4 100644 --- a/third_party/move/move-compiler-v2/tests/checking/dotdot/dotdot_valid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/dotdot/dotdot_valid.exp @@ -10,7 +10,7 @@ module 0x42::test { } C { x: u8, - y: test::S1, + y: 0x42::test::S1, } } struct S0 { @@ -21,7 +21,7 @@ module 0x42::test { } struct S2 { 0: bool, - 1: test::S0, + 1: 0x42::test::S0, } struct S3 { x: bool, @@ -29,7 +29,7 @@ module 0x42::test { } struct S4 { x: #0, - y: test::S3, + y: 0x42::test::S3, } struct S5 { 0: #0, @@ -45,13 +45,13 @@ module 0x42::test { 2: u32, 3: u64, } - private inline fun lambda_param(f: |test::S2|bool): bool { + private inline fun lambda_param(f: |S2|bool): bool { { - let x: test::S2 = pack test::S2(true, pack test::S0(false)); + let x: S2 = pack test::S2(true, pack test::S0(false)); (f)(x) } } - private fun nested1(x: test::S4) { + private fun nested1(x: S4) { { let test::S4{ x: _x, y: _ } = x; { @@ -75,7 +75,7 @@ module 0x42::test { } } } - private fun nested1_ref(x: &test::S4) { + private fun nested1_ref(x: &S4) { { let test::S4{ x: _x, y: _ } = x; { @@ -99,67 +99,67 @@ module 0x42::test { } } } - private fun nested2(x: test::S5) { + private fun nested2(x: S5) { { - let test::S5{ 0: _, 1: test::S1{ 0: _ } } = x; + let test::S5{ 0: _, 1: test::S1{ 0: _ } } = x; Tuple() } } - private fun nested2_ref(x: &test::S5) { + private fun nested2_ref(x: &S5) { { - let test::S5{ 0: _, 1: test::S1{ 0: _ } } = x; + let test::S5{ 0: _, 1: test::S1{ 0: _ } } = x; Tuple() } } - private fun nested3(x: test::S5>) { + private fun nested3(x: S5>) { { - let test::S5>{ 0: _, 1: test::S4{ x: _, y: _ } } = x; + let test::S5>{ 0: _, 1: test::S4{ x: _, y: _ } } = x; Tuple() } } - private fun nested3_ref(x: &test::S5>) { + private fun nested3_ref(x: &S5>) { { - let test::S5>{ 0: _, 1: test::S4{ x: _, y: _ } } = x; + let test::S5>{ 0: _, 1: test::S4{ x: _, y: _ } } = x; Tuple() } } - private fun nested4(x: test::S4) { + private fun nested4(x: S4) { { - let test::S4{ x: test::S1{ 0: _ }, y: _ } = x; + let test::S4{ x: test::S1{ 0: _ }, y: _ } = x; Tuple() } } - private fun nested4_ref(x: &test::S4) { + private fun nested4_ref(x: &S4) { { - let test::S4{ x: test::S1{ 0: _ }, y: _ } = x; + let test::S4{ x: test::S1{ 0: _ }, y: _ } = x; Tuple() } } - private fun simple_0(x: test::S0) { + private fun simple_0(x: S0) { { let test::S0{ dummy_field: _ } = x; Tuple() } } - private fun simple_0_ref(x: &test::S0) { + private fun simple_0_ref(x: &S0) { { let test::S0{ dummy_field: _ } = x; Tuple() } } - private fun simple_1(x: test::S1) { + private fun simple_1(x: S1) { { let test::S1{ 0: _ } = x; Tuple() } } - private fun simple_1_ref(x: &mut test::S1) { + private fun simple_1_ref(x: &mut S1) { { let test::S1{ 0: _ } = x; Tuple() } } - private fun simple_2(x: test::S2) { + private fun simple_2(x: S2) { { let test::S2{ 0: _, 1: _ } = x; { @@ -186,7 +186,7 @@ module 0x42::test { } } } - private fun simple_2_ref(x: &test::S2) { + private fun simple_2_ref(x: &S2) { { let test::S2{ 0: _, 1: _ } = x; { @@ -213,7 +213,7 @@ module 0x42::test { } } } - private fun simple_3(x: test::S3) { + private fun simple_3(x: S3) { { let test::S3{ x: _, y: _ } = x; { @@ -225,7 +225,7 @@ module 0x42::test { } } } - private fun simple_3_ref(x: test::S3) { + private fun simple_3_ref(x: S3) { { let test::S3{ x: _, y: _ } = x; { @@ -237,7 +237,7 @@ module 0x42::test { } } } - private fun simple_4(x: test::E1): u8 { + private fun simple_4(x: E1): u8 { match (x) { test::E1::A{ 0: x, 1: _ } => { x @@ -251,7 +251,7 @@ module 0x42::test { } } - private fun simple_4_ref(x: &test::E1): &u8 { + private fun simple_4_ref(x: &E1): &u8 { match (x) { test::E1::A{ 0: x, 1: _ } => { x @@ -262,7 +262,7 @@ module 0x42::test { } } - private fun simple_5(x: test::E1): u8 { + private fun simple_5(x: E1): u8 { match (x) { test::E1::A{ 0: _, 1: y } => { if y { @@ -280,7 +280,7 @@ module 0x42::test { } } - private fun simple_6(x: &test::S7) { + private fun simple_6(x: &S7) { { let test::S7{ 0: _w, 1: _, 2: _, 3: _z } = x; { @@ -291,15 +291,174 @@ module 0x42::test { } private fun test_lambda_param(): bool { { - let x: test::S2 = pack test::S2(true, pack test::S0(false)); + let x: S2 = pack test::S2(true, pack test::S0(false)); { - let (test::S2{ 0: x, 1: _ }): (test::S2) = Tuple(x); + let (test::S2{ 0: x, 1: _ }): (S2) = Tuple(x); x } } } } // end 0x42::test +// -- Sourcified model before bytecode pipeline +module 0x42::test { + enum E1 has drop { + A { + 0: u8, + 1: bool, + } + B { + 0: u8, + } + C { + x: u8, + y: S1, + } + } + struct S0 has copy { + } + struct S1 has copy, drop { + 0: u8, + } + struct S2 has copy { + 0: bool, + 1: S0, + } + struct S3 has copy { + x: bool, + y: u8, + } + struct S4 has copy { + x: T, + y: S3, + } + struct S5 { + 0: T, + 1: U, + } + struct S6 { + x: T, + y: U, + } + struct S7 { + 0: u8, + 1: u16, + 2: u32, + 3: u64, + } + inline fun lambda_param(f: |S2|bool): bool { + let x = S2(true,S0{}); + f(x) + } + fun nested1(x: S4) { + let S4{x: _x,y: _} = x; + let S4{x: _,y: _y} = x; + let S4{x: _,y: S3{x: _,y: _}} = x; + let S4{x: _,y: S3{x: _x,y: _}} = x; + let S4{x: _x2,y: S3{x: _x1,y: _}} = x; + let S4{x: _,y: S3{x: _,y: _y}} = x; + let S4{x: _x2,y: S3{x: _x1,y: _}} = x; + } + fun nested1_ref(x: &S4) { + let S4{x: _x,y: _} = x; + let S4{x: _,y: _y} = x; + let S4{x: _,y: S3{x: _,y: _}} = x; + let S4{x: _,y: S3{x: _x,y: _}} = x; + let S4{x: _x2,y: S3{x: _x1,y: _}} = x; + let S4{x: _,y: S3{x: _,y: _y}} = x; + let S4{x: _x2,y: S3{x: _x1,y: _}} = x; + } + fun nested2(x: S5) { + let S5(_,S1(_)) = x; + } + fun nested2_ref(x: &S5) { + let S5(_,S1(_)) = x; + } + fun nested3(x: S5>) { + let S5>(_,S4{x: _,y: _}) = x; + } + fun nested3_ref(x: &S5>) { + let S5>(_,S4{x: _,y: _}) = x; + } + fun nested4(x: S4) { + let S4{x: S1(_),y: _} = x; + } + fun nested4_ref(x: &S4) { + let S4{x: S1(_),y: _} = x; + } + fun simple_0(x: S0) { + let S0{} = x; + } + fun simple_0_ref(x: &S0) { + let S0{} = x; + } + fun simple_1(x: S1) { + let S1(_) = x; + } + fun simple_1_ref(x: &mut S1) { + let S1(_) = x; + } + fun simple_2(x: S2) { + let S2(_,_) = x; + let S2(_x,_) = x; + let S2(_,_x) = x; + let S2(_,_) = x; + let S2(_,_) = x; + let S2(_x,_y) = x; + let S2(_x,_y) = x; + let S2(_x,_y) = x; + } + fun simple_2_ref(x: &S2) { + let S2(_,_) = x; + let S2(_x,_) = x; + let S2(_,_x) = x; + let S2(_,_) = x; + let S2(_,_) = x; + let S2(_x,_y) = x; + let S2(_x,_y) = x; + let S2(_x,_y) = x; + } + fun simple_3(x: S3) { + let S3{x: _,y: _} = x; + let S3{x: _x,y: _} = x; + let S3{x: _,y: _y} = x; + } + fun simple_3_ref(x: S3) { + let S3{x: _,y: _} = x; + let S3{x: _x,y: _} = x; + let S3{x: _,y: _y} = x; + } + fun simple_4(x: E1): u8 { + match (x) { + E1::A(x,_) => x, + E1::B(x) => x, + E1::C{x: x,y: _} => x, + } + } + fun simple_4_ref(x: &E1): &u8 { + match (x) { + E1::A(x,_) => x, + E1::B(x) => x, + } + } + fun simple_5(x: E1): u8 { + match (x) { + E1::A(_,y) => if (y) 1u8 else 0u8, + E1::B(x) => x, + E1::C{x: _,y: S1(x)} => x, + } + } + fun simple_6(x: &S7) { + let S7(_w,_,_,_z) = x; + let S7(_w,_x,_y,_z) = x; + } + fun test_lambda_param(): bool { + let x = S2(true,S0{}); + let (S2(x,_)) = (x); + x + } +} + Diagnostics: error: match not exhaustive diff --git a/third_party/move/move-compiler-v2/tests/checking/dotdot/extra_dotdot.exp b/third_party/move/move-compiler-v2/tests/checking/dotdot/extra_dotdot.exp index d772036e3fe4c..cf7a808320552 100644 --- a/third_party/move/move-compiler-v2/tests/checking/dotdot/extra_dotdot.exp +++ b/third_party/move/move-compiler-v2/tests/checking/dotdot/extra_dotdot.exp @@ -10,7 +10,7 @@ module 0x42::test { 1: u8, 2: address, } - private fun extra_dotdot(x: test::S,y: test::T) { + private fun extra_dotdot(x: S,y: T) { { let test::S{ 0: _x, 1: _, 2: _ } = x; { @@ -26,3 +26,23 @@ module 0x42::test { } } } // end 0x42::test + +// -- Sourcified model before bytecode pipeline +module 0x42::test { + struct T { + x: bool, + y: u8, + z: address, + } + struct S { + 0: bool, + 1: u8, + 2: address, + } + fun extra_dotdot(x: S, y: T) { + let S(_x,_,_) = x; + let S(_,_,_) = x; + let S(_,_,_) = x; + let T{x: _,y: _,z: _} = y; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/indexing/examples_book.exp b/third_party/move/move-compiler-v2/tests/checking/indexing/examples_book.exp index db8a5d33f66f5..225201e7eb6d2 100644 --- a/third_party/move/move-compiler-v2/tests/checking/indexing/examples_book.exp +++ b/third_party/move/move-compiler-v2/tests/checking/indexing/examples_book.exp @@ -4,18 +4,18 @@ module 0x1::m { value: bool, } private fun f1() - acquires m::R(*) + acquires 0x1::m::R(*) { { - let x: &mut m::R = BorrowGlobal(Mutable)(0x1); - select m::R.value<&mut m::R>(x) = false; - if Eq(select m::R.value(BorrowGlobal(Immutable)(0x1)), false) { + let x: &mut R = BorrowGlobal(Mutable)(0x1); + select m::R.value<&mut R>(x) = false; + if Eq(select m::R.value(BorrowGlobal(Immutable)(0x1)), false) { Tuple() } else { Abort(1) }; - select m::R.value(BorrowGlobal(Mutable)(0x1)) = true; - if Eq(select m::R.value(BorrowGlobal(Immutable)(0x1)), true) { + select m::R.value(BorrowGlobal(Mutable)(0x1)) = true; + if Eq(select m::R.value(BorrowGlobal(Immutable)(0x1)), true) { Tuple() } else { Abort(2) @@ -24,3 +24,19 @@ module 0x1::m { } } } // end 0x1::m + +// -- Sourcified model before bytecode pipeline +module 0x1::m { + struct R has drop, key { + value: bool, + } + fun f1() + acquires R + { + let x = borrow_global_mut(0x1); + x.value = false; + if (borrow_global(0x1).value == false) () else abort 1; + borrow_global_mut(0x1).value = true; + if (borrow_global(0x1).value == true) () else abort 2; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/bug_11112.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/bug_11112.exp index 2d26e677fd493..fb79d81744afa 100644 --- a/third_party/move/move-compiler-v2/tests/checking/inlining/bug_11112.exp +++ b/third_party/move/move-compiler-v2/tests/checking/inlining/bug_11112.exp @@ -35,5 +35,26 @@ module 0xcafe::vectors { } } // end 0xcafe::vectors +// -- Sourcified model before bytecode pipeline +module 0xcafe::vectors { + fun test_for_each_mut() { + let v = vector[1, 2, 3]; + let s = 2; + { + let (v) = (&mut v); + let i = 0; + while (i < 0x1::vector::length(/*freeze*/v)) { + { + let (e) = (0x1::vector::borrow_mut(v, i)); + *e = s; + s = s + 1 + }; + i = i + 1 + } + }; + if (v == vector[2, 3, 4]) () else abort 0; + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/bug_11223.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/bug_11223.exp index 88ecb0c6d4f29..cd772a8c8663b 100644 --- a/third_party/move/move-compiler-v2/tests/checking/inlining/bug_11223.exp +++ b/third_party/move/move-compiler-v2/tests/checking/inlining/bug_11223.exp @@ -18,5 +18,16 @@ module 0xcafe::vectors { } } // end 0xcafe::vectors +// -- Sourcified model before bytecode pipeline +module 0xcafe::vectors { + public entry fun guess_flips_break2(flips: vector): u64 { + let flipsref5 = &flips; + let _v = copy flips; + let _v2 = flips; + let x = flipsref5; + 0x1::vector::length(x) + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/bug_9717.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/bug_9717.exp index 6f66dccff2e22..5462c607e72ad 100644 --- a/third_party/move/move-compiler-v2/tests/checking/inlining/bug_9717.exp +++ b/third_party/move/move-compiler-v2/tests/checking/inlining/bug_9717.exp @@ -169,5 +169,80 @@ module 0xcafe::vectors { } } // end 0xcafe::vectors +// -- Sourcified model before bytecode pipeline +module 0xcafe::vectors { + public entry fun guess_flips(flips: vector) { + { + let (flips) = (&flips); + let i = 0; + while (i < 0x1::vector::length(flips)) { + if (*0x1::vector::borrow(flips, i) != 0u8) break; + i = i + 1; + }; + }; + let _v = copy flips; + let _v2 = flips; + } + public entry fun guess_flips_directly(flips: vector) { + let i = 0; + while (i < 0x1::vector::length(&flips)) { + if (*0x1::vector::borrow(&flips, i) != 0u8) break; + i = i + 1; + }; + let _v = copy flips; + let _v2 = flips; + } + public entry fun guess_with_break_without_inline(flips: vector) { + loops_with_break_no_inline(&flips); + let _v = copy flips; + let _v2 = flips; + } + public entry fun guess_without_break_with_inline(flips: vector) { + { + let (flips) = (&flips); + let i = 0; + while (i < 0x1::vector::length(flips)) { + if (*0x1::vector::borrow(flips, i) == 0u8) () else abort 3; + i = i + 1; + }; + }; + let _v = flips; + let _v2 = copy flips; + } + inline fun loops_with_break(flips: &vector) { + let i = 0; + while (i < 0x1::vector::length(flips)) { + if (*0x1::vector::borrow(flips, i) != 0u8) break; + i = i + 1; + }; + } + fun loops_with_break_no_inline(flips: &vector) { + let i = 0; + while (i < 0x1::vector::length(flips)) { + if (*0x1::vector::borrow(flips, i) != 0u8) break; + i = i + 1; + }; + } + inline fun loops_without_break(flips: &vector) { + let i = 0; + while (i < 0x1::vector::length(flips)) { + if (*0x1::vector::borrow(flips, i) == 0u8) () else abort 3; + i = i + 1; + }; + } + fun test_guess_directly() { + guess_flips_directly(vector[0u8, 0u8, 0u8, 0u8]); + } + fun test_guess_with_break_no_inline() { + guess_with_break_without_inline(vector[0u8, 0u8, 0u8, 0u8]); + } + fun test_guess_with_inline_break() { + guess_flips(vector[0u8, 0u8, 0u8, 0u8]); + } + fun test_guess_without_break() { + guess_without_break_with_inline(vector[0u8, 0u8, 0u8, 0u8]); + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/bug_9717_looponly.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/bug_9717_looponly.exp index 0e16c76cedfe5..a0ccb34192e63 100644 --- a/third_party/move/move-compiler-v2/tests/checking/inlining/bug_9717_looponly.exp +++ b/third_party/move/move-compiler-v2/tests/checking/inlining/bug_9717_looponly.exp @@ -39,5 +39,22 @@ module 0xcafe::vectors { } } // end 0xcafe::vectors +// -- Sourcified model before bytecode pipeline +module 0xcafe::vectors { + public entry fun guess_flips_break2(flips: vector): u64 { + let i = 0; + let flipsref5 = &flips; + while (i < 0x1::vector::length(flipsref5)) { + if (*0x1::vector::borrow(flipsref5, i) != 0u8) break; + i = i + 1; + if (*0x1::vector::borrow(flipsref5, i) == 5u8) break; + }; + let _v = copy flips; + let _v2 = flips; + let x = flipsref5; + 0x1::vector::length(x) + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/continue_without_loop.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/continue_without_loop.exp index 858b6714484a5..881149b8ba3ce 100644 --- a/third_party/move/move-compiler-v2/tests/checking/inlining/continue_without_loop.exp +++ b/third_party/move/move-compiler-v2/tests/checking/inlining/continue_without_loop.exp @@ -6,6 +6,13 @@ module 0xc0ffee::m { } } // end 0xc0ffee::m +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::m { + fun continued() { + continue; + } +} + Diagnostics: error: missing enclosing loop statement diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/deep_exp.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/deep_exp.exp index 5651a5e32c294..9d4e0ede67812 100644 --- a/third_party/move/move-compiler-v2/tests/checking/inlining/deep_exp.exp +++ b/third_party/move/move-compiler-v2/tests/checking/inlining/deep_exp.exp @@ -2930,5 +2930,2549 @@ module 0x42::Test { } } // end 0x42::Test +// -- Sourcified model before bytecode pipeline +module 0x42::Test { + inline fun f1(x: u64): u64 { + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + } + inline fun f2(x: u64): u64 { + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + } + inline fun f3(x: u64): u64 { + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + } + inline fun f4(x: u64): u64 { + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + } + inline fun f5(x: u64): u64 { + x + 1 + } + public fun test(): u64 { + 625 + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/double_nesting.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/double_nesting.exp index 704e33333decc..013e348b7560a 100644 --- a/third_party/move/move-compiler-v2/tests/checking/inlining/double_nesting.exp +++ b/third_party/move/move-compiler-v2/tests/checking/inlining/double_nesting.exp @@ -22,5 +22,24 @@ module 0x42::test { } } // end 0x42::test +// -- Sourcified model before bytecode pipeline +module 0x42::mathtest2 { + public inline fun fun2(a: u64, b: u64, c: u64): u64 { + 7u128 * (a as u128) + 11u128 * (b as u128) + 13u128 * (c as u128) as u64 + } +} +module 0x42::mathtest { + public inline fun fun1(a: u64, b: u64, c: u64): u64 { + 2u128 * (a as u128) + 3u128 * (b as u128) + 5u128 * (c as u128) as u64 + } +} +module 0x42::test { + use 0x42::mathtest2; + use 0x42::mathtest; + fun test_nested_fun1() { + if (true) () else abort 0; + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/inline_accessing_constant.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/inline_accessing_constant.exp index 92bb26104541b..c7758a90c4508 100644 --- a/third_party/move/move-compiler-v2/tests/checking/inlining/inline_accessing_constant.exp +++ b/third_party/move/move-compiler-v2/tests/checking/inlining/inline_accessing_constant.exp @@ -10,5 +10,17 @@ module 0xc0ffee::dummy2 { } } // end 0xc0ffee::dummy2 +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::dummy1 { + public inline fun expose(): u64 { + 1 + } +} +module 0xc0ffee::dummy2 { + public fun main(): u64 { + 1 + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/lambda.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda.exp index 11a8de528f5cb..b9080d09fb545 100644 --- a/third_party/move/move-compiler-v2/tests/checking/inlining/lambda.exp +++ b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda.exp @@ -16,7 +16,7 @@ module 0x42::LambdaTest1 { module 0x42::LambdaTest2 { use 0x42::LambdaTest1; // resolved as: 0x42::LambdaTest1 use std::vector; - public inline fun foreach(v: &vector<#0>,action: |�|) { + public inline fun foreach(v: &vector,action: |&T|) { { let i: u64 = 0; loop { @@ -94,5 +94,74 @@ module 0x42::LambdaTest { } } // end 0x42::LambdaTest +// -- Sourcified model before bytecode pipeline +module 0x42::LambdaTest1 { + public inline fun inline_apply(f: |u64|u64, b: u64): u64 { + f(b) + } + public inline fun inline_apply1(f: |u64|u64, b: u64): u64 { + let (a,b) = (f(b) + 1, 12); + a * 12 + } + public inline fun inline_mul(a: u64, b: u64): u64 { + a * b + } +} +module 0x42::LambdaTest2 { + use 0x42::LambdaTest1; + public inline fun foreach(v: &vector, action: |&T|) { + let i = 0; + while (i < 0x1::vector::length(v)) { + action(0x1::vector::borrow(v, i)); + i = i + 1; + } + } + public inline fun inline_apply2(g: |u64|u64, c: u64): u64 { + { + let (b) = (g({ + let (a,b) = (c, 3); + a * 3 + })); + let (a,b) = ({ + let (z) = (b); + z + } + 1, 12); + a * 12 + } + 2 + } + public inline fun inline_apply3(g: |u64|u64, c: u64): u64 { + LambdaTest1::inline_apply1(g, LambdaTest1::inline_mul(c, LambdaTest1::inline_apply(|x| LambdaTest1::inline_apply(|y| y, x), 3))) + 4 + } + public fun test_inline_lambda() { + let product = 1; + { + let (v) = (&vector[1, 2, 3]); + let i = 0; + while (i < 0x1::vector::length(v)) { + { + let (e) = (0x1::vector::borrow(v, i)); + product = { + let (a,b) = (product, *e); + a * b + } + }; + i = i + 1; + } + }; + } +} +module 0x42::LambdaTest { + use 0x42::LambdaTest2; + public inline fun inline_apply(f: |u64|u64, b: u64): u64 { + f(b) + } + public inline fun inline_apply_test(): u64 { + 1120 + } + fun test_lambda() { + if (false) () else abort 0; + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/lambda_cast.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda_cast.exp index 57cee1446037e..68c24b3325227 100644 --- a/third_party/move/move-compiler-v2/tests/checking/inlining/lambda_cast.exp +++ b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda_cast.exp @@ -59,5 +59,45 @@ module 0x12391283::M { } } // end 0x12391283::M +// -- Sourcified model before bytecode pipeline +module 0x12391283::M { + fun test_1(): u64 { + let accu = 0; + { + let (v) = (vector[115u8, 115u8, 95u8, 112u8, 97u8, 99u8, 107u8, 101u8, 100u8, 32u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8]); + 0x1::vector::reverse(&mut v); + while (!0x1::vector::is_empty(&v)) { + let e = 0x1::vector::pop_back(&mut v); + { + let (elem) = (e); + accu = { + let (sum,addend) = (accu, elem); + sum + (addend as u64) + } + }; + }; + }; + accu + } + fun test_2(): u64 { + let accu = 0; + { + let (v) = (vector[115u8, 115u8, 95u8, 112u8, 97u8, 99u8, 107u8, 101u8, 100u8, 32u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8]); + 0x1::vector::reverse(&mut v); + while (!0x1::vector::is_empty(&v)) { + let e = 0x1::vector::pop_back(&mut v); + { + let (elem) = (e); + accu = { + let (sum,addend) = (accu, elem); + sum + (addend as u64) + } + }; + }; + }; + accu + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/lambda_typed.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda_typed.exp index 11a8de528f5cb..b9080d09fb545 100644 --- a/third_party/move/move-compiler-v2/tests/checking/inlining/lambda_typed.exp +++ b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda_typed.exp @@ -16,7 +16,7 @@ module 0x42::LambdaTest1 { module 0x42::LambdaTest2 { use 0x42::LambdaTest1; // resolved as: 0x42::LambdaTest1 use std::vector; - public inline fun foreach(v: &vector<#0>,action: |�|) { + public inline fun foreach(v: &vector,action: |&T|) { { let i: u64 = 0; loop { @@ -94,5 +94,74 @@ module 0x42::LambdaTest { } } // end 0x42::LambdaTest +// -- Sourcified model before bytecode pipeline +module 0x42::LambdaTest1 { + public inline fun inline_apply(f: |u64|u64, b: u64): u64 { + f(b) + } + public inline fun inline_apply1(f: |u64|u64, b: u64): u64 { + let (a,b) = (f(b) + 1, 12); + a * 12 + } + public inline fun inline_mul(a: u64, b: u64): u64 { + a * b + } +} +module 0x42::LambdaTest2 { + use 0x42::LambdaTest1; + public inline fun foreach(v: &vector, action: |&T|) { + let i = 0; + while (i < 0x1::vector::length(v)) { + action(0x1::vector::borrow(v, i)); + i = i + 1; + } + } + public inline fun inline_apply2(g: |u64|u64, c: u64): u64 { + { + let (b) = (g({ + let (a,b) = (c, 3); + a * 3 + })); + let (a,b) = ({ + let (z) = (b); + z + } + 1, 12); + a * 12 + } + 2 + } + public inline fun inline_apply3(g: |u64|u64, c: u64): u64 { + LambdaTest1::inline_apply1(g, LambdaTest1::inline_mul(c, LambdaTest1::inline_apply(|x| LambdaTest1::inline_apply(|y| y, x), 3))) + 4 + } + public fun test_inline_lambda() { + let product = 1; + { + let (v) = (&vector[1, 2, 3]); + let i = 0; + while (i < 0x1::vector::length(v)) { + { + let (e) = (0x1::vector::borrow(v, i)); + product = { + let (a,b) = (product, *e); + a * b + } + }; + i = i + 1; + } + }; + } +} +module 0x42::LambdaTest { + use 0x42::LambdaTest2; + public inline fun inline_apply(f: |u64|u64, b: u64): u64 { + f(b) + } + public inline fun inline_apply_test(): u64 { + 1120 + } + fun test_lambda() { + if (false) () else abort 0; + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/nested_mul.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/nested_mul.exp index d2a9c2da6684a..fd17730d179b6 100644 --- a/third_party/move/move-compiler-v2/tests/checking/inlining/nested_mul.exp +++ b/third_party/move/move-compiler-v2/tests/checking/inlining/nested_mul.exp @@ -16,5 +16,18 @@ module 0x42::test { } } // end 0x42::test +// -- Sourcified model before bytecode pipeline +module 0x42::mathtest { + public inline fun mul_div(a: u64, b: u64, c: u64): u64 { + (a as u128) * (b as u128) / (c as u128) as u64 + } +} +module 0x42::test { + use 0x42::mathtest; + fun test_nested_mul_div() { + if (true) () else abort 0; + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/order_sensitive.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/order_sensitive.exp index 5db0ee1deb70d..e6febebcd74cb 100644 --- a/third_party/move/move-compiler-v2/tests/checking/inlining/order_sensitive.exp +++ b/third_party/move/move-compiler-v2/tests/checking/inlining/order_sensitive.exp @@ -92,5 +92,99 @@ module 0x42::OrderSensitiveTest3 { } } // end 0x42::OrderSensitiveTest3 +// -- Sourcified model before bytecode pipeline +module 0x42::OrderSensitiveTest1 { + public inline fun inline_fun1(a: u64, b: u64): u64 { + a * b + } + public inline fun inline_fun2(a: u64, b: u64): u64 { + { + let (a,b) = (a, b); + a * b + } + 2 * { + let (a,b) = (a, b); + a * b + 2 + } + } + public inline fun inline_fun3(a: u64, b: u64): u64 { + a * b + 2 + } +} +module 0x42::OrderSensitiveTest2 { + use 0x42::OrderSensitiveTest1; + public inline fun inline_fun1(a: u64, b: u64): u64 { + a * b + 3 + } + public inline fun inline_fun2(a: u64, b: u64): u64 { + { + let (a,b) = ({ + let (a,b) = (a, b); + a * b + 3 + }, { + let (a,b) = (a, b); + a * b + 4 + }); + { + let (a,b) = (a, b); + a * b + } + 2 * { + let (a,b) = (a, b); + a * b + 2 + } + } + 3 * { + let (a,b) = (a, b); + a * b + 3 + } + 5 * { + let (a,b) = (a, b); + a * b + 4 + } + } + public inline fun inline_fun3(a: u64, b: u64): u64 { + a * b + 4 + } +} +module 0x42::OrderSensitiveTest3 { + use 0x42::OrderSensitiveTest2; + public inline fun fun1(a: u64, b: u64): u64 { + a * b + 5 + } + public fun fun2(a: u64, b: u64): u64 { + { + let (a,b) = (7 * { + let (a,b) = (a, b); + a * b + 5 + }, b); + { + let (a,b) = ({ + let (a,b) = (a, b); + a * b + 3 + }, { + let (a,b) = (a, b); + a * b + 4 + }); + { + let (a,b) = (a, b); + a * b + } + 2 * { + let (a,b) = (a, b); + a * b + 2 + } + } + 3 * { + let (a,b) = (a, b); + a * b + 3 + } + 5 * { + let (a,b) = (a, b); + a * b + 4 + } + } + 9 * { + let (a,b) = (a, b); + a * b + 6 + } + } + public inline fun fun3(a: u64, b: u64): u64 { + a * b + 6 + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/recursive_nesting.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/recursive_nesting.exp index a7c00dc82c2a1..be3551312c2b4 100644 --- a/third_party/move/move-compiler-v2/tests/checking/inlining/recursive_nesting.exp +++ b/third_party/move/move-compiler-v2/tests/checking/inlining/recursive_nesting.exp @@ -39,5 +39,35 @@ module 0x42::test { } } // end 0x42::test +// -- Sourcified model before bytecode pipeline +module 0x42::mathtest { + public inline fun mul_div(a: u64, b: u64, c: u64): u64 { + (a as u128) * (b as u128) / (c as u128) as u64 + } +} +module 0x42::mathtest2 { + use 0x42::mathtest; + public inline fun mul_div2(a: u64, b: u64, c: u64): u64 { + let (a,b,c) = (b, a, c); + (a as u128) * (b as u128) / (c as u128) as u64 + } +} +module 0x42::mathtest3 { + use 0x42::mathtest2; + public inline fun mul_div3(a: u64, b: u64, c: u64): u64 { + let (a,b,c) = (b, a, c); + let (a,b,c) = (b, a, c); + (a as u128) * (b as u128) / (c as u128) as u64 + } +} +module 0x42::test { + use 0x42::mathtest; + use 0x42::mathtest2; + use 0x42::mathtest3; + fun test_nested_mul_div() { + if (true) () else abort 0; + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/resources_valid.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/resources_valid.exp index cf71f9d1297c0..1a3c18119c4dd 100644 --- a/third_party/move/move-compiler-v2/tests/checking/inlining/resources_valid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/inlining/resources_valid.exp @@ -3,10 +3,10 @@ module 0x42::objects { struct ReaderRef { addr: address, } - public fun get_addr(ref: &objects::ReaderRef<#0>): address { - select objects::ReaderRef.addr<&objects::ReaderRef>(ref) + public fun get_addr(ref: &ReaderRef): address { + select objects::ReaderRef.addr<&ReaderRef>(ref) } - public inline fun reader(ref: &objects::ReaderRef<#0>): � { + public inline fun reader(ref: &ReaderRef): &T { BorrowGlobal(Immutable)(objects::get_addr(ref)) } } // end 0x42::objects @@ -15,15 +15,42 @@ module 0x42::token { struct Token { val: u64, } - public fun get_value(ref: &objects::ReaderRef): u64 - acquires token::Token(*) + public fun get_value(ref: &objects::ReaderRef): u64 + acquires 0x42::token::Token(*) { - select token::Token.val<&token::Token>({ - let (ref: &objects::ReaderRef): (&objects::ReaderRef) = Tuple(ref); - BorrowGlobal(Immutable)(objects::get_addr(ref)) + select token::Token.val<&Token>({ + let (ref: &objects::ReaderRef): (&objects::ReaderRef) = Tuple(ref); + BorrowGlobal(Immutable)(objects::get_addr(ref)) }) } } // end 0x42::token +// -- Sourcified model before bytecode pipeline +module 0x42::objects { + struct ReaderRef has store { + addr: address, + } + public fun get_addr(ref: &ReaderRef): address { + ref.addr + } + public inline fun reader(ref: &ReaderRef): &T { + borrow_global(get_addr(ref)) + } +} +module 0x42::token { + use 0x42::objects; + struct Token has key { + val: u64, + } + public fun get_value(ref: &objects::ReaderRef): u64 + acquires Token + { + { + let (ref) = (ref); + borrow_global(objects::get_addr(ref)) + }.val + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused.exp index 2c3a1c4b158bd..5eb27791a5827 100644 --- a/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused.exp +++ b/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused.exp @@ -39,5 +39,34 @@ module 0x42::Test { } } // end 0x42::Test +// -- Sourcified model before bytecode pipeline +module 0x42::Test { + public inline fun foo(f: |(u64, u64)|, z: u64) { + { + let (_z) = (z); + f(3, 5); + }; + } + public inline fun quux(f: |(u64, u64)|, _z: u64) { + f(3, 5); + } + public fun test_shadowing() { + let _x = 1; + { + { + _x = 3; + }; + }; + if (_x == 3) () else abort 0 + } + public fun test_shadowing2() { + let _x = 1; + { + _x = 3; + }; + if (_x == 3) () else abort 0 + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused_nodecl.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused_nodecl.exp index 6a990cf6bcf0c..96b8d2c461add 100644 --- a/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused_nodecl.exp +++ b/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused_nodecl.exp @@ -47,5 +47,34 @@ module 0x42::Test { } } // end 0x42::Test +// -- Sourcified model before bytecode pipeline +module 0x42::Test { + public inline fun foo(f: |(u64, u64)|, z: u64) { + { + let (z) = (z); + f(3, 5); + }; + } + public inline fun quux(f: |(u64, u64)|, z: u64) { + f(3, 5); + } + public fun test_shadowing() { + let _x = 1; + { + { + _x = 3; + }; + }; + if (_x == 3) () else abort 0 + } + public fun test_shadowing2() { + let _x = 1; + { + _x = 3; + }; + if (_x == 3) () else abort 0 + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused_nodecl_typed.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused_nodecl_typed.exp index 4f7f74661aa59..9dc677d49a25e 100644 --- a/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused_nodecl_typed.exp +++ b/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused_nodecl_typed.exp @@ -47,5 +47,34 @@ module 0x42::Test { } } // end 0x42::Test +// -- Sourcified model before bytecode pipeline +module 0x42::Test { + public inline fun foo(f: |(u64, u64)|, z: u64) { + { + let (z) = (z); + f(3, 5); + }; + } + public inline fun quux(f: |(u64, u64)|, z: u64) { + f(3, 5); + } + public fun test_shadowing() { + let _x = 1; + { + { + _x = 3; + }; + }; + if (_x == 3) () else abort 0 + } + public fun test_shadowing2() { + let _x = 1; + { + _x = 3; + }; + if (_x == 3) () else abort 0 + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused_typed.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused_typed.exp index 2c3a1c4b158bd..5eb27791a5827 100644 --- a/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused_typed.exp +++ b/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused_typed.exp @@ -39,5 +39,34 @@ module 0x42::Test { } } // end 0x42::Test +// -- Sourcified model before bytecode pipeline +module 0x42::Test { + public inline fun foo(f: |(u64, u64)|, z: u64) { + { + let (_z) = (z); + f(3, 5); + }; + } + public inline fun quux(f: |(u64, u64)|, _z: u64) { + f(3, 5); + } + public fun test_shadowing() { + let _x = 1; + { + { + _x = 3; + }; + }; + if (_x == 3) () else abort 0 + } + public fun test_shadowing2() { + let _x = 1; + { + _x = 3; + }; + if (_x == 3) () else abort 0 + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/spec_inlining.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/spec_inlining.exp index f5a5f2de0f028..c63cdd3aaa435 100644 --- a/third_party/move/move-compiler-v2/tests/checking/inlining/spec_inlining.exp +++ b/third_party/move/move-compiler-v2/tests/checking/inlining/spec_inlining.exp @@ -56,5 +56,56 @@ module 0x42::Test { } } // end 0x42::Test +// -- Sourcified model before bytecode pipeline +module 0x42::Test { + inline fun apply(v: u64, predicate: |u64|bool): bool { + + /* spec { + assert Ge($t0, 0); + } + */ + ; + predicate(v) + } + public fun test_apply(x: u64) { + let r1 = { + let (v) = (x); + + /* spec { + assert Ge(v, 0); + } + */ + ; + let (v) = (v); + v >= 0 + }; + + /* spec { + assert r1; + } + */ + ; + if (r1) () else abort 1; + let r2 = { + let (v) = (x); + + /* spec { + assert Ge(v, 0); + } + */ + ; + let (v) = (v); + v != 0 + }; + + /* spec { + assert r2; + } + */ + ; + if (r2) () else abort 2; + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/spec_inlining_typed.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/spec_inlining_typed.exp index f5a5f2de0f028..c63cdd3aaa435 100644 --- a/third_party/move/move-compiler-v2/tests/checking/inlining/spec_inlining_typed.exp +++ b/third_party/move/move-compiler-v2/tests/checking/inlining/spec_inlining_typed.exp @@ -56,5 +56,56 @@ module 0x42::Test { } } // end 0x42::Test +// -- Sourcified model before bytecode pipeline +module 0x42::Test { + inline fun apply(v: u64, predicate: |u64|bool): bool { + + /* spec { + assert Ge($t0, 0); + } + */ + ; + predicate(v) + } + public fun test_apply(x: u64) { + let r1 = { + let (v) = (x); + + /* spec { + assert Ge(v, 0); + } + */ + ; + let (v) = (v); + v >= 0 + }; + + /* spec { + assert r1; + } + */ + ; + if (r1) () else abort 1; + let r2 = { + let (v) = (x); + + /* spec { + assert Ge(v, 0); + } + */ + ; + let (v) = (v); + v != 0 + }; + + /* spec { + assert r2; + } + */ + ; + if (r2) () else abort 2; + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/temp_shadowing.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/temp_shadowing.exp index 74d14cbaa3f32..21b28b8d8ae5c 100644 --- a/third_party/move/move-compiler-v2/tests/checking/inlining/temp_shadowing.exp +++ b/third_party/move/move-compiler-v2/tests/checking/inlining/temp_shadowing.exp @@ -57,5 +57,37 @@ module 0x42::Test { } } // end 0x42::Test +// -- Sourcified model before bytecode pipeline +module 0x42::Test { + public fun other(a: u64, b: u64): u64 { + let sum = 0; + while (a < b) { + a = a + 1; + sum = { + let (a,b) = (a, b); + let sum = 0; + while (a < b) { + a = a + 1; + sum = sum + a; + }; + sum + } + sum; + }; + sum + } + public inline fun nested(a: u64, b: u64): u64 { + let sum = 0; + while (a < b) { + a = a + 1; + sum = sum + a; + }; + sum + } + public fun test_shadowing() { + let z = other(1, 4); + if (z == 10) () else abort z + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/test_12670.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/test_12670.exp index e110f2e38ae4f..8122d025a34bb 100644 --- a/third_party/move/move-compiler-v2/tests/checking/inlining/test_12670.exp +++ b/third_party/move/move-compiler-v2/tests/checking/inlining/test_12670.exp @@ -4,18 +4,18 @@ module 0x1::Test { struct S { x: u8, } - private fun foo(xs: vector) { + private fun foo(xs: vector) { { let sum: u8 = 0; { - let (v: &vector): (&vector) = Tuple(Borrow(Immutable)(xs)); + let (v: &vector): (&vector) = Tuple(Borrow(Immutable)(xs)); { let i: u64 = 0; loop { - if Lt(i, vector::length(v)) { + if Lt(i, vector::length(v)) { { - let (e: &Test::S): (&Test::S) = Tuple(vector::borrow(v, i)); - sum: u8 = Add(sum, select Test::S.x<&Test::S>(e)); + let (e: &S): (&S) = Tuple(vector::borrow(v, i)); + sum: u8 = Add(sum, select Test::S.x<&S>(e)); Tuple() }; i: u64 = Add(i, 1) @@ -30,5 +30,26 @@ module 0x1::Test { } } // end 0x1::Test +// -- Sourcified model before bytecode pipeline +module 0x1::Test { + struct S has drop { + x: u8, + } + fun foo(xs: vector) { + let sum = 0u8; + { + let (v) = (&xs); + let i = 0; + while (i < 0x1::vector::length(v)) { + { + let (e) = (0x1::vector::borrow(v, i)); + sum = sum + e.x; + }; + i = i + 1 + } + }; + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/unused_inline.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/unused_inline.exp index 2418f6a234d5d..ba49606523aa6 100644 --- a/third_party/move/move-compiler-v2/tests/checking/inlining/unused_inline.exp +++ b/third_party/move/move-compiler-v2/tests/checking/inlining/unused_inline.exp @@ -40,5 +40,29 @@ module 0xc0ffee::m { } } // end 0xc0ffee::m +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::m { + public fun bar(): u64 { + let i = 0; + while (i < 10) { + i = i + 1; + if (i == 5) { + break; + } + }; + i + } + inline fun foo(): u64 { + let i = 0; + while (i < 10) { + i = i + 1; + if (i == 5) { + break; + } + }; + i + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/checking/naming/duplicate_acquires_list_item.exp b/third_party/move/move-compiler-v2/tests/checking/naming/duplicate_acquires_list_item.exp index c1969b53e490a..e09b6408ae260 100644 --- a/third_party/move/move-compiler-v2/tests/checking/naming/duplicate_acquires_list_item.exp +++ b/third_party/move/move-compiler-v2/tests/checking/naming/duplicate_acquires_list_item.exp @@ -7,23 +7,43 @@ module 0x8675309::M { dummy_field: bool, } private fun t0() - acquires M::R(*) - acquires M::X(*) - acquires M::R(*) + acquires 0x8675309::M::R(*) + acquires 0x8675309::M::X(*) + acquires 0x8675309::M::R(*) { - BorrowGlobal(Mutable)(0x1); - BorrowGlobal(Mutable)(0x1); + BorrowGlobal(Mutable)(0x1); + BorrowGlobal(Mutable)(0x1); Tuple() } private fun t1() - acquires M::R(*) - acquires M::X(*) - acquires M::R(*) - acquires M::R(*) - acquires M::R(*) + acquires 0x8675309::M::R(*) + acquires 0x8675309::M::X(*) + acquires 0x8675309::M::R(*) + acquires 0x8675309::M::R(*) + acquires 0x8675309::M::R(*) { - BorrowGlobal(Mutable)(0x1); - BorrowGlobal(Mutable)(0x1); + BorrowGlobal(Mutable)(0x1); + BorrowGlobal(Mutable)(0x1); Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R has key { + } + struct X has key { + } + fun t0() + acquires Racquires Xacquires R + { + borrow_global_mut(0x1); + borrow_global_mut(0x1); + } + fun t1() + acquires Racquires Xacquires Racquires Racquires R + { + borrow_global_mut(0x1); + borrow_global_mut(0x1); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/naming/generics_shadowing.exp b/third_party/move/move-compiler-v2/tests/checking/naming/generics_shadowing.exp index 7d025d34595a6..8edd453e33526 100644 --- a/third_party/move/move-compiler-v2/tests/checking/naming/generics_shadowing.exp +++ b/third_party/move/move-compiler-v2/tests/checking/naming/generics_shadowing.exp @@ -3,7 +3,7 @@ module 0x2::M { struct S { dummy_field: bool, } - private fun foo(s: #0): #0 { + private fun foo(s: S): S { { let s: S = s; { @@ -13,3 +13,14 @@ module 0x2::M { } } } // end 0x2::M + +// -- Sourcified model before bytecode pipeline +module 0x2::M { + struct S { + } + fun foo(s: S): S { + let s = s; + let s = s; + s + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/naming/global_builtin_one_type_argument.exp b/third_party/move/move-compiler-v2/tests/checking/naming/global_builtin_one_type_argument.exp index 441e25f4f2b3b..85a59aab9e4b2 100644 --- a/third_party/move/move-compiler-v2/tests/checking/naming/global_builtin_one_type_argument.exp +++ b/third_party/move/move-compiler-v2/tests/checking/naming/global_builtin_one_type_argument.exp @@ -4,18 +4,18 @@ module 0x8675309::M { dummy_field: bool, } private fun t(account: &signer) - acquires M::R(*) + acquires 0x8675309::M::R(*) { { - let _: bool = exists(0x0); + let _: bool = exists(0x0); { - let (): () = MoveTo(account, pack M::R(false)); + let (): () = MoveTo(account, pack M::R(false)); { - let _: &M::R = BorrowGlobal(Immutable)(0x0); + let _: &R = BorrowGlobal(Immutable)(0x0); { - let _: &mut M::R = BorrowGlobal(Mutable)(0x0); + let _: &mut R = BorrowGlobal(Mutable)(0x0); { - let M::R{ dummy_field: _ } = MoveFrom(0x0); + let M::R{ dummy_field: _ } = MoveFrom(0x0); Tuple() } } @@ -24,3 +24,18 @@ module 0x8675309::M { } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R has key { + } + fun t(account: &signer) + acquires R + { + let _ = exists(0x0); + let () = move_to(account, R{}); + let _ = borrow_global(0x0); + let _ = borrow_global_mut(0x0); + let R{} = move_from(0x0); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/naming/struct_in_current_module.exp b/third_party/move/move-compiler-v2/tests/checking/naming/struct_in_current_module.exp index 8e0fcca2100b4..981ba43a7d97e 100644 --- a/third_party/move/move-compiler-v2/tests/checking/naming/struct_in_current_module.exp +++ b/third_party/move/move-compiler-v2/tests/checking/naming/struct_in_current_module.exp @@ -8,7 +8,7 @@ module 0x8675309::M { } private fun foo() { { - let _: M::S = pack M::S(0); + let _: S = pack M::S(0); { let M::R{ f: _ } = pack M::R(0); Tuple() @@ -16,3 +16,17 @@ module 0x8675309::M { } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + f: u64, + } + struct S has drop { + f: u64, + } + fun foo() { + let _ = S{f: 0}; + let R{f: _} = R{f: 0}; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/naming/unused_type_parameter_struct.exp b/third_party/move/move-compiler-v2/tests/checking/naming/unused_type_parameter_struct.exp index bc74029181400..3ae2e7bdc83b2 100644 --- a/third_party/move/move-compiler-v2/tests/checking/naming/unused_type_parameter_struct.exp +++ b/third_party/move/move-compiler-v2/tests/checking/naming/unused_type_parameter_struct.exp @@ -49,7 +49,7 @@ module 0x42::test { dummy_field: bool, } struct S2 { - f: test::S3<#1>, + f: 0x42::test::S3<#1>, } struct S3 { dummy_field: bool, @@ -62,3 +62,23 @@ module 0x42::test { g: vector<#1>, } } // end 0x42::test + +// -- Sourcified model before bytecode pipeline +module 0x42::test { + struct S0 { + } + struct S1 { + } + struct S2 { + f: S3, + } + struct S3 { + } + struct S4 { + f: vector, + } + struct S5 { + f: vector, + g: vector, + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/naming/warning_dependency.exp b/third_party/move/move-compiler-v2/tests/checking/naming/warning_dependency.exp index d18cbc88a3820..af81d60312b4a 100644 --- a/third_party/move/move-compiler-v2/tests/checking/naming/warning_dependency.exp +++ b/third_party/move/move-compiler-v2/tests/checking/naming/warning_dependency.exp @@ -18,7 +18,7 @@ module 0x42::test { dummy_field: bool, } struct S2 { - f: test::S3<#1>, + f: 0x42::test::S3<#1>, } struct S3 { dummy_field: bool, @@ -31,3 +31,7 @@ module 0x42::test { g: vector<#1>, } } // end 0x42::test + +// -- Sourcified model before bytecode pipeline +module 0x42::dependency { +} diff --git a/third_party/move/move-compiler-v2/tests/checking/positional_fields/assign_field.exp b/third_party/move/move-compiler-v2/tests/checking/positional_fields/assign_field.exp index f84ae045ce12c..81f20a0b029dc 100644 --- a/third_party/move/move-compiler-v2/tests/checking/positional_fields/assign_field.exp +++ b/third_party/move/move-compiler-v2/tests/checking/positional_fields/assign_field.exp @@ -6,7 +6,7 @@ module 0x42::test { 1: bool, } V2 { - 0: test::S3, + 0: 0x42::test::S3, } } struct S0 { @@ -17,20 +17,20 @@ module 0x42::test { 1: bool, } struct S2 { - 0: test::S0, + 0: 0x42::test::S0, 1: u8, } struct S3 { - 0: test::S2, - 1: test::S0, - 2: test::S2, + 0: 0x42::test::S2, + 1: 0x42::test::S0, + 2: 0x42::test::S2, } private fun assign0(a: u64,b: bool) { { - let x: test::S1 = pack test::S1(a, b); + let x: S1 = pack test::S1(a, b); loop { - if select test::S1.1(x) { - x: test::S1 = pack test::S1(Sub(select test::S1.0(x), 1), Ge(select test::S1.0(x), 1)); + if select test::S1.1(x) { + x: S1 = pack test::S1(Sub(select test::S1.0(x), 1), Ge(select test::S1.0(x), 1)); Tuple() } else { break @@ -38,18 +38,18 @@ module 0x42::test { } } } - private fun assign1(x: test::S1): u64 { + private fun assign1(x: S1): u64 { { let count: u64 = 0; loop { - if select test::S1.1(x) { + if select test::S1.1(x) { { - let y: u64 = if Gt(select test::S1.0(x), 0) { - Sub(select test::S1.0(x), 1) + let y: u64 = if Gt(select test::S1.0(x), 0) { + Sub(select test::S1.0(x), 1) } else { 0 }; - x: test::S1 = pack test::S1(y, Ge(y, 1)); + x: S1 = pack test::S1(y, Ge(y, 1)); count: u64 = Add(count, 1); Tuple() } @@ -60,14 +60,14 @@ module 0x42::test { count } } - private fun assign_chained(x: test::S3) { - Add(Add(select test::S0.x(select test::S2.0(select test::S3.0(x))), select test::S0.x(select test::S3.1(x))), select test::S0.x(select test::S2.0(select test::S3.2(x)))); - select test::S0.x(select test::S2.0(select test::S3.0(x))) = 0; - select test::S0.x(select test::S3.1(x)) = 1; - select test::S0.x(select test::S2.0(select test::S3.2(x))) = 2; + private fun assign_chained(x: S3) { + Add(Add(select test::S0.x(select test::S2.0(select test::S3.0(x))), select test::S0.x(select test::S3.1(x))), select test::S0.x(select test::S2.0(select test::S3.2(x)))); + select test::S0.x(select test::S2.0(select test::S3.0(x))) = 0; + select test::S0.x(select test::S3.1(x)) = 1; + select test::S0.x(select test::S2.0(select test::S3.2(x))) = 2; Tuple() } - private fun assign_enum(x: &mut test::E) { + private fun assign_enum(x: &mut E) { match (x) { test::E::V1{ 0: x, 1: y } => { x = 42; @@ -75,22 +75,93 @@ module 0x42::test { Tuple() } test::E::V2{ 0: x } => { - select test::S0.x(select test::S2.0(select test::S3.0<&mut test::S3>(x))) = 0; - select test::S0.x(select test::S3.1<&mut test::S3>(x)) = 1; - select test::S0.x(select test::S2.0(select test::S3.2<&mut test::S3>(x))) = 2; + select test::S0.x(select test::S2.0(select test::S3.0<&mut S3>(x))) = 0; + select test::S0.x(select test::S3.1<&mut S3>(x)) = 1; + select test::S0.x(select test::S2.0(select test::S3.2<&mut S3>(x))) = 2; Tuple() } } } - private fun simple(x: test::S1) { - select test::S1.0(x) = 42; - select test::S1.1(x) = true; + private fun simple(x: S1) { + select test::S1.0(x) = 42; + select test::S1.1(x) = true; Tuple() } - private fun simple_ref(x: &mut test::S1) { - select test::S1.0<&mut test::S1>(x) = 42; - select test::S1.1<&mut test::S1>(x) = true; + private fun simple_ref(x: &mut S1) { + select test::S1.0<&mut S1>(x) = 42; + select test::S1.1<&mut S1>(x) = true; Tuple() } } // end 0x42::test + +// -- Sourcified model before bytecode pipeline +module 0x42::test { + enum E { + V1 { + 0: u8, + 1: bool, + } + V2 { + 0: S3, + } + } + struct S0 { + x: u8, + } + struct S1 { + 0: u64, + 1: bool, + } + struct S2 { + 0: S0, + 1: u8, + } + struct S3 { + 0: S2, + 1: S0, + 2: S2, + } + fun assign0(a: u64, b: bool) { + let x = S1(a,b); + while (x.1) { + x = S1(x.0 - 1,x.0 >= 1); + } + } + fun assign1(x: S1): u64 { + let count = 0; + while (x.1) { + let y = if (x.0 > 0) x.0 - 1 else 0; + x = S1(y,y >= 1); + count = count + 1; + }; + count + } + fun assign_chained(x: S3) { + x.0.0.x + x.1.x + x.2.0.x; + x.0.0.x = 0u8; + x.1.x = 1u8; + x.2.0.x = 2u8; + } + fun assign_enum(x: &mut E) { + match (x) { + E::V1(x,y) => { + *x = 42u8; + *y = true; + }, + E::V2(x) => { + x.0.0.x = 0u8; + x.1.x = 1u8; + x.2.0.x = 2u8; + }, + } + } + fun simple(x: S1) { + x.0 = 42; + x.1 = true; + } + fun simple_ref(x: &mut S1) { + x.0 = 42; + x.1 = true; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/positional_fields/bind_anonymous_field.exp b/third_party/move/move-compiler-v2/tests/checking/positional_fields/bind_anonymous_field.exp index 09aaa32647c33..1a0b7be9954d6 100644 --- a/third_party/move/move-compiler-v2/tests/checking/positional_fields/bind_anonymous_field.exp +++ b/third_party/move/move-compiler-v2/tests/checking/positional_fields/bind_anonymous_field.exp @@ -2,10 +2,10 @@ module 0x42::test { enum E1 { V1 { - 0: test::S0, + 0: 0x42::test::S0, } V2 { - 0: test::S1, + 0: 0x42::test::S1, } } struct S0 { @@ -13,9 +13,9 @@ module 0x42::test { } struct S1 { 0: bool, - 1: test::S0, + 1: 0x42::test::S0, } - private fun match(x: test::E1) { + private fun match(x: E1) { match (x) { test::E1::V1{ 0: test::S0{ 0: _x } } => { Tuple() @@ -26,16 +26,47 @@ module 0x42::test { } } - private fun nested(x: test::S1) { + private fun nested(x: S1) { { let test::S1{ 0: _x, 1: test::S0{ 0: _y } } = x; Tuple() } } - private fun simple(x: test::S0) { + private fun simple(x: S0) { { let test::S0{ 0: _x } = x; Tuple() } } } // end 0x42::test + +// -- Sourcified model before bytecode pipeline +module 0x42::test { + enum E1 { + V1 { + 0: S0, + } + V2 { + 0: S1, + } + } + struct S0 { + 0: u8, + } + struct S1 { + 0: bool, + 1: S0, + } + fun match(x: E1) { + match (x) { + E1::V1(S0(_x)) => (), + E1::V2(S1(_x,S0(_y))) => (), + } + } + fun nested(x: S1) { + let S1(_x,S0(_y)) = x; + } + fun simple(x: S0) { + let S0(_x) = x; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/positional_fields/common_access.exp b/third_party/move/move-compiler-v2/tests/checking/positional_fields/common_access.exp index b0f4b0957c213..38c21b2652857 100644 --- a/third_party/move/move-compiler-v2/tests/checking/positional_fields/common_access.exp +++ b/third_party/move/move-compiler-v2/tests/checking/positional_fields/common_access.exp @@ -8,7 +8,22 @@ module 0x42::test { 0: u8, } } - private fun common_access(x: test::Foo): u8 { - select_variants test::Foo.A.0|test::Foo.B.0(x) + private fun common_access(x: Foo): u8 { + select_variants test::Foo.A.0|test::Foo.B.0(x) } } // end 0x42::test + +// -- Sourcified model before bytecode pipeline +module 0x42::test { + enum Foo has drop { + A { + 0: u8, + } + B { + 0: u8, + } + } + fun common_access(x: Foo): u8 { + x.A.0 + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/positional_fields/decl_ok.exp b/third_party/move/move-compiler-v2/tests/checking/positional_fields/decl_ok.exp index 5280e3ddd0a51..d0188cbba98fb 100644 --- a/third_party/move/move-compiler-v2/tests/checking/positional_fields/decl_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/positional_fields/decl_ok.exp @@ -20,8 +20,8 @@ module 0x42::test { 1: u8, 2: #0, } - private fun bar(x: test::S2) { - select test::S2.0(x); + private fun bar(x: S2) { + select test::S2.0(x); Tuple() } private fun baz() { @@ -30,9 +30,44 @@ module 0x42::test { pack test::E1::V3(42, true); Tuple() } - private fun foo(x: test::S2) { - select test::S2.0(x); - select test::S2.1(x); + private fun foo(x: S2) { + select test::S2.0(x); + select test::S2.1(x); Tuple() } } // end 0x42::test + +// -- Sourcified model before bytecode pipeline +module 0x42::test { + enum E1 { + V1, + V2, + V3 { + 0: u8, + 1: bool, + } + } + struct S1 { + } + struct S2 { + 0: u8, + 1: bool, + } + struct S3 { + 0: T2, + 1: u8, + 2: T1, + } + fun bar(x: S2) { + x.0; + } + fun baz() { + E1::V1{}; + E1::V2{}; + E1::V3(42u8,true); + } + fun foo(x: S2) { + x.0; + x.1; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/positional_fields/named_tuple_ability_decl_ok.exp b/third_party/move/move-compiler-v2/tests/checking/positional_fields/named_tuple_ability_decl_ok.exp index 3271dea2b7566..298a8f310f809 100644 --- a/third_party/move/move-compiler-v2/tests/checking/positional_fields/named_tuple_ability_decl_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/positional_fields/named_tuple_ability_decl_ok.exp @@ -20,9 +20,36 @@ module 0x42::test { } struct S5 { 0: #0, - 1: test::S3<#0>, + 1: 0x42::test::S3<#0>, } struct S6 { dummy_field: bool, } } // end 0x42::test + +// -- Sourcified model before bytecode pipeline +module 0x42::test { + struct S has copy, key { + } + struct S1 has drop { + 0: u8, + } + struct S2 has key { + 0: T, + 1: u8, + } + struct S3 has key { + 0: T, + 1: u8, + } + struct S4 has drop { + x: u8, + y: T, + } + struct S5 has key { + 0: T, + 1: S3, + } + struct S6 { + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/positional_fields/named_tuple_construct_ok.exp b/third_party/move/move-compiler-v2/tests/checking/positional_fields/named_tuple_construct_ok.exp index c56d7f9c7a5c1..30bd1a8bb884a 100644 --- a/third_party/move/move-compiler-v2/tests/checking/positional_fields/named_tuple_construct_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/positional_fields/named_tuple_construct_ok.exp @@ -29,23 +29,23 @@ module 0x42::test { x: #0, y: u8, } - private fun S0_inhabited(): test::S0 { + private fun S0_inhabited(): S0 { pack test::S0(false) } - private fun S1_inhabited(): test::S1 { + private fun S1_inhabited(): S1 { pack test::S1(0) } - private fun S2_inhabited(): test::S2 { + private fun S2_inhabited(): S2 { pack test::S2(0, false) } - private fun S3_test(x: #0): test::S3<#0> { + private fun S3_test(x: T): S3 { pack test::S3(x, 0) } - private fun nested_0(): test::S3 { - pack test::S3(pack test::S4(false), 0) + private fun nested_0(): S3 { + pack test::S3(pack test::S4(false), 0) } - private fun nested_1(): test::S5 { - pack test::S5(pack test::S0(false), 0) + private fun nested_1(): S5 { + pack test::S5(pack test::S0(false), 0) } private fun test_variant() { pack test::E1::V1(); @@ -54,3 +54,57 @@ module 0x42::test { Tuple() } } // end 0x42::test + +// -- Sourcified model before bytecode pipeline +module 0x42::test { + enum E1 { + V1, + V2, + V3 { + 0: u8, + 1: bool, + } + } + struct S0 { + } + struct S1 { + 0: u8, + } + struct S2 { + 0: u8, + 1: bool, + } + struct S3 { + 0: T, + 1: u8, + } + struct S4 { + } + struct S5 { + x: T, + y: u8, + } + fun S0_inhabited(): S0 { + S0{} + } + fun S1_inhabited(): S1 { + S1(0u8) + } + fun S2_inhabited(): S2 { + S2(0u8,false) + } + fun S3_test(x: T): S3 { + S3(x,0u8) + } + fun nested_0(): S3 { + S3(S4{},0u8) + } + fun nested_1(): S5 { + S5{x: S0{},y: 0u8} + } + fun test_variant() { + E1::V1{}; + E1::V2{}; + E1::V3(42u8,true); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/positional_fields/variant_ability_decl_ok.exp b/third_party/move/move-compiler-v2/tests/checking/positional_fields/variant_ability_decl_ok.exp index 2b5cb1622dfa7..07b4274a25e4b 100644 --- a/third_party/move/move-compiler-v2/tests/checking/positional_fields/variant_ability_decl_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/positional_fields/variant_ability_decl_ok.exp @@ -19,3 +19,25 @@ module 0x42::test { } } } // end 0x42::test + +// -- Sourcified model before bytecode pipeline +module 0x42::test { + enum Bar has copy, drop { + A { + 0: T, + } + B { + 0: u8, + 1: bool, + } + } + enum Foo has copy, drop { + A { + 0: T, + } + B { + 0: u8, + 1: bool, + } + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/receiver/calls.exp b/third_party/move/move-compiler-v2/tests/checking/receiver/calls.exp index 7710862209187..db1d6cf8b7e2f 100644 --- a/third_party/move/move-compiler-v2/tests/checking/receiver/calls.exp +++ b/third_party/move/move-compiler-v2/tests/checking/receiver/calls.exp @@ -3,25 +3,51 @@ module 0x42::m { struct S { x: u64, } - private inline fun inline_receiver_ref_mut(self: &mut m::S,y: u64): u64 { - Add(select m::S.x<&mut m::S>(self), y) + private inline fun inline_receiver_ref_mut(self: &mut S,y: u64): u64 { + Add(select m::S.x<&mut S>(self), y) } - private fun receiver(self: m::S,y: u64): u64 { - Add(select m::S.x(self), y) + private fun receiver(self: S,y: u64): u64 { + Add(select m::S.x(self), y) } - private fun receiver_ref(self: &m::S,y: u64): u64 { - Add(select m::S.x<&m::S>(self), y) + private fun receiver_ref(self: &S,y: u64): u64 { + Add(select m::S.x<&S>(self), y) } - private fun receiver_ref_mut(self: &mut m::S,y: u64): u64 { - Add(select m::S.x<&mut m::S>(self), y) + private fun receiver_ref_mut(self: &mut S,y: u64): u64 { + Add(select m::S.x<&mut S>(self), y) } - private fun test_call_styles(s: m::S): u64 { + private fun test_call_styles(s: S): u64 { m::receiver(s, 1); m::receiver_ref(Borrow(Immutable)(s), 1); m::receiver_ref_mut(Borrow(Mutable)(s), 1); { - let (self: &mut m::S, y: u64): (&mut m::S, u64) = Tuple(Borrow(Mutable)(s), 1); - Add(select m::S.x<&mut m::S>(self), 1) + let (self: &mut S, y: u64): (&mut S, u64) = Tuple(Borrow(Mutable)(s), 1); + Add(select m::S.x<&mut S>(self), 1) } } } // end 0x42::m + +// -- Sourcified model before bytecode pipeline +module 0x42::m { + struct S { + x: u64, + } + inline fun inline_receiver_ref_mut(self: &mut S, y: u64): u64 { + self.x + y + } + fun receiver(self: S, y: u64): u64 { + self.x + y + } + fun receiver_ref(self: &S, y: u64): u64 { + self.x + y + } + fun receiver_ref_mut(self: &mut S, y: u64): u64 { + self.x + y + } + fun test_call_styles(s: S): u64 { + receiver(s, 1); + receiver_ref(&s, 1); + receiver_ref_mut(&mut s, 1); + let (self,y) = (&mut s, 1); + self.x + 1 + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/receiver/calls_with_freeze.exp b/third_party/move/move-compiler-v2/tests/checking/receiver/calls_with_freeze.exp index b21f306bed416..3568ee31e45af 100644 --- a/third_party/move/move-compiler-v2/tests/checking/receiver/calls_with_freeze.exp +++ b/third_party/move/move-compiler-v2/tests/checking/receiver/calls_with_freeze.exp @@ -3,20 +3,20 @@ module 0x42::m { struct S { x: u64, } - private fun sum(self: &m::S,_other: &m::S): u64 { + private fun sum(self: &S,_other: &S): u64 { Abort(1) } - private fun test_arg_freeze(s: m::S): u64 { + private fun test_arg_freeze(s: S): u64 { { - let p1: &m::S = Borrow(Immutable)(s); + let p1: &S = Borrow(Immutable)(s); { - let p1m: &mut m::S = Borrow(Mutable)(s); + let p1m: &mut S = Borrow(Mutable)(s); { - let s2: m::S = pack m::S(4); + let s2: S = pack m::S(4); { - let p2: &m::S = Borrow(Immutable)(s2); + let p2: &S = Borrow(Immutable)(s2); { - let p2m: &mut m::S = Borrow(Mutable)(s); + let p2m: &mut S = Borrow(Mutable)(s); { let x1: u64 = m::sum(Freeze(false)(p1m), p1); { @@ -37,3 +37,25 @@ module 0x42::m { } } } // end 0x42::m + +// -- Sourcified model before bytecode pipeline +module 0x42::m { + struct S { + x: u64, + } + fun sum(self: &S, _other: &S): u64 { + abort 1 + } + fun test_arg_freeze(s: S): u64 { + let p1 = &s; + let p1m = &mut s; + let s2 = S{x: 4}; + let p2 = &s2; + let p2m = &mut s; + let x1 = sum(/*freeze*/p1m, p1); + let x2 = sum(/*freeze*/p1m, /*freeze*/p1m); + let x3 = sum(/*freeze*/p1m, p2); + let x4 = sum(/*freeze*/p2m, /*freeze*/p2m); + x1 + x2 + x3 + x4 + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/receiver/decl_errors.exp b/third_party/move/move-compiler-v2/tests/checking/receiver/decl_errors.exp index 8df2af098de89..4f4835bda6621 100644 --- a/third_party/move/move-compiler-v2/tests/checking/receiver/decl_errors.exp +++ b/third_party/move/move-compiler-v2/tests/checking/receiver/decl_errors.exp @@ -45,7 +45,7 @@ module 0x42::m { struct S { x: u64, } - private fun receiver(self: m::S) { + private fun receiver(self: S) { Tuple() } private fun receiver_for_external_type(self: n::T) { @@ -57,10 +57,39 @@ module 0x42::m { private fun receiver_for_primitive(self: &u64) { Tuple() } - private fun receiver_non_linear_instantiated(self: m::G<#0, #0>) { + private fun receiver_non_linear_instantiated(self: G) { Tuple() } - private fun receiver_partial_instantiated(self: m::G) { + private fun receiver_partial_instantiated(self: G) { Tuple() } } // end 0x42::m + +// -- Sourcified model before bytecode pipeline +module 0x42::n { + struct T { + x: u64, + } +} +module 0x42::m { + use 0x42::n; + struct G { + x: T, + y: R, + } + struct S { + x: u64, + } + fun receiver(self: S) { + } + fun receiver_for_external_type(self: n::T) { + } + fun receiver_for_external_vector(self: vector) { + } + fun receiver_for_primitive(self: &u64) { + } + fun receiver_non_linear_instantiated(self: G) { + } + fun receiver_partial_instantiated(self: G) { + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/receiver/dont_warn_unused_self.exp b/third_party/move/move-compiler-v2/tests/checking/receiver/dont_warn_unused_self.exp index 135e3d8795172..2f6c8d9fb2115 100644 --- a/third_party/move/move-compiler-v2/tests/checking/receiver/dont_warn_unused_self.exp +++ b/third_party/move/move-compiler-v2/tests/checking/receiver/dont_warn_unused_self.exp @@ -11,7 +11,7 @@ module 0x42::m { struct S { x: u64, } - private fun receiver(self: m::S,y: u64) { + private fun receiver(self: S,y: u64) { Tuple() } spec { @@ -19,3 +19,12 @@ module 0x42::m { } } // end 0x42::m + +// -- Sourcified model before bytecode pipeline +module 0x42::m { + struct S has drop { + x: u64, + } + fun receiver(self: S, y: u64) { + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/receiver/generic_calls.exp b/third_party/move/move-compiler-v2/tests/checking/receiver/generic_calls.exp index b396815647805..2c10daec390de 100644 --- a/third_party/move/move-compiler-v2/tests/checking/receiver/generic_calls.exp +++ b/third_party/move/move-compiler-v2/tests/checking/receiver/generic_calls.exp @@ -3,30 +3,30 @@ module 0x42::m { struct S { x: #0, } - private fun id(self: m::S<#0>): m::S<#0> { + private fun id(self: S): S { self } - private inline fun inlined(f: |m::S<#0>|m::S<#0>,s: m::S<#0>) { + private inline fun inlined(f: |S|S,s: S) { (f)(s); Tuple() } - private fun receiver(self: m::S<#0>,y: #0) { - select m::S.x>(self) = y; + private fun receiver(self: S,y: T) { + select m::S.x>(self) = y; Tuple() } - private fun receiver_more_generics(self: m::S<#0>,_y: #1) { + private fun receiver_more_generics(self: S,_y: R) { Tuple() } - private fun receiver_needs_type_args(self: m::S<#0>,_y: #0) { + private fun receiver_needs_type_args(self: S,_y: T) { Abort(1) } - private fun receiver_ref(self: &m::S<#0>,_y: #0) { + private fun receiver_ref(self: &S,_y: T) { Tuple() } - private fun receiver_ref_mut(self: &mut m::S<#0>,y: #0) { - select m::S.x<&mut m::S>(self) = y + private fun receiver_ref_mut(self: &mut S,y: T) { + select m::S.x<&mut S>(self) = y } - private fun test_call_styles(s: m::S,x: u64) { + private fun test_call_styles(s: S,x: u64) { m::receiver(s, x); m::receiver_ref(Borrow(Immutable)(s), x); m::receiver_ref_mut(Borrow(Mutable)(s), x); @@ -34,14 +34,54 @@ module 0x42::m { m::receiver_needs_type_args(s, x); Tuple() } - private fun test_receiver_inference(s: m::S) { + private fun test_receiver_inference(s: S) { { - let (s: m::S): (m::S) = Tuple(s); + let (s: S): (S) = Tuple(s); { - let (s: m::S): (m::S) = Tuple(s); + let (s: S): (S) = Tuple(s); m::id(s) }; Tuple() } } } // end 0x42::m + +// -- Sourcified model before bytecode pipeline +module 0x42::m { + struct S { + x: T, + } + fun id(self: S): S { + self + } + inline fun inlined(f: |S|S, s: S) { + f(s); + } + fun receiver(self: S, y: T) { + self.x = y; + } + fun receiver_more_generics(self: S, _y: R) { + } + fun receiver_needs_type_args(self: S, _y: T) { + abort 1 + } + fun receiver_ref(self: &S, _y: T) { + } + fun receiver_ref_mut(self: &mut S, y: T) { + self.x = y + } + fun test_call_styles(s: S, x: u64) { + receiver(s, x); + receiver_ref(&s, x); + receiver_ref_mut(&mut s, x); + receiver_more_generics(s, 22); + receiver_needs_type_args(s, x); + } + fun test_receiver_inference(s: S) { + let (s) = (s); + { + let (s) = (s); + id(s) + }; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/receiver/generic_calls_typed.exp b/third_party/move/move-compiler-v2/tests/checking/receiver/generic_calls_typed.exp index b396815647805..2c10daec390de 100644 --- a/third_party/move/move-compiler-v2/tests/checking/receiver/generic_calls_typed.exp +++ b/third_party/move/move-compiler-v2/tests/checking/receiver/generic_calls_typed.exp @@ -3,30 +3,30 @@ module 0x42::m { struct S { x: #0, } - private fun id(self: m::S<#0>): m::S<#0> { + private fun id(self: S): S { self } - private inline fun inlined(f: |m::S<#0>|m::S<#0>,s: m::S<#0>) { + private inline fun inlined(f: |S|S,s: S) { (f)(s); Tuple() } - private fun receiver(self: m::S<#0>,y: #0) { - select m::S.x>(self) = y; + private fun receiver(self: S,y: T) { + select m::S.x>(self) = y; Tuple() } - private fun receiver_more_generics(self: m::S<#0>,_y: #1) { + private fun receiver_more_generics(self: S,_y: R) { Tuple() } - private fun receiver_needs_type_args(self: m::S<#0>,_y: #0) { + private fun receiver_needs_type_args(self: S,_y: T) { Abort(1) } - private fun receiver_ref(self: &m::S<#0>,_y: #0) { + private fun receiver_ref(self: &S,_y: T) { Tuple() } - private fun receiver_ref_mut(self: &mut m::S<#0>,y: #0) { - select m::S.x<&mut m::S>(self) = y + private fun receiver_ref_mut(self: &mut S,y: T) { + select m::S.x<&mut S>(self) = y } - private fun test_call_styles(s: m::S,x: u64) { + private fun test_call_styles(s: S,x: u64) { m::receiver(s, x); m::receiver_ref(Borrow(Immutable)(s), x); m::receiver_ref_mut(Borrow(Mutable)(s), x); @@ -34,14 +34,54 @@ module 0x42::m { m::receiver_needs_type_args(s, x); Tuple() } - private fun test_receiver_inference(s: m::S) { + private fun test_receiver_inference(s: S) { { - let (s: m::S): (m::S) = Tuple(s); + let (s: S): (S) = Tuple(s); { - let (s: m::S): (m::S) = Tuple(s); + let (s: S): (S) = Tuple(s); m::id(s) }; Tuple() } } } // end 0x42::m + +// -- Sourcified model before bytecode pipeline +module 0x42::m { + struct S { + x: T, + } + fun id(self: S): S { + self + } + inline fun inlined(f: |S|S, s: S) { + f(s); + } + fun receiver(self: S, y: T) { + self.x = y; + } + fun receiver_more_generics(self: S, _y: R) { + } + fun receiver_needs_type_args(self: S, _y: T) { + abort 1 + } + fun receiver_ref(self: &S, _y: T) { + } + fun receiver_ref_mut(self: &mut S, y: T) { + self.x = y + } + fun test_call_styles(s: S, x: u64) { + receiver(s, x); + receiver_ref(&s, x); + receiver_ref_mut(&mut s, x); + receiver_more_generics(s, 22); + receiver_needs_type_args(s, x); + } + fun test_receiver_inference(s: S) { + let (s) = (s); + { + let (s) = (s); + id(s) + }; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/receiver/same_names.exp b/third_party/move/move-compiler-v2/tests/checking/receiver/same_names.exp index b45494f8c2cf6..9f205590de554 100644 --- a/third_party/move/move-compiler-v2/tests/checking/receiver/same_names.exp +++ b/third_party/move/move-compiler-v2/tests/checking/receiver/same_names.exp @@ -3,16 +3,16 @@ module 0x42::b { struct MyOtherList { len: u64, } - public fun len(self: &b::MyOtherList): u64 { - select b::MyOtherList.len<&b::MyOtherList>(self) + public fun len(self: &MyOtherList): u64 { + select b::MyOtherList.len<&MyOtherList>(self) } } // end 0x42::b module 0x42::a { struct MyList { len: u64, } - public fun len(self: &a::MyList): u64 { - select a::MyList.len<&a::MyList>(self) + public fun len(self: &MyList): u64 { + select a::MyList.len<&MyList>(self) } } // end 0x42::a module 0x42::c { @@ -35,3 +35,33 @@ module 0x42::c { } } } // end 0x42::c + +// -- Sourcified model before bytecode pipeline +module 0x42::b { + struct MyOtherList { + len: u64, + } + public fun len(self: &MyOtherList): u64 { + self.len + } +} +module 0x42::a { + struct MyList { + len: u64, + } + public fun len(self: &MyList): u64 { + self.len + } +} +module 0x42::c { + use 0x42::b; + use 0x42::a; + inline fun foo(f: |(a::MyList, b::MyOtherList)|, x: a::MyList, y: b::MyOtherList) { + f(x, y) + } + fun test(x: a::MyList, y: b::MyOtherList) { + let (x,y) = (x, y); + let (x,y) = (x, y); + if (a::len(&x) + b::len(&y) == 1) () else abort 1 + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/receiver/same_names_typed.exp b/third_party/move/move-compiler-v2/tests/checking/receiver/same_names_typed.exp index b45494f8c2cf6..9f205590de554 100644 --- a/third_party/move/move-compiler-v2/tests/checking/receiver/same_names_typed.exp +++ b/third_party/move/move-compiler-v2/tests/checking/receiver/same_names_typed.exp @@ -3,16 +3,16 @@ module 0x42::b { struct MyOtherList { len: u64, } - public fun len(self: &b::MyOtherList): u64 { - select b::MyOtherList.len<&b::MyOtherList>(self) + public fun len(self: &MyOtherList): u64 { + select b::MyOtherList.len<&MyOtherList>(self) } } // end 0x42::b module 0x42::a { struct MyList { len: u64, } - public fun len(self: &a::MyList): u64 { - select a::MyList.len<&a::MyList>(self) + public fun len(self: &MyList): u64 { + select a::MyList.len<&MyList>(self) } } // end 0x42::a module 0x42::c { @@ -35,3 +35,33 @@ module 0x42::c { } } } // end 0x42::c + +// -- Sourcified model before bytecode pipeline +module 0x42::b { + struct MyOtherList { + len: u64, + } + public fun len(self: &MyOtherList): u64 { + self.len + } +} +module 0x42::a { + struct MyList { + len: u64, + } + public fun len(self: &MyList): u64 { + self.len + } +} +module 0x42::c { + use 0x42::b; + use 0x42::a; + inline fun foo(f: |(a::MyList, b::MyOtherList)|, x: a::MyList, y: b::MyOtherList) { + f(x, y) + } + fun test(x: a::MyList, y: b::MyOtherList) { + let (x,y) = (x, y); + let (x,y) = (x, y); + if (a::len(&x) + b::len(&y) == 1) () else abort 1 + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/receiver/vectors.exp b/third_party/move/move-compiler-v2/tests/checking/receiver/vectors.exp index 35e73d04076f8..8fce705c3af8d 100644 --- a/third_party/move/move-compiler-v2/tests/checking/receiver/vectors.exp +++ b/third_party/move/move-compiler-v2/tests/checking/receiver/vectors.exp @@ -1,12 +1,12 @@ // -- Model dump before bytecode pipeline module 0x1::vector { - private fun receiver(self: vector<#0>,_y: #0) { + private fun receiver(self: vector,_y: T) { Tuple() } - private fun receiver_ref(self: &vector<#0>,_y: #0) { + private fun receiver_ref(self: &vector,_y: T) { Tuple() } - private fun receiver_ref_mut(self: &mut vector<#0>,_y: #0) { + private fun receiver_ref_mut(self: &mut vector,_y: T) { Tuple() } private fun test_call_styles(s: vector,x: u64) { @@ -16,3 +16,18 @@ module 0x1::vector { Tuple() } } // end 0x1::vector + +// -- Sourcified model before bytecode pipeline +module 0x1::vector { + fun receiver(self: vector, _y: T) { + } + fun receiver_ref(self: &vector, _y: T) { + } + fun receiver_ref_mut(self: &mut vector, _y: T) { + } + fun test_call_styles(s: vector, x: u64) { + receiver(s, x); + receiver_ref(&s, x); + receiver_ref_mut(&mut s, x); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/assert_skipped_for_spec.exp b/third_party/move/move-compiler-v2/tests/checking/specs/assert_skipped_for_spec.exp index 35729286d8c52..6c0bb9bfdcd4d 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/assert_skipped_for_spec.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/assert_skipped_for_spec.exp @@ -15,3 +15,11 @@ module 0x42::M { Sub(x, 1) } } // end 0x42::M + +// -- Sourcified model before bytecode pipeline +module 0x42::M { + fun bar(x: u64): u64 { + if (x > 0) () else abort 1; + x - 1 + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/conditions_ok.exp b/third_party/move/move-compiler-v2/tests/checking/specs/conditions_ok.exp index 54fe8ac5132a6..5524b749b2ebc 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/conditions_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/conditions_ok.exp @@ -8,7 +8,7 @@ module 0x42::M { Deref(x) } spec { - aborts_if Or(Eq(Freeze(false)($t0), 0), Eq(select M::Ghost$some_global.v(global(0x0)), 0)); + aborts_if Or(Eq(Freeze(false)($t0), 0), Eq(select M::Ghost$some_global.v(global<0x42::M::Ghost$some_global>(0x0)), 0)); ensures Gt(Old($t0), $t0); ensures Eq(result0(), Freeze(false)($t0)); } @@ -20,7 +20,7 @@ module 0x42::M { ensures And(Eq($t0, result0()), Eq(result1(), true)); } - private fun with_emits(_guid: vector,_msg: #0,x: u64): u64 { + private fun with_emits(_guid: vector,_msg: T,x: u64): u64 { x } spec { @@ -30,3 +30,20 @@ module 0x42::M { } } // end 0x42::M + +// -- Sourcified model before bytecode pipeline +module 0x42::M { + struct Ghost$some_global has copy, drop, store, key { + v: u64, + } + fun add_some(x: &mut u64): u64 { + *x = *x + 1; + *x + } + fun multiple_results(x: u64): (u64, bool) { + (x, true) + } + fun with_emits(_guid: vector, _msg: T, x: u64): u64 { + x + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/expressions_ok.exp b/third_party/move/move-compiler-v2/tests/checking/specs/expressions_ok.exp index c1a6dc4437405..cb024a2ab2a64 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/expressions_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/expressions_ok.exp @@ -62,3 +62,7 @@ module 0x42::M { M::generic_function(3, 3) } } // end 0x42::M + +// -- Sourcified model before bytecode pipeline +module 0x42::M { +} diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/inline_fun_in_spec.exp b/third_party/move/move-compiler-v2/tests/checking/specs/inline_fun_in_spec.exp index 07a0195d39472..007310efd886e 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/inline_fun_in_spec.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/inline_fun_in_spec.exp @@ -1,14 +1,14 @@ // -- Model dump before bytecode pipeline module 0x42::m { spec { - invariant forall a: address: TypeDomain
(): Implies(exists(a), { + invariant forall a: address: TypeDomain
(): Implies(exists<0x42::m::S>(a), { let (x: address): (address) = Tuple(a); { let r: bool = { let (a: address): (address) = Tuple(x); - Lt(select m::S.f({ + Lt(select m::S.f<0x42::m::S>({ let (a: address): (address) = Tuple(a); - global(a) + global<0x42::m::S>(a) }), 10) }; r @@ -32,7 +32,7 @@ module 0x42::m { }; } - private inline fun exec(f: |#0|#1,x: #0): #1 { + private inline fun exec(f: |T|R,x: T): R { { let r: R = (f)(x); spec { @@ -74,7 +74,63 @@ module 0x42::m { }); } - private inline fun get(a: address): � { + private inline fun get(a: address): &R { BorrowGlobal(Immutable)(a) } } // end 0x42::m + +// -- Sourcified model before bytecode pipeline +module 0x42::m { + struct S has key { + f: u64, + } + /* + spec { + invariant { + let (x: num): (num) = Tuple(select m::S.f()); + { + let r: bool = { + let (x: num): (num) = Tuple(x); + Gt(x, 0) + }; + r + } + }; + } + + */ + inline fun exec(f: |T|R, x: T): R { + let r = f(x); + + /* spec { + assert Eq<#1>(r, (f)($t1)); + } + */ + ; + r + } + fun function_code_spec_block(x: u64): u64 { + + /* spec { + assert { + let (x: num): (num) = Tuple($t0); + { + let r: bool = { + let (y: num): (num) = Tuple(x); + Gt(y, 0) + }; + r + } + }; + } + */ + ; + x + 1 + } + fun function_spec_block(x: u64): u64 { + x + 1 + } + inline fun get(a: address): &R { + borrow_global(a) + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/inline_fun_in_spec_typed.exp b/third_party/move/move-compiler-v2/tests/checking/specs/inline_fun_in_spec_typed.exp index e3c750934cc8c..06ac84e29aaa4 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/inline_fun_in_spec_typed.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/inline_fun_in_spec_typed.exp @@ -1,14 +1,14 @@ // -- Model dump before bytecode pipeline module 0x42::m { spec { - invariant forall a: address: TypeDomain
(): Implies(exists(a), { + invariant forall a: address: TypeDomain
(): Implies(exists<0x42::m::S>(a), { let (x: address): (address) = Tuple(a); { let r: bool = { let (a: address): (address) = Tuple(x); - Lt(select m::S.f({ + Lt(select m::S.f<0x42::m::S>({ let (a: address): (address) = Tuple(a); - global(a) + global<0x42::m::S>(a) }), 10) }; r @@ -32,7 +32,7 @@ module 0x42::m { }; } - private inline fun exec(f: |#0|#1,x: #0): #1 { + private inline fun exec(f: |T|R,x: T): R { { let r: R = (f)(x); spec { @@ -74,7 +74,63 @@ module 0x42::m { }); } - private inline fun get(a: address): � { + private inline fun get(a: address): &R { BorrowGlobal(Immutable)(a) } } // end 0x42::m + +// -- Sourcified model before bytecode pipeline +module 0x42::m { + struct S has key { + f: u64, + } + /* + spec { + invariant { + let (x: u64): (u64) = Tuple(select m::S.f()); + { + let r: bool = { + let (x: u64): (u64) = Tuple(x); + Gt(x, 0) + }; + r + } + }; + } + + */ + inline fun exec(f: |T|R, x: T): R { + let r = f(x); + + /* spec { + assert Eq<#1>(r, (f)($t1)); + } + */ + ; + r + } + fun function_code_spec_block(x: u64): u64 { + + /* spec { + assert { + let (x: u64): (u64) = Tuple($t0); + { + let r: bool = { + let (y: u64): (u64) = Tuple(x); + Gt(y, 0) + }; + r + } + }; + } + */ + ; + x + 1 + } + fun function_spec_block(x: u64): u64 { + x + 1 + } + inline fun get(a: address): &R { + borrow_global(a) + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/inline_fun_spec_ok.exp b/third_party/move/move-compiler-v2/tests/checking/specs/inline_fun_spec_ok.exp index fc26e019be673..42ce1545caefb 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/inline_fun_spec_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/inline_fun_spec_ok.exp @@ -8,3 +8,16 @@ module 0x42::M { 42 } } // end 0x42::M + +// -- Sourcified model before bytecode pipeline +module 0x42::M { + public inline fun f(): u64 { + + /* spec { + assert true; + } + */ + ; + 42 + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/inline_spec_inference.exp b/third_party/move/move-compiler-v2/tests/checking/specs/inline_spec_inference.exp index 6073b62bbaa43..382979923cce9 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/inline_spec_inference.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/inline_spec_inference.exp @@ -11,3 +11,17 @@ module 0x42::m { } } } // end 0x42::m + +// -- Sourcified model before bytecode pipeline +module 0x42::m { + fun foo() { + let i = 10; + + /* spec { + assert forall j: num: Range(0, i): Lt(j, i); + } + */ + ; + i = i + 1 + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/inline_spec_inference_bitvector.exp b/third_party/move/move-compiler-v2/tests/checking/specs/inline_spec_inference_bitvector.exp index f60c5fa68e8f8..6f8111e4122ff 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/inline_spec_inference_bitvector.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/inline_spec_inference_bitvector.exp @@ -22,3 +22,21 @@ module 0x42::bit_vector_infer { } } } // end 0x42::bit_vector_infer + +// -- Sourcified model before bytecode pipeline +module 0x42::bit_vector_infer { + public fun new(_length: u64) { + let counter = 1; + if (counter > 0) { + counter = counter - 1; + }; + let bit_field = 0x1::vector::empty(); + 0x1::vector::push_back(&mut bit_field, false); + + /* spec { + assert Eq(Len(bit_field), 0); + } + */ + ; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/inline_spec_inference_vector.exp b/third_party/move/move-compiler-v2/tests/checking/specs/inline_spec_inference_vector.exp index d0b499f33c6f9..3034b88d36648 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/inline_spec_inference_vector.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/inline_spec_inference_vector.exp @@ -13,3 +13,17 @@ module 0x42::bit_vector { } } } // end 0x42::bit_vector + +// -- Sourcified model before bytecode pipeline +module 0x42::bit_vector { + public fun new(_length: u64) { + let bit_field = 0x1::vector::empty(); + + /* spec { + assert Eq(Len(bit_field), 0); + } + */ + ; + 0x1::vector::push_back(&mut bit_field, false); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/inline_spec_old.exp b/third_party/move/move-compiler-v2/tests/checking/specs/inline_spec_old.exp index f0d2ba60255f7..fc1cae43ff96c 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/inline_spec_old.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/inline_spec_old.exp @@ -8,3 +8,15 @@ module 0x42::m { Tuple() } } // end 0x42::m + +// -- Sourcified model before bytecode pipeline +module 0x42::m { + public fun foo(vec: &mut vector) { + + /* spec { + assert forall k: num: Range(0, Len($t0)): Eq(Index($t0, k), Index(Old>($t0), k)); + } + */ + ; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/intrinsic_decl_ok.exp b/third_party/move/move-compiler-v2/tests/checking/specs/intrinsic_decl_ok.exp index 6b81d226f4150..04ca7c2e62df2 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/intrinsic_decl_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/intrinsic_decl_ok.exp @@ -12,18 +12,44 @@ module 0x42::M { spec { } - private native fun contains(t: &M::MyTable2<#0, #1>,k: #0): bool; - private native fun borrow(t: &M::MyTable2<#0, #1>,k: #0):  - private native fun borrow_mut(t: &mut M::MyTable1<#0, #1>,k: #0): &mut #1; - private native fun destroy_empty(t: M::MyTable1<#0, #1>); - private native fun length(t: &M::MyTable1<#0, #1>): u64; - private native fun remove(t: &mut M::MyTable2<#0, #1>,k: #0): #1; - private native fun new(): M::MyTable1<#0, #1>; - private native fun new2(): M::MyTable2<#0, #1>; - spec fun spec_len(t: M::MyTable1<#0, #1>): num; - spec fun spec_set(t: M::MyTable1<#0, #1>,k: #0,v: #1): M::MyTable1<#0, #1>; - spec fun spec_get(t: M::MyTable1<#0, #1>,k: #0): #1; - spec fun spec_len2(t: M::MyTable2<#0, #1>): num; - spec fun spec_del(t: M::MyTable2<#0, #1>): num; - spec fun spec_has_key(t: M::MyTable2<#0, #1>,k: #0): bool; + private native fun contains(t: &MyTable2,k: K): bool; + private native fun borrow(t: &MyTable2,k: K): &V; + private native fun borrow_mut(t: &mut MyTable1,k: K): &mut V; + private native fun destroy_empty(t: MyTable1); + private native fun length(t: &MyTable1): u64; + private native fun remove(t: &mut MyTable2,k: K): V; + private native fun new(): MyTable1; + private native fun new2(): MyTable2; + spec fun spec_len(t: MyTable1<#0, #1>): num; + spec fun spec_set(t: MyTable1<#0, #1>,k: #0,v: #1): MyTable1<#0, #1>; + spec fun spec_get(t: MyTable1<#0, #1>,k: #0): #1; + spec fun spec_len2(t: MyTable2<#0, #1>): num; + spec fun spec_del(t: MyTable2<#0, #1>): num; + spec fun spec_has_key(t: MyTable2<#0, #1>,k: #0): bool; } // end 0x42::M + +// -- Sourcified model before bytecode pipeline +module 0x42::M { + struct MyTable1 { + } + /* + spec { + } + + */ + struct MyTable2 { + } + /* + spec { + } + + */ + native fun contains(t: &MyTable2, k: K): bool ; + native fun borrow(t: &MyTable2, k: K): &V ; + native fun borrow_mut(t: &mut MyTable1, k: K): &mut V ; + native fun destroy_empty(t: MyTable1) ; + native fun length(t: &MyTable1): u64 ; + native fun remove(t: &mut MyTable2, k: K): V ; + native fun new(): MyTable1 ; + native fun new2(): MyTable2 ; +} diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/invariants_ok.exp b/third_party/move/move-compiler-v2/tests/checking/specs/invariants_ok.exp index adfbe05e60cbc..a7059c9346e06 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/invariants_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/invariants_ok.exp @@ -1,10 +1,10 @@ // -- Model dump before bytecode pipeline module 0x42::M { struct R { - s: M::S, + s: 0x42::M::S, } spec { - invariant M::less10(true, select M::S.x(select M::R.s())); + invariant M::less10(true, select M::S.x<0x42::M::S>(select M::R.s())); } struct S { @@ -26,3 +26,26 @@ module 0x42::M { M::less10(Not(c), x) } } // end 0x42::M + +// -- Sourcified model before bytecode pipeline +module 0x42::M { + struct R { + s: S, + } + /* + spec { + invariant M::less10(true, select M::S.x<0x42::M::S>(select M::R.s())); + } + + */ + struct S { + x: u64, + y: bool, + } + /* + spec { + invariant Eq(Gt(select M::S.x(), 0), select M::S.y()); + } + + */ +} diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/lets_ok.exp b/third_party/move/move-compiler-v2/tests/checking/specs/lets_ok.exp index 4cba29d734223..a89a56075d873 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/lets_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/lets_ok.exp @@ -11,3 +11,11 @@ module 0x42::M { } } // end 0x42::M + +// -- Sourcified model before bytecode pipeline +module 0x42::M { + fun foo(x: &mut u64): u64 { + *x = *x + 1; + *x + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/move_function_in_spec_ok.exp b/third_party/move/move-compiler-v2/tests/checking/specs/move_function_in_spec_ok.exp index f6a3025c7b239..983ba541a7124 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/move_function_in_spec_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/move_function_in_spec_ok.exp @@ -5,12 +5,12 @@ module 0x42::move_function_in_spec { } private fun foo() { { - let type_info: move_function_in_spec::TypeInfo = move_function_in_spec::type_of(); + let type_info: TypeInfo = move_function_in_spec::type_of(); { - let account_address: address = select move_function_in_spec::TypeInfo.account_address(type_info); + let account_address: address = select move_function_in_spec::TypeInfo.account_address(type_info); spec { assert move_function_in_spec::$no_change(account_address, account_address); - assert Eq
(account_address, select move_function_in_spec::TypeInfo.account_address(move_function_in_spec::$type_of<#0>())); + assert Eq
(account_address, select move_function_in_spec::TypeInfo.account_address<0x42::move_function_in_spec::TypeInfo>(move_function_in_spec::$type_of<#0>())); } ; Tuple() @@ -18,23 +18,50 @@ module 0x42::move_function_in_spec { } } public fun no_change(target: address,new_addr: address): bool - acquires move_function_in_spec::TypeInfo(*) + acquires 0x42::move_function_in_spec::TypeInfo(*) { { - let ty: &move_function_in_spec::TypeInfo = BorrowGlobal(Immutable)(target); - Eq
(select move_function_in_spec::TypeInfo.account_address<&move_function_in_spec::TypeInfo>(ty), new_addr) + let ty: &TypeInfo = BorrowGlobal(Immutable)(target); + Eq
(select move_function_in_spec::TypeInfo.account_address<&TypeInfo>(ty), new_addr) } } - public fun type_of(): move_function_in_spec::TypeInfo { + public fun type_of(): TypeInfo { Abort(1) } spec fun $no_change(target: address,new_addr: address): bool { { - let ty: &move_function_in_spec::TypeInfo = global(target); - Eq
(select move_function_in_spec::TypeInfo.account_address(ty), new_addr) + let ty: &0x42::move_function_in_spec::TypeInfo = global<0x42::move_function_in_spec::TypeInfo>(target); + Eq
(select move_function_in_spec::TypeInfo.account_address<0x42::move_function_in_spec::TypeInfo>(ty), new_addr) } } - spec fun $type_of(): move_function_in_spec::TypeInfo { + spec fun $type_of(): TypeInfo { Tuple() } } // end 0x42::move_function_in_spec + +// -- Sourcified model before bytecode pipeline +module 0x42::move_function_in_spec { + struct TypeInfo has copy, drop, store, key { + account_address: address, + } + fun foo() { + let type_info = type_of(); + let account_address = type_info.account_address; + + /* spec { + assert move_function_in_spec::$no_change(account_address, account_address); + assert Eq
(account_address, select move_function_in_spec::TypeInfo.account_address<0x42::move_function_in_spec::TypeInfo>(move_function_in_spec::$type_of<#0>())); + } + */ + ; + } + public fun no_change(target: address, new_addr: address): bool + acquires TypeInfo + { + let ty = borrow_global(target); + ty.account_address == new_addr + } + public fun type_of(): TypeInfo { + abort 1 + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/quantifiers_ok.exp b/third_party/move/move-compiler-v2/tests/checking/specs/quantifiers_ok.exp index bef42715930d6..113804cb1f31b 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/quantifiers_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/quantifiers_ok.exp @@ -3,10 +3,17 @@ module 0x42::M { struct S { x: u64, } - spec fun exists_in_vector(v: vector): bool { - exists s: M::S: v: Gt(select M::S.x(s), 0) + spec fun exists_in_vector(v: vector): bool { + exists s: 0x42::M::S: v: Gt(select M::S.x<0x42::M::S>(s), 0) } - spec fun some_in_vector(v: vector): M::S { - choose s: M::S: v: Eq(select M::S.x(s), 0) + spec fun some_in_vector(v: vector): S { + choose s: 0x42::M::S: v: Eq(select M::S.x<0x42::M::S>(s), 0) } } // end 0x42::M + +// -- Sourcified model before bytecode pipeline +module 0x42::M { + struct S { + x: u64, + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/schemas_ok.exp b/third_party/move/move-compiler-v2/tests/checking/specs/schemas_ok.exp index 3ef30afac08f9..4c8215291a695 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/schemas_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/schemas_ok.exp @@ -75,3 +75,18 @@ module 0x42::M { } } // end 0x42::M + +// -- Sourcified model before bytecode pipeline +module 0x42::M { + struct S { + x: X, + } + fun add(x: u64): u64 { + x + 1 + } + fun id(x: u64): u64 { + x + } + fun multiple(_x: u64, _y: u64) { + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/structs_ok.exp b/third_party/move/move-compiler-v2/tests/checking/specs/structs_ok.exp index 591fc4fd388df..43214d6022fa7 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/structs_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/structs_ok.exp @@ -8,26 +8,26 @@ module 0x42::M { y: bool, } struct R { - s: M::S, + s: 0x42::M::S, } struct S { x: u64, y: bool, z: vector, } - public fun f(r: M::R): M::T { - pack M::T(select M::S.x(select M::R.s(r))) + public fun f(r: R): T { + pack M::T(select M::S.x(select M::R.s(r))) } - spec fun struct_access(s: M::S): u64 { - select M::S.x(s) + spec fun struct_access(s: S): u64 { + select M::S.x<0x42::M::S>(s) } - spec fun nested_struct_access(r: M::R): bool { - select M::S.y(select M::R.s(r)) + spec fun nested_struct_access(r: R): bool { + select M::S.y<0x42::M::S>(select M::R.s<0x42::M::R>(r)) } - spec fun struct_pack(x: u64,y: bool,z: vector): M::S { + spec fun struct_pack(x: u64,y: bool,z: vector): S { pack M::S(x, y, z) } - spec fun struct_pack_other_order(x: u64,y: bool,z: vector): M::S { + spec fun struct_pack_other_order(x: u64,y: bool,z: vector): S { { let $z: vector = z; { @@ -36,16 +36,38 @@ module 0x42::M { } } } - spec fun generic_struct_pack(x: u64,y: bool): M::G { + spec fun generic_struct_pack(x: u64,y: bool): G { pack M::G(x, y) } - spec fun generic_struct_pack_instantiated(x: u64,y: bool): M::G { + spec fun generic_struct_pack_instantiated(x: u64,y: bool): G { pack M::G(x, y) } - spec fun resource_global(addr: address): M::T { - global(addr) + spec fun resource_global(addr: address): T { + global<0x42::M::T>(addr) } spec fun resource_global_exists(addr: address): bool { - exists(addr) + exists<0x42::M::T>(addr) } } // end 0x42::M + +// -- Sourcified model before bytecode pipeline +module 0x42::M { + struct T has key { + x: u64, + } + struct G { + x: T, + y: bool, + } + struct R has drop { + s: S, + } + struct S has drop { + x: u64, + y: bool, + z: vector, + } + public fun f(r: R): T { + T{x: r.s.x} + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/type_variance_ok.exp b/third_party/move/move-compiler-v2/tests/checking/specs/type_variance_ok.exp index 2c0d1376d130b..a4d2c3eb0a363 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/type_variance_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/type_variance_ok.exp @@ -8,3 +8,10 @@ module 0x42::M { } } // end 0x42::M + +// -- Sourcified model before bytecode pipeline +module 0x42::M { + fun foo(v: vector): vector { + v + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/update_field_ok.exp b/third_party/move/move-compiler-v2/tests/checking/specs/update_field_ok.exp index a808e4517a749..7e15d2d3c36be 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/update_field_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/update_field_ok.exp @@ -4,16 +4,27 @@ module 0x42::update_field_ok { x: u64, y: u64, } - private fun f(r: &mut update_field_ok::R) { - select update_field_ok::R.x<&mut update_field_ok::R>(r) = 1; + private fun f(r: &mut R) { + select update_field_ok::R.x<&mut R>(r) = 1; Tuple() } spec { aborts_if false; - ensures Eq(Freeze(false)($t0), update_field_ok::assign_x_1(Old($t0))); + ensures Eq<0x42::update_field_ok::R>(Freeze(false)($t0), update_field_ok::assign_x_1(Old<0x42::update_field_ok::R>($t0))); } - spec fun assign_x_1(r: update_field_ok::R): update_field_ok::R { - update update_field_ok::R.x(r, 1) + spec fun assign_x_1(r: R): R { + update update_field_ok::R.x<0x42::update_field_ok::R>(r, 1) } } // end 0x42::update_field_ok + +// -- Sourcified model before bytecode pipeline +module 0x42::update_field_ok { + struct R { + x: u64, + y: u64, + } + fun f(r: &mut R) { + r.x = 1; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/annotated_types.exp b/third_party/move/move-compiler-v2/tests/checking/typing/annotated_types.exp index 7547136a5af2a..f9428b593f237 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/annotated_types.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/annotated_types.exp @@ -11,7 +11,22 @@ module 0x8675309::M { 0; pack M::S(false); M::R{ dummy_field: _ } = pack M::R(false); - (_: u64, _: M::S, M::R{ dummy_field: _ }): (u64, M::S, M::R) = Tuple(0, pack M::S(false), pack M::R(false)); + (_: u64, _: S, M::R{ dummy_field: _ }): (u64, S, R) = Tuple(0, pack M::S(false), pack M::R(false)); Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + } + struct S has drop { + } + fun t() { + (); + 0; + S{}; + R{} = R{}; + (_,_,R{}) = (0, S{}, R{}); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/assign_nested2.exp b/third_party/move/move-compiler-v2/tests/checking/typing/assign_nested2.exp index 909472ecef030..b7fe0f0db7198 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/assign_nested2.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/assign_nested2.exp @@ -28,7 +28,7 @@ module 0x8675309::A { { let r_ref: &mut u64 = Borrow(Mutable)(r); { - let s: A::S = pack A::S(0); + let s: S = pack A::S(0); (_: u64, x: u64, _: u64, _: u64): (u64, u64, u64, u64) = A::four(); Tuple() } @@ -37,3 +37,20 @@ module 0x8675309::A { } } } // end 0x8675309::A + +// -- Sourcified model before bytecode pipeline +module 0x8675309::A { + struct S has drop { + f: u64, + } + fun four(): (u64, u64, u64, u64) { + (0, 1, 2, 3) + } + public fun mixed() { + let x; + let r = 0; + let r_ref = &mut r; + let s = S{f: 0}; + (_,x,_,_) = four(); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/assign_tuple_wg.exp b/third_party/move/move-compiler-v2/tests/checking/typing/assign_tuple_wg.exp index a250c827c1d81..bdd2fc85f3254 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/assign_tuple_wg.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/assign_tuple_wg.exp @@ -18,10 +18,27 @@ module 0xc0ffee::dummy2 { struct State { value: u64, } - private fun tuple_assignments(s: &signer,state: dummy2::State) { + private fun tuple_assignments(s: &signer,state: State) { { - let (): () = MoveTo(s, state); + let (): () = MoveTo(s, state); Tuple() } } } // end 0xc0ffee::dummy2 + +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::dummy1 { + fun bar(b: bool) { + let () = if (b) baz(); + } + fun baz() { + } +} +module 0xc0ffee::dummy2 { + struct State has key { + value: u64, + } + fun tuple_assignments(s: &signer, state: State) { + let () = move_to(s, state); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_add.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_add.exp index 499d07865f69a..fd8094767a75d 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_add.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_add.exp @@ -3,7 +3,7 @@ module 0x8675309::M { struct R { f: u64, } - private fun t0(x: u64,r: M::R) { + private fun t0(x: u64,r: R) { 0; 1; 1; @@ -13,11 +13,32 @@ module 0x8675309::M { 1; 1; Add(Copy(x), Move(x)); - Add(select M::R.f(r), select M::R.f(r)); - Add(Add(Add(1, select M::R.f(r)), select M::R.f(r)), 0); + Add(select M::R.f(r), select M::R.f(r)); + Add(Add(Add(1, select M::R.f(r)), select M::R.f(r)), 0); { let M::R{ f: _ } = r; Tuple() } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + f: u64, + } + fun t0(x: u64, r: R) { + 0; + 1; + 1; + 1u8; + 1u8; + 1u128; + 1u128; + 1; + (copy x) + (move x); + r.f + r.f; + 1 + r.f + r.f + 0; + let R{f: _} = r; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_and.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_and.exp index dcc109892aa00..73a8766017937 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_and.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_and.exp @@ -3,13 +3,13 @@ module 0x8675309::M { struct R { f: bool, } - private fun t0(x: bool,r: M::R) { + private fun t0(x: bool,r: R) { false; false; false; true; And(Copy(x), Move(x)); - And(select M::R.f(r), select M::R.f(r)); + And(select M::R.f(r), select M::R.f(r)); false; { let M::R{ f: _ } = r; @@ -17,3 +17,20 @@ module 0x8675309::M { } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + f: bool, + } + fun t0(x: bool, r: R) { + false; + false; + false; + true; + (copy x) && (move x); + r.f && r.f; + false; + let R{f: _} = r; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_and.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_and.exp index 176d035a54ab7..39e24786a4398 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_and.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_and.exp @@ -3,7 +3,7 @@ module 0x8675309::M { struct R { f: u64, } - private fun t0(x: u64,r: M::R) { + private fun t0(x: u64,r: R) { 0; 0; 0; @@ -13,11 +13,32 @@ module 0x8675309::M { 0; 0; BitAnd(Copy(x), Move(x)); - BitAnd(select M::R.f(r), select M::R.f(r)); - BitAnd(BitAnd(BitAnd(1, select M::R.f(r)), select M::R.f(r)), 0); + BitAnd(select M::R.f(r), select M::R.f(r)); + BitAnd(BitAnd(BitAnd(1, select M::R.f(r)), select M::R.f(r)), 0); { let M::R{ f: _ } = r; Tuple() } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + f: u64, + } + fun t0(x: u64, r: R) { + 0; + 0; + 0; + 0u8; + 0u8; + 0u128; + 0u128; + 0; + (copy x) & (move x); + r.f & r.f; + 1 & r.f & r.f & 0; + let R{f: _} = r; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_or.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_or.exp index a0dd5a3086d89..ce3e511d8babf 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_or.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_or.exp @@ -3,7 +3,7 @@ module 0x8675309::M { struct R { f: u64, } - private fun t0(x: u64,r: M::R) { + private fun t0(x: u64,r: R) { 0; 1; 1; @@ -13,11 +13,32 @@ module 0x8675309::M { 1; 1; BitOr(Copy(x), Move(x)); - BitOr(select M::R.f(r), select M::R.f(r)); - BitOr(BitOr(BitOr(1, select M::R.f(r)), select M::R.f(r)), 0); + BitOr(select M::R.f(r), select M::R.f(r)); + BitOr(BitOr(BitOr(1, select M::R.f(r)), select M::R.f(r)), 0); { let M::R{ f: _ } = r; Tuple() } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + f: u64, + } + fun t0(x: u64, r: R) { + 0; + 1; + 1; + 1u8; + 1u8; + 1u128; + 1u128; + 1; + (copy x) | (move x); + r.f | r.f; + 1 | r.f | r.f | 0; + let R{f: _} = r; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_div.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_div.exp index 619ea3afb311a..0495092f02468 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_div.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_div.exp @@ -3,7 +3,7 @@ module 0x8675309::M { struct R { f: u64, } - private fun t0(x: u64,r: M::R) { + private fun t0(x: u64,r: R) { Div(0, 0); Div(1, 0); 0; @@ -13,11 +13,32 @@ module 0x8675309::M { 0; 0; Div(Copy(x), Move(x)); - Div(select M::R.f(r), select M::R.f(r)); - Div(Div(Div(1, select M::R.f(r)), select M::R.f(r)), 0); + Div(select M::R.f(r), select M::R.f(r)); + Div(Div(Div(1, select M::R.f(r)), select M::R.f(r)), 0); { let M::R{ f: _ } = r; Tuple() } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + f: u64, + } + fun t0(x: u64, r: R) { + 0 / 0; + 1 / 0; + 0; + 0u8; + 0u8; + 0u128; + 0u128; + 0; + (copy x) / (move x); + r.f / r.f; + 1 / r.f / r.f / 0; + let R{f: _} = r; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_geq.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_geq.exp index 1cb8410cde8ec..2a29ec5402b29 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_geq.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_geq.exp @@ -3,7 +3,7 @@ module 0x8675309::M { struct R { f: u64, } - private fun t0(x: u64,r: M::R) { + private fun t0(x: u64,r: R) { true; true; false; @@ -13,11 +13,32 @@ module 0x8675309::M { false; false; Ge(Copy(x), Move(x)); - Ge(select M::R.f(r), select M::R.f(r)); - And(Ge(1, select M::R.f(r)), Ge(select M::R.f(r), 0)); + Ge(select M::R.f(r), select M::R.f(r)); + And(Ge(1, select M::R.f(r)), Ge(select M::R.f(r), 0)); { let M::R{ f: _ } = r; Tuple() } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + f: u64, + } + fun t0(x: u64, r: R) { + true; + true; + false; + false; + false; + false; + false; + false; + (copy x) >= (move x); + r.f >= r.f; + 1 >= r.f && r.f >= 0; + let R{f: _} = r; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_gt.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_gt.exp index 550c2c2a85560..f8b6c74e19878 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_gt.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_gt.exp @@ -3,7 +3,7 @@ module 0x8675309::M { struct R { f: u64, } - private fun t0(x: u64,r: M::R) { + private fun t0(x: u64,r: R) { false; true; false; @@ -13,11 +13,32 @@ module 0x8675309::M { false; false; Gt(Copy(x), Move(x)); - Gt(select M::R.f(r), select M::R.f(r)); - And(Gt(1, select M::R.f(r)), Gt(select M::R.f(r), 0)); + Gt(select M::R.f(r), select M::R.f(r)); + And(Gt(1, select M::R.f(r)), Gt(select M::R.f(r), 0)); { let M::R{ f: _ } = r; Tuple() } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + f: u64, + } + fun t0(x: u64, r: R) { + false; + true; + false; + false; + false; + false; + false; + false; + (copy x) > (move x); + r.f > r.f; + 1 > r.f && r.f > 0; + let R{f: _} = r; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_leq.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_leq.exp index 72c2b34c7462a..7d4f67a317c34 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_leq.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_leq.exp @@ -3,7 +3,7 @@ module 0x8675309::M { struct R { f: u64, } - private fun t0(x: u64,r: M::R) { + private fun t0(x: u64,r: R) { true; false; true; @@ -13,11 +13,32 @@ module 0x8675309::M { true; true; Le(Copy(x), Move(x)); - Le(select M::R.f(r), select M::R.f(r)); - And(Le(1, select M::R.f(r)), Le(select M::R.f(r), 0)); + Le(select M::R.f(r), select M::R.f(r)); + And(Le(1, select M::R.f(r)), Le(select M::R.f(r), 0)); { let M::R{ f: _ } = r; Tuple() } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + f: u64, + } + fun t0(x: u64, r: R) { + true; + false; + true; + true; + true; + true; + true; + true; + (copy x) <= (move x); + r.f <= r.f; + 1 <= r.f && r.f <= 0; + let R{f: _} = r; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_lt.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_lt.exp index 39c7c05043c27..a39b2db954320 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_lt.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_lt.exp @@ -3,7 +3,7 @@ module 0x8675309::M { struct R { f: u64, } - private fun t0(x: u64,r: M::R) { + private fun t0(x: u64,r: R) { false; false; true; @@ -13,11 +13,32 @@ module 0x8675309::M { true; true; Lt(Copy(x), Move(x)); - Lt(select M::R.f(r), select M::R.f(r)); - And(Lt(1, select M::R.f(r)), Lt(select M::R.f(r), 0)); + Lt(select M::R.f(r), select M::R.f(r)); + And(Lt(1, select M::R.f(r)), Lt(select M::R.f(r), 0)); { let M::R{ f: _ } = r; Tuple() } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + f: u64, + } + fun t0(x: u64, r: R) { + false; + false; + true; + true; + true; + true; + true; + true; + (copy x) < (move x); + r.f < r.f; + 1 < r.f && r.f < 0; + let R{f: _} = r; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_mod.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_mod.exp index 354e15f5bb020..5821dccc1c2b3 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_mod.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_mod.exp @@ -3,7 +3,7 @@ module 0x8675309::M { struct R { f: u64, } - private fun t0(x: u64,r: M::R) { + private fun t0(x: u64,r: R) { Mod(0, 0); Mod(1, 0); 0; @@ -13,11 +13,32 @@ module 0x8675309::M { 0; 0; Mod(Copy(x), Move(x)); - Mod(select M::R.f(r), select M::R.f(r)); - Mod(Mod(Mod(1, select M::R.f(r)), select M::R.f(r)), 0); + Mod(select M::R.f(r), select M::R.f(r)); + Mod(Mod(Mod(1, select M::R.f(r)), select M::R.f(r)), 0); { let M::R{ f: _ } = r; Tuple() } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + f: u64, + } + fun t0(x: u64, r: R) { + 0 % 0; + 1 % 0; + 0; + 0u8; + 0u8; + 0u128; + 0u128; + 0; + (copy x) % (move x); + r.f % r.f; + 1 % r.f % r.f % 0; + let R{f: _} = r; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_mul.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_mul.exp index 061c338dc982b..f2796fad68ebc 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_mul.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_mul.exp @@ -3,7 +3,7 @@ module 0x8675309::M { struct R { f: u64, } - private fun t0(x: u64,r: M::R) { + private fun t0(x: u64,r: R) { 0; 0; 0; @@ -13,11 +13,32 @@ module 0x8675309::M { 0; 0; Mul(Copy(x), Move(x)); - Mul(select M::R.f(r), select M::R.f(r)); - Mul(Mul(Mul(1, select M::R.f(r)), select M::R.f(r)), 0); + Mul(select M::R.f(r), select M::R.f(r)); + Mul(Mul(Mul(1, select M::R.f(r)), select M::R.f(r)), 0); { let M::R{ f: _ } = r; Tuple() } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + f: u64, + } + fun t0(x: u64, r: R) { + 0; + 0; + 0; + 0u8; + 0u8; + 0u128; + 0u128; + 0; + (copy x) * (move x); + r.f * r.f; + 1 * r.f * r.f * 0; + let R{f: _} = r; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_or.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_or.exp index ba12114e3fabb..3f789c99b0013 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_or.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_or.exp @@ -3,13 +3,13 @@ module 0x8675309::M { struct R { f: bool, } - private fun t0(x: bool,r: M::R) { + private fun t0(x: bool,r: R) { true; true; true; true; Or(Copy(x), Move(x)); - Or(select M::R.f(r), select M::R.f(r)); + Or(select M::R.f(r), select M::R.f(r)); true; { let M::R{ f: _ } = r; @@ -17,3 +17,20 @@ module 0x8675309::M { } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + f: bool, + } + fun t0(x: bool, r: R) { + true; + true; + true; + true; + (copy x) || (move x); + r.f || r.f; + true; + let R{f: _} = r; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_shl.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_shl.exp index d5774d480eedc..3b588ae51c05d 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_shl.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_shl.exp @@ -4,7 +4,7 @@ module 0x8675309::M { f: u64, b: u8, } - private fun t0(x: u64,b: u8,r: M::R) { + private fun t0(x: u64,b: u8,r: R) { 0; 1; 0; @@ -13,8 +13,29 @@ module 0x8675309::M { 0; 0; Shl(Copy(x), Copy(b)); - Shl(select M::R.f(r), select M::R.b(r)); - Shl(Shl(Shl(1, select M::R.b(r)), select M::R.b(r)), 0); + Shl(select M::R.f(r), select M::R.b(r)); + Shl(Shl(Shl(1, select M::R.b(r)), select M::R.b(r)), 0); M::R{ f: _, b: _ } = r } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + f: u64, + b: u8, + } + fun t0(x: u64, b: u8, r: R) { + 0; + 1; + 0; + 0; + 1u8; + 0u128; + 0; + (copy x) << (copy b); + r.f << r.b; + 1 << r.b << r.b << 0u8; + R{f: _,b: _} = r + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_shr.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_shr.exp index 9f84205f4b470..83b8b2181e934 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_shr.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_shr.exp @@ -4,7 +4,7 @@ module 0x8675309::M { f: u64, b: u8, } - private fun t0(x: u64,b: u8,r: M::R) { + private fun t0(x: u64,b: u8,r: R) { 0; 1; 0; @@ -13,8 +13,29 @@ module 0x8675309::M { 0; 0; Shr(Copy(x), Copy(b)); - Shr(select M::R.f(r), select M::R.b(r)); - Shr(Shr(Shr(1, select M::R.b(r)), select M::R.b(r)), 0); + Shr(select M::R.f(r), select M::R.b(r)); + Shr(Shr(Shr(1, select M::R.b(r)), select M::R.b(r)), 0); M::R{ f: _, b: _ } = r } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + f: u64, + b: u8, + } + fun t0(x: u64, b: u8, r: R) { + 0; + 1; + 0; + 0; + 1u8; + 0u128; + 0; + (copy x) >> (copy b); + r.f >> r.b; + 1 >> r.b >> r.b >> 0u8; + R{f: _,b: _} = r + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_sub.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_sub.exp index 7165eb499e522..bd16e85576bda 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_sub.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_sub.exp @@ -3,7 +3,7 @@ module 0x8675309::M { struct R { f: u64, } - private fun t0(x: u64,r: M::R) { + private fun t0(x: u64,r: R) { 0; 1; Sub(0, 1); @@ -13,11 +13,32 @@ module 0x8675309::M { Sub(0, 1); Sub(0, 1); Sub(Copy(x), Move(x)); - Sub(select M::R.f(r), select M::R.f(r)); - Sub(Sub(Sub(1, select M::R.f(r)), select M::R.f(r)), 0); + Sub(select M::R.f(r), select M::R.f(r)); + Sub(Sub(Sub(1, select M::R.f(r)), select M::R.f(r)), 0); { let M::R{ f: _ } = r; Tuple() } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + f: u64, + } + fun t0(x: u64, r: R) { + 0; + 1; + 0 - 1; + 0u8 - 1u8; + 0u8 - 1u8; + 0u128 - 1u128; + 0u128 - 1u128; + 0 - 1; + (copy x) - (move x); + r.f - r.f; + 1 - r.f - r.f - 0; + let R{f: _} = r; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_xor.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_xor.exp index e0ca221882df9..0d24ebfbf52cb 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_xor.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_xor.exp @@ -3,7 +3,7 @@ module 0x8675309::M { struct R { f: u64, } - private fun t0(x: u64,r: M::R) { + private fun t0(x: u64,r: R) { 0; 1; 1; @@ -13,11 +13,32 @@ module 0x8675309::M { 1; 1; Xor(Copy(x), Move(x)); - Xor(select M::R.f(r), select M::R.f(r)); - Xor(Xor(Xor(1, select M::R.f(r)), select M::R.f(r)), 0); + Xor(select M::R.f(r), select M::R.f(r)); + Xor(Xor(Xor(1, select M::R.f(r)), select M::R.f(r)), 0); { let M::R{ f: _ } = r; Tuple() } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + f: u64, + } + fun t0(x: u64, r: R) { + 0; + 1; + 1; + 1u8; + 1u8; + 1u128; + 1u128; + 1; + (copy x) ^ (move x); + r.f ^ r.f; + 1 ^ r.f ^ r.f ^ 0; + let R{f: _} = r; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/bind_with_type_annot.exp b/third_party/move/move-compiler-v2/tests/checking/typing/bind_with_type_annot.exp index 76be5734e6def..622c066db0cde 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/bind_with_type_annot.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/bind_with_type_annot.exp @@ -6,7 +6,7 @@ module 0x8675309::M { private fun t0() { 0; { - let (x: u64, b: bool, M::R{ f }): (u64, bool, M::R) = Tuple(0, false, pack M::R(0)); + let (x: u64, b: bool, M::R{ f }): (u64, bool, R) = Tuple(0, false, pack M::R(0)); 0; false; 0; @@ -14,3 +14,17 @@ module 0x8675309::M { } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + f: u64, + } + fun t0() { + 0; + let (x,b,R{f: f}) = (0, false, R{f: 0}); + 0; + false; + 0; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/block_empty.exp b/third_party/move/move-compiler-v2/tests/checking/typing/block_empty.exp index 010d6c24957fd..6d5fb67404227 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/block_empty.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/block_empty.exp @@ -7,3 +7,12 @@ module 0x8675309::M { Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + fun t0() { + (); + (); + (); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/block_single_expr.exp b/third_party/move/move-compiler-v2/tests/checking/typing/block_single_expr.exp index d443f1578d571..998992acaf010 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/block_single_expr.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/block_single_expr.exp @@ -12,3 +12,16 @@ module 0x8675309::M { Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + } + fun t0() { + 0; + &0; + &mut 0; + R{} = R{}; + (0, false); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/block_with_statements.exp b/third_party/move/move-compiler-v2/tests/checking/typing/block_with_statements.exp index ab55de9be63c6..01a807ee43c9e 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/block_with_statements.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/block_with_statements.exp @@ -8,8 +8,8 @@ module 0x8675309::M { Borrow(Immutable)(0); Borrow(Mutable)(1); M::R{ dummy_field: _ } = { - let r: M::R = { - let r: M::R = pack M::R(false); + let r: R = { + let r: R = pack M::R(false); r }; r @@ -18,3 +18,22 @@ module 0x8675309::M { Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + } + fun t0() { + 0; + &0; + &mut 1; + R{} = { + let r = { + let r = R{}; + r + }; + r + }; + (0, false); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/borrow_field.exp b/third_party/move/move-compiler-v2/tests/checking/typing/borrow_field.exp index aa470df8dbe0c..6da28f42b0d35 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/borrow_field.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/borrow_field.exp @@ -3,7 +3,17 @@ module 0x8675309::M { struct S { f: u64, } - private fun t0(s: &M::S,s_mut: &mut M::S,s_mut2: &mut M::S): (&u64, &u64, &mut u64) { - Tuple(Borrow(Immutable)(select M::S.f<&M::S>(s)), Borrow(Immutable)(select M::S.f<&mut M::S>(s_mut)), Borrow(Mutable)(select M::S.f<&mut M::S>(s_mut2))) + private fun t0(s: &S,s_mut: &mut S,s_mut2: &mut S): (&u64, &u64, &mut u64) { + Tuple(Borrow(Immutable)(select M::S.f<&S>(s)), Borrow(Immutable)(select M::S.f<&mut S>(s_mut)), Borrow(Mutable)(select M::S.f<&mut S>(s_mut2))) } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct S { + f: u64, + } + fun t0(s: &S, s_mut: &mut S, s_mut2: &mut S): (&u64, &u64, &mut u64) { + (&s.f, &s_mut.f, &mut s_mut2.f) + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/borrow_field_chain.exp b/third_party/move/move-compiler-v2/tests/checking/typing/borrow_field_chain.exp index 94a934431a457..70d4ba0fd60ae 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/borrow_field_chain.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/borrow_field_chain.exp @@ -1,24 +1,48 @@ // -- Model dump before bytecode pipeline module 0x8675309::M { struct X1 { - x2: M::X2, + x2: 0x8675309::M::X2, } struct X2 { - x3: M::X3, + x3: 0x8675309::M::X3, } struct X3 { f: u64, } - private fun t0(x1: &M::X1,x1_mut: &mut M::X1) { - Borrow(Immutable)(select M::X1.x2<&M::X1>(x1)); - Borrow(Immutable)(select M::X2.x3(select M::X1.x2<&M::X1>(x1))); - Borrow(Immutable)(select M::X3.f(select M::X2.x3(select M::X1.x2<&M::X1>(x1)))); - Borrow(Immutable)(select M::X1.x2<&mut M::X1>(x1_mut)); - Borrow(Immutable)(select M::X2.x3(select M::X1.x2<&mut M::X1>(x1_mut))); - Borrow(Immutable)(select M::X3.f(select M::X2.x3(select M::X1.x2<&mut M::X1>(x1_mut)))); - Borrow(Mutable)(select M::X1.x2<&mut M::X1>(x1_mut)); - Borrow(Mutable)(select M::X2.x3(select M::X1.x2<&mut M::X1>(x1_mut))); - Borrow(Mutable)(select M::X3.f(select M::X2.x3(select M::X1.x2<&mut M::X1>(x1_mut)))); + private fun t0(x1: &X1,x1_mut: &mut X1) { + Borrow(Immutable)(select M::X1.x2<&X1>(x1)); + Borrow(Immutable)(select M::X2.x3(select M::X1.x2<&X1>(x1))); + Borrow(Immutable)(select M::X3.f(select M::X2.x3(select M::X1.x2<&X1>(x1)))); + Borrow(Immutable)(select M::X1.x2<&mut X1>(x1_mut)); + Borrow(Immutable)(select M::X2.x3(select M::X1.x2<&mut X1>(x1_mut))); + Borrow(Immutable)(select M::X3.f(select M::X2.x3(select M::X1.x2<&mut X1>(x1_mut)))); + Borrow(Mutable)(select M::X1.x2<&mut X1>(x1_mut)); + Borrow(Mutable)(select M::X2.x3(select M::X1.x2<&mut X1>(x1_mut))); + Borrow(Mutable)(select M::X3.f(select M::X2.x3(select M::X1.x2<&mut X1>(x1_mut)))); Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct X1 { + x2: X2, + } + struct X2 { + x3: X3, + } + struct X3 { + f: u64, + } + fun t0(x1: &X1, x1_mut: &mut X1) { + &x1.x2; + &x1.x2.x3; + &x1.x2.x3.f; + &x1_mut.x2; + &x1_mut.x2.x3; + &x1_mut.x2.x3.f; + &mut x1_mut.x2; + &mut x1_mut.x2.x3; + &mut x1_mut.x2.x3.f; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/borrow_field_complex_root_expr.exp b/third_party/move/move-compiler-v2/tests/checking/typing/borrow_field_complex_root_expr.exp index 2fc210c2e303e..8effc39a97ef2 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/borrow_field_complex_root_expr.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/borrow_field_complex_root_expr.exp @@ -3,36 +3,54 @@ module 0x8675309::M { struct S { f: u64, } - private fun t0(cond: bool,s: &M::S,s_mut: &mut M::S) { - Borrow(Immutable)(select M::S.f<&M::S>(if cond { + private fun t0(cond: bool,s: &S,s_mut: &mut S) { + Borrow(Immutable)(select M::S.f<&S>(if cond { s } else { s })); - Borrow(Immutable)(select M::S.f<&M::S>(if cond { + Borrow(Immutable)(select M::S.f<&S>(if cond { Freeze(false)(s_mut) } else { s })); - Borrow(Immutable)(select M::S.f<&M::S>(if cond { + Borrow(Immutable)(select M::S.f<&S>(if cond { s } else { Freeze(false)(s_mut) })); - Borrow(Immutable)(select M::S.f<&mut M::S>(if cond { + Borrow(Immutable)(select M::S.f<&mut S>(if cond { s_mut } else { s_mut })); - Borrow(Mutable)(select M::S.f<&mut M::S>(if cond { + Borrow(Mutable)(select M::S.f<&mut S>(if cond { s_mut } else { s_mut })); - Borrow(Immutable)(select M::S.f<&M::S>({ - let s: M::S = pack M::S(0); + Borrow(Immutable)(select M::S.f<&S>({ + let s: S = pack M::S(0); Borrow(Immutable)(s) })); Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct S has drop { + f: u64, + } + fun t0(cond: bool, s: &S, s_mut: &mut S) { + &(if (cond) s else s).f; + &(if (cond) /*freeze*/s_mut else s).f; + &(if (cond) s else /*freeze*/s_mut).f; + &(if (cond) s_mut else s_mut).f; + &mut (if (cond) s_mut else s_mut).f; + &{ + let s = S{f: 0}; + &s + }.f; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/borrow_field_non_ref_root.exp b/third_party/move/move-compiler-v2/tests/checking/typing/borrow_field_non_ref_root.exp index 0a38afe6bcae3..d3eaf882a2445 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/borrow_field_non_ref_root.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/borrow_field_non_ref_root.exp @@ -3,15 +3,15 @@ module 0x8675309::M { struct S { f: u64, } - private fun t0(cond: bool,s: M::S) { - Borrow(Immutable)(select M::S.f(s)); - Borrow(Mutable)(select M::S.f(s)); - Borrow(Immutable)(select M::S.f(if cond { + private fun t0(cond: bool,s: S) { + Borrow(Immutable)(select M::S.f(s)); + Borrow(Mutable)(select M::S.f(s)); + Borrow(Immutable)(select M::S.f(if cond { pack M::S(0) } else { pack M::S(1) })); - Borrow(Mutable)(select M::S.f(if cond { + Borrow(Mutable)(select M::S.f(if cond { pack M::S(0) } else { pack M::S(1) @@ -19,3 +19,16 @@ module 0x8675309::M { Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct S has drop { + f: u64, + } + fun t0(cond: bool, s: S) { + &s.f; + &mut s.f; + &(if (cond) S{f: 0} else S{f: 1}).f; + &mut (if (cond) S{f: 0} else S{f: 1}).f; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/borrow_local.exp b/third_party/move/move-compiler-v2/tests/checking/typing/borrow_local.exp index 8ad47b62f6fa0..c048387e43b32 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/borrow_local.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/borrow_local.exp @@ -6,7 +6,7 @@ module 0x8675309::M { struct S { dummy_field: bool, } - private fun t0(b: bool,u: u64,s: M::S,r: M::R): M::R { + private fun t0(b: bool,u: u64,s: S,r: R): R { Borrow(Immutable)(b); Borrow(Mutable)(b); Borrow(Immutable)(u); @@ -17,15 +17,15 @@ module 0x8675309::M { Borrow(Mutable)(r); r } - private fun t1(): M::R { + private fun t1(): R { { let b: bool = true; { let u: u64 = 0; { - let s: M::S = pack M::S(false); + let s: S = pack M::S(false); { - let r: M::R = pack M::R(false); + let r: R = pack M::R(false); Borrow(Immutable)(b); Borrow(Mutable)(b); Borrow(Immutable)(u); @@ -41,3 +41,37 @@ module 0x8675309::M { } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + } + struct S has drop { + } + fun t0(b: bool, u: u64, s: S, r: R): R { + &b; + &mut b; + &u; + &mut u; + &s; + &mut s; + &r; + &mut r; + r + } + fun t1(): R { + let b = true; + let u = 0; + let s = S{}; + let r = R{}; + &b; + &mut b; + &u; + &mut u; + &s; + &mut s; + &r; + &mut r; + r + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/borrow_local_temp.exp b/third_party/move/move-compiler-v2/tests/checking/typing/borrow_local_temp.exp index 7a4a44001c2a9..695b878ef0ff7 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/borrow_local_temp.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/borrow_local_temp.exp @@ -16,3 +16,19 @@ module 0x8675309::M { Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + } + struct S has drop { + } + fun t0() { + &true; + &mut false; + &0; + &mut 1; + &S{}; + &mut S{}; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/break_any_type.exp b/third_party/move/move-compiler-v2/tests/checking/typing/break_any_type.exp index cd7b6720f3e26..88c5ed384a9da 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/break_any_type.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/break_any_type.exp @@ -3,7 +3,7 @@ module 0x8675309::M { struct Coin { dummy_field: bool, } - private fun foo(c: M::Coin) { + private fun foo(c: Coin) { M::Coin{ dummy_field: _ } = c; Tuple() } @@ -27,3 +27,20 @@ module 0x8675309::M { } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct Coin { + } + fun foo(c: Coin) { + Coin{} = c; + } + fun t0() { + while (true) { + 0 + (break); + } + } + fun t1() { + while (true) foo(break) + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/break_outside_loop.exp b/third_party/move/move-compiler-v2/tests/checking/typing/break_outside_loop.exp index a670f268e2b0c..f403ecd7de819 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/break_outside_loop.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/break_outside_loop.exp @@ -24,6 +24,21 @@ module 0x8675309::M { } } // end 0x8675309::M +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + fun bar() { + break; + } + fun baz(x: u64): u64 { + if (x >= 5) break; + 0 + } + fun foo() { + while (true) break; + break + } +} + Diagnostics: error: missing enclosing loop statement diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/cast.exp b/third_party/move/move-compiler-v2/tests/checking/typing/cast.exp index bf716645ad244..59ec0b8dcbb7a 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/cast.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/cast.exp @@ -37,3 +37,20 @@ module 0x8675309::M { } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + fun t0(x8: u8, x64: u64, x128: u128) { + let _ = x8; + let _ = x64; + let _ = x128; + let _ = x64 as u8; + let _ = x128 as u64; + let _ = x8 as u128; + let _ = x128 as u8; + let _ = x8 as u64; + let _ = x64 as u128; + let _ = 340282366920938463463374607431768211455u128 as u8; + let _ = 340282366920938463463374607431768211455u128 as u64; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/constant_all_valid_types.exp b/third_party/move/move-compiler-v2/tests/checking/typing/constant_all_valid_types.exp index f66ba14550703..39492187167e2 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/constant_all_valid_types.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/constant_all_valid_types.exp @@ -41,3 +41,46 @@ module _0 { Tuple() } } // end _0 + +// -- Sourcified model before bytecode pipeline +module 0x42::M { + fun t1(): u8 { + 0u8 + } + fun t2(): u64 { + 0 + } + fun t3(): u128 { + 0u128 + } + fun t4(): bool { + false + } + fun t5(): address { + 0x0 + } + fun t6(): vector { + vector[1u8, 35u8] + } + fun t7(): vector { + vector[97u8, 98u8, 99u8, 100u8] + } + fun t8(): vector
{ + vector[0x0, 0x1] + } + fun t9(): u8 { + 0u8 + } +} +script { + fun t() { + 0u8; + 0; + 0u128; + false; + 0x0; + vector[1u8, 35u8]; + vector[97u8, 98u8, 99u8, 100u8]; + vector[0x0, 0x1]; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/constant_folding.exp b/third_party/move/move-compiler-v2/tests/checking/typing/constant_folding.exp index 097ca8ea8e451..0df0d44c38389 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/constant_folding.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/constant_folding.exp @@ -1,3 +1,7 @@ // -- Model dump before bytecode pipeline module 0x42::constant_folding { } // end 0x42::constant_folding + +// -- Sourcified model before bytecode pipeline +module 0x42::constant_folding { +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/constant_supported_exps.exp b/third_party/move/move-compiler-v2/tests/checking/typing/constant_supported_exps.exp index c5c471f77575f..5fa35de19b8d6 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/constant_supported_exps.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/constant_supported_exps.exp @@ -1,3 +1,7 @@ // -- Model dump before bytecode pipeline module 0x42::M { } // end 0x42::M + +// -- Sourcified model before bytecode pipeline +module 0x42::M { +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/continue_any_type.exp b/third_party/move/move-compiler-v2/tests/checking/typing/continue_any_type.exp index d24bcf657bd5c..2799fd5291964 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/continue_any_type.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/continue_any_type.exp @@ -3,7 +3,7 @@ module 0x8675309::M { struct Coin { dummy_field: bool, } - private fun foo(c: M::Coin) { + private fun foo(c: Coin) { M::Coin{ dummy_field: _ } = c; Tuple() } @@ -27,3 +27,20 @@ module 0x8675309::M { } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct Coin { + } + fun foo(c: Coin) { + Coin{} = c; + } + fun t0() { + while (true) { + 0 + (continue); + } + } + fun t1() { + while (true) foo(continue) + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/continue_outside_loop.exp b/third_party/move/move-compiler-v2/tests/checking/typing/continue_outside_loop.exp index e77ad864b8a12..674634a3cf6e1 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/continue_outside_loop.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/continue_outside_loop.exp @@ -12,6 +12,14 @@ module 0x8675309::M { } } // end 0x8675309::M +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + fun foo() { + while (true) continue; + continue + } +} + Diagnostics: error: missing enclosing loop statement diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/decl_unpack_references.exp b/third_party/move/move-compiler-v2/tests/checking/typing/decl_unpack_references.exp index 9a0164bc1800c..d6881be7a2b73 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/decl_unpack_references.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/decl_unpack_references.exp @@ -1,8 +1,8 @@ // -- Model dump before bytecode pipeline module 0x8675309::M { struct R { - s1: M::S, - s2: M::S, + s1: 0x8675309::M::S, + s2: 0x8675309::M::S, } struct S { f: u64, @@ -12,7 +12,7 @@ module 0x8675309::M { let M::R{ s1: M::S{ f }, s2 }; f: u64 = 0; f; - s2: M::S = pack M::S(0); + s2: S = pack M::S(0); s2; Tuple() } @@ -22,7 +22,7 @@ module 0x8675309::M { let M::R{ s1: M::S{ f }, s2 }; f: &u64 = Borrow(Immutable)(0); f; - s2: &M::S = Borrow(Immutable)(pack M::S(0)); + s2: &S = Borrow(Immutable)(pack M::S(0)); s2; Tuple() } @@ -32,9 +32,41 @@ module 0x8675309::M { let M::R{ s1: M::S{ f }, s2 }; f: &mut u64 = Borrow(Mutable)(0); f; - s2: &mut M::S = Borrow(Mutable)(pack M::S(0)); + s2: &mut S = Borrow(Mutable)(pack M::S(0)); s2; Tuple() } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + s1: S, + s2: S, + } + struct S has drop { + f: u64, + } + fun t0() { + let R{s1: S{f: f},s2: s2}; + f = 0; + f; + s2 = S{f: 0}; + s2; + } + fun t1() { + let R{s1: S{f: f},s2: s2}; + f = &0; + f; + s2 = &S{f: 0}; + s2; + } + fun t2() { + let R{s1: S{f: f},s2: s2}; + f = &mut 0; + f; + s2 = &mut S{f: 0}; + s2; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/declare_with_type_annot.exp b/third_party/move/move-compiler-v2/tests/checking/typing/declare_with_type_annot.exp index 1963ff3280348..c92de114750b8 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/declare_with_type_annot.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/declare_with_type_annot.exp @@ -31,8 +31,18 @@ module 0x8675309::M { } private fun t0() { { - let (x: u64, b: bool, M::R{ f }): (u64, bool, M::R); + let (x: u64, b: bool, M::R{ f }): (u64, bool, R); Tuple() } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + f: u64, + } + fun t0() { + let (x,b,R{f: f}); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/derefrence.exp b/third_party/move/move-compiler-v2/tests/checking/typing/derefrence.exp index bf84fdebe47b4..8c7a6c1aceb7b 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/derefrence.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/derefrence.exp @@ -2,24 +2,48 @@ module 0x8675309::M { struct S { f: u64, - x: M::X, + x: 0x8675309::M::X, } struct X { dummy_field: bool, } - private fun t0(x: &u64,x_mut: &mut u64,s: &M::S,s_mut: &mut M::S) { + private fun t0(x: &u64,x_mut: &mut u64,s: &S,s_mut: &mut S) { Deref(x); Deref(x_mut); Deref(s); - Deref(Borrow(Immutable)(select M::S.f<&M::S>(s))); - select M::S.f<&M::S>(s); - Deref(Borrow(Immutable)(select M::S.x<&M::S>(s))); + Deref(Borrow(Immutable)(select M::S.f<&S>(s))); + select M::S.f<&S>(s); + Deref(Borrow(Immutable)(select M::S.x<&S>(s))); Deref(s_mut); - Deref(Borrow(Immutable)(select M::S.f<&mut M::S>(s_mut))); - Deref(Borrow(Mutable)(select M::S.f<&mut M::S>(s_mut))); - select M::S.f<&mut M::S>(s_mut); - Deref(Borrow(Immutable)(select M::S.x<&mut M::S>(s_mut))); - Deref(Borrow(Mutable)(select M::S.x<&mut M::S>(s_mut))); + Deref(Borrow(Immutable)(select M::S.f<&mut S>(s_mut))); + Deref(Borrow(Mutable)(select M::S.f<&mut S>(s_mut))); + select M::S.f<&mut S>(s_mut); + Deref(Borrow(Immutable)(select M::S.x<&mut S>(s_mut))); + Deref(Borrow(Mutable)(select M::S.x<&mut S>(s_mut))); Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct S has copy, drop { + f: u64, + x: X, + } + struct X has copy, drop { + } + fun t0(x: &u64, x_mut: &mut u64, s: &S, s_mut: &mut S) { + *x; + *x_mut; + *s; + *&s.f; + s.f; + *&s.x; + *s_mut; + *&s_mut.f; + *&mut s_mut.f; + s_mut.f; + *&s_mut.x; + *&mut s_mut.x; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/dummy_field.exp b/third_party/move/move-compiler-v2/tests/checking/typing/dummy_field.exp index 31d482ecaceb0..56d305e825796 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/dummy_field.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/dummy_field.exp @@ -7,32 +7,58 @@ module 0x42::test { dummy_field: bool, } public entry fun test(addr: address) - acquires test::R(*) + acquires 0x42::test::R(*) { { - let test::R{ dummy_field: _dummy_field } = MoveFrom(addr); + let test::R{ dummy_field: _dummy_field } = MoveFrom(addr); Tuple() } } private fun test2(): bool { { - let r: test::R = pack test::R(true); - select test::R.dummy_field(r) + let r: R = pack test::R(true); + select test::R.dummy_field(r) } } public entry fun test3(addr: address) - acquires test::T(*) + acquires 0x42::test::T(*) { { - let test::T{ dummy_field: _ } = MoveFrom(addr); + let test::T{ dummy_field: _ } = MoveFrom(addr); Tuple() } } public entry fun test4(s: &signer) { { - let r: test::T = pack test::T(false); - MoveTo(s, r); + let r: T = pack test::T(false); + MoveTo(s, r); Tuple() } } } // end 0x42::test + +// -- Sourcified model before bytecode pipeline +module 0x42::test { + struct T has drop, store, key { + } + struct R has drop, store, key { + } + public entry fun test(addr: address) + acquires R + { + let R{} = move_from(addr); + } + fun test2(): bool { + let r = R{}; + r.dummy_field + } + public entry fun test3(addr: address) + acquires T + { + let T{} = move_from(addr); + } + public entry fun test4(s: &signer) { + let r = T{}; + move_to(s, r); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/entry_on_any_vis.exp b/third_party/move/move-compiler-v2/tests/checking/typing/entry_on_any_vis.exp index cd2aba36667c8..57b08d2aad09a 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/entry_on_any_vis.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/entry_on_any_vis.exp @@ -10,3 +10,13 @@ module 0x2::M { Tuple() } } // end 0x2::M + +// -- Sourcified model before bytecode pipeline +module 0x2::M { + entry fun f1() { + } + public entry fun f2() { + } + friend entry fun f3() { + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/entry_signature_no_warning.exp b/third_party/move/move-compiler-v2/tests/checking/typing/entry_signature_no_warning.exp index 241ce607db4dd..314382987eb04 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/entry_signature_no_warning.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/entry_signature_no_warning.exp @@ -9,13 +9,31 @@ module 0x42::M { public entry fun signer_ref(_: &signer) { Tuple() } - public entry fun struct_arg(_: M::CoolStruct) { + public entry fun struct_arg(_: CoolStruct) { Tuple() } - public entry fun struct_ret(): M::CoolStruct { + public entry fun struct_ret(): CoolStruct { pack M::CoolStruct(false) } public entry fun u64_ret(): u64 { 0 } } // end 0x42::M + +// -- Sourcified model before bytecode pipeline +module 0x42::M { + struct CoolStruct has drop { + } + public entry fun late_signer(_u: u64, _s: signer) { + } + public entry fun signer_ref(_: &signer) { + } + public entry fun struct_arg(_: CoolStruct) { + } + public entry fun struct_ret(): CoolStruct { + CoolStruct{} + } + public entry fun u64_ret(): u64 { + 0 + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/eq.exp b/third_party/move/move-compiler-v2/tests/checking/typing/eq.exp index e36049a6df034..0f6289490929e 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/eq.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/eq.exp @@ -9,7 +9,7 @@ module 0x8675309::M { struct S { u: u64, } - private fun t0(r: &M::R,r_mut: &mut M::R,s: M::S,s_ref: &M::S,s_mut: &mut M::S) { + private fun t0(r: &R,r_mut: &mut R,s: S,s_ref: &S,s_mut: &mut S) { false; false; false; @@ -18,19 +18,55 @@ module 0x8675309::M { Eq(Borrow(Immutable)(0), Borrow(Immutable)(1)); false; false; - Eq(Borrow(Immutable)(s), s_ref); - Eq(Freeze(false)(Borrow(Mutable)(s)), s_ref); - Eq(Freeze(false)(Borrow(Mutable)(s)), Freeze(false)(s_mut)); - Eq(Borrow(Immutable)(s), Freeze(false)(s_mut)); - Eq(s_ref, Freeze(false)(s_mut)); - Eq(Freeze(false)(s_mut), Freeze(false)(s_mut)); - Eq(pack M::S(0), s); - Eq(r, r); - Eq(Freeze(false)(r_mut), Freeze(false)(r_mut)); - Eq(r, Freeze(false)(r_mut)); - Eq(Freeze(false)(r_mut), r); - Eq>(pack M::G(1), pack M::G(1)); - Eq>(pack M::G(1), pack M::G(1)); + Eq(Borrow(Immutable)(s), s_ref); + Eq(Freeze(false)(Borrow(Mutable)(s)), s_ref); + Eq(Freeze(false)(Borrow(Mutable)(s)), Freeze(false)(s_mut)); + Eq(Borrow(Immutable)(s), Freeze(false)(s_mut)); + Eq(s_ref, Freeze(false)(s_mut)); + Eq(Freeze(false)(s_mut), Freeze(false)(s_mut)); + Eq(pack M::S(0), s); + Eq(r, r); + Eq(Freeze(false)(r_mut), Freeze(false)(r_mut)); + Eq(r, Freeze(false)(r_mut)); + Eq(Freeze(false)(r_mut), r); + Eq>(pack M::G(1), pack M::G(1)); + Eq>(pack M::G(1), pack M::G(1)); Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct G has drop { + f: T, + } + struct R { + f: u64, + } + struct S has drop { + u: u64, + } + fun t0(r: &R, r_mut: &mut R, s: S, s_ref: &S, s_mut: &mut S) { + false; + false; + false; + false; + false; + &0 == &1; + false; + false; + &s == s_ref; + /*freeze*/&mut s == s_ref; + /*freeze*/&mut s == /*freeze*/s_mut; + &s == /*freeze*/s_mut; + s_ref == /*freeze*/s_mut; + /*freeze*/s_mut == /*freeze*/s_mut; + S{u: 0} == s; + r == r; + /*freeze*/r_mut == /*freeze*/r_mut; + r == /*freeze*/r_mut; + /*freeze*/r_mut == r; + G{f: 1} == G{f: 1}; + G{f: 1} == G{f: 1}; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/eq_inline.exp b/third_party/move/move-compiler-v2/tests/checking/typing/eq_inline.exp index 66175e1b1b2f8..4135375126682 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/eq_inline.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/eq_inline.exp @@ -16,3 +16,12 @@ module 0x42::m { Tuple() } } // end 0x42::m + +// -- Sourcified model before bytecode pipeline +module 0x42::m { + inline fun foo(f: |&u64|) { + } + fun g() { + (); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/eq_inline_typed.exp b/third_party/move/move-compiler-v2/tests/checking/typing/eq_inline_typed.exp index c7449303ddf2c..d4ac8aa2042a4 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/eq_inline_typed.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/eq_inline_typed.exp @@ -16,3 +16,12 @@ module 0x42::m { Tuple() } } // end 0x42::m + +// -- Sourcified model before bytecode pipeline +module 0x42::m { + inline fun foo(f: |&u64|) { + } + fun g() { + (); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/eq_ref.exp b/third_party/move/move-compiler-v2/tests/checking/typing/eq_ref.exp index cd2f23dae1abf..c7ed238eae972 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/eq_ref.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/eq_ref.exp @@ -13,3 +13,16 @@ module 0x42::m { Tuple() } } // end 0x42::m + +// -- Sourcified model before bytecode pipeline +module 0x42::m { + fun mut_ref_to_mut_ref(x: u64, y: u64) { + /*freeze*/&mut x == /*freeze*/&mut y; + } + fun mut_ref_to_ref(x: u64, y: u64) { + /*freeze*/&mut x == &y; + } + fun ref_to_ref(x: u64, y: u64) { + &x == &y; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/exp_list.exp b/third_party/move/move-compiler-v2/tests/checking/typing/exp_list.exp index 2545066f07559..423fbbc8ff7f7 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/exp_list.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/exp_list.exp @@ -6,10 +6,25 @@ module 0x8675309::M { struct S { dummy_field: bool, } - private fun t0(): (u64, M::S, M::R>) { - Tuple(0, pack M::S(false), pack M::R>(pack M::R(1))) + private fun t0(): (u64, S, R>) { + Tuple(0, pack M::S(false), pack M::R>(pack M::R(1))) } - private fun t1(s: &M::S,r: &mut M::R): (u64, &M::S, &mut M::R) { + private fun t1(s: &S,r: &mut R): (u64, &S, &mut R) { Tuple(0, s, r) } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + f: T, + } + struct S { + } + fun t0(): (u64, S, R>) { + (0, S{}, R>{f: R{f: 1}}) + } + fun t1(s: &S, r: &mut R): (u64, &S, &mut R) { + (0, s, r) + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/explicit_copy.exp b/third_party/move/move-compiler-v2/tests/checking/typing/explicit_copy.exp index 7d8da10d750b3..302b50e6dc637 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/explicit_copy.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/explicit_copy.exp @@ -8,7 +8,7 @@ module 0x8675309::M { } private fun t() { { - let s: M::S = pack M::S(false); + let s: S = pack M::S(false); Copy(0); Copy(s); s; @@ -17,3 +17,18 @@ module 0x8675309::M { } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + } + struct S has copy, drop { + } + fun t() { + let s = S{}; + copy 0; + copy s; + s; + 0; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/explicit_move.exp b/third_party/move/move-compiler-v2/tests/checking/typing/explicit_move.exp index 27cbe3d3c17ea..ac1cb7ef24a48 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/explicit_move.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/explicit_move.exp @@ -10,9 +10,9 @@ module 0x8675309::M { { let u: u64 = 0; { - let s: M::S = pack M::S(false); + let s: S = pack M::S(false); { - let r: M::R = pack M::R(false); + let r: R = pack M::R(false); Move(u); Move(s); M::R{ dummy_field: _ } = Move(r); @@ -22,3 +22,19 @@ module 0x8675309::M { } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + } + struct S has drop { + } + fun t() { + let u = 0; + let s = S{}; + let r = R{}; + move u; + move s; + R{} = move r; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/global_builtins.exp b/third_party/move/move-compiler-v2/tests/checking/typing/global_builtins.exp index 90546524be56a..04b8d2231d938 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/global_builtins.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/global_builtins.exp @@ -4,18 +4,18 @@ module 0x8675309::M { dummy_field: bool, } private fun t0(a: &signer) - acquires M::R(*) + acquires 0x8675309::M::R(*) { { - let _: bool = exists(0x0); + let _: bool = exists(0x0); { - let (): () = MoveTo(a, pack M::R(false)); + let (): () = MoveTo(a, pack M::R(false)); { - let _: &M::R = BorrowGlobal(Immutable)(0x0); + let _: &R = BorrowGlobal(Immutable)(0x0); { - let _: &mut M::R = BorrowGlobal(Mutable)(0x0); + let _: &mut R = BorrowGlobal(Mutable)(0x0); { - let M::R{ dummy_field: _ } = MoveFrom(0x0); + let M::R{ dummy_field: _ } = MoveFrom(0x0); Tuple() } } @@ -24,18 +24,18 @@ module 0x8675309::M { } } private fun t1(a: &signer) - acquires M::R(*) + acquires 0x8675309::M::R(*) { { - let _: bool = exists(0x0); + let _: bool = exists(0x0); { - let (): () = MoveTo(a, pack M::R(false)); + let (): () = MoveTo(a, pack M::R(false)); { - let _: &M::R = BorrowGlobal(Immutable)(0x0); + let _: &R = BorrowGlobal(Immutable)(0x0); { - let _: &mut M::R = BorrowGlobal(Mutable)(0x0); + let _: &mut R = BorrowGlobal(Mutable)(0x0); { - let M::R{ dummy_field: _ } = MoveFrom(0x0); + let M::R{ dummy_field: _ } = MoveFrom(0x0); Tuple() } } @@ -44,3 +44,27 @@ module 0x8675309::M { } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R has key { + } + fun t0(a: &signer) + acquires R + { + let _ = exists(0x0); + let () = move_to(a, R{}); + let _ = borrow_global(0x0); + let _ = borrow_global_mut(0x0); + let R{} = move_from(0x0); + } + fun t1(a: &signer) + acquires R + { + let _ = exists(0x0); + let () = move_to(a, R{}); + let _ = borrow_global(0x0); + let _ = borrow_global_mut(0x0); + let R{} = move_from(0x0); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/global_builtins_inferred.exp b/third_party/move/move-compiler-v2/tests/checking/typing/global_builtins_inferred.exp index 8e154566ebee7..f8c0150058c56 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/global_builtins_inferred.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/global_builtins_inferred.exp @@ -4,10 +4,10 @@ module 0x42::m { addr: address, } public fun foo(input: address): address - acquires m::A(*) + acquires 0x42::m::A(*) { { - let a: m::A = MoveFrom(input); + let a: A = MoveFrom(input); { let m::A{ addr } = a; addr @@ -15,3 +15,17 @@ module 0x42::m { } } } // end 0x42::m + +// -- Sourcified model before bytecode pipeline +module 0x42::m { + struct A has key { + addr: address, + } + public fun foo(input: address): address + acquires A + { + let a = move_from(input); + let A{addr: addr} = a; + addr + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/hex_and_decimal_address.exp b/third_party/move/move-compiler-v2/tests/checking/typing/hex_and_decimal_address.exp index 579a7a863a3ef..7bbed33ec8cf2 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/hex_and_decimal_address.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/hex_and_decimal_address.exp @@ -3,10 +3,10 @@ module 0x7b::M { struct S { dummy_field: bool, } - public fun s(): M::S { + public fun s(): S { pack M::S(false) } - public fun take(_s: M::S) { + public fun take(_s: S) { Tuple() } } // end 0x7b::M @@ -19,3 +19,22 @@ module _0 { Tuple() } } // end _0 + +// -- Sourcified model before bytecode pipeline +module 0x7b::M { + struct S has copy, drop { + } + public fun s(): S { + S{} + } + public fun take(_s: S) { + } +} +script { + fun main() { + 0x7b::M::take(0x7b::M::s()); + 0x7b::M::take(0x7b::M::s()); + 0x7b::M::take(0x7b::M::s()); + 0x7b::M::take(0x7b::M::s()); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/if_branches_subtype.exp b/third_party/move/move-compiler-v2/tests/checking/typing/if_branches_subtype.exp index 9d0e1d8462b55..4efc4b81f3766 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/if_branches_subtype.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/if_branches_subtype.exp @@ -49,3 +49,17 @@ module 0x8675309::M { } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + fun t0(cond: bool, u: &u64, u_mut: &mut u64) { + let _ = if (cond) u else /*freeze*/u_mut; + let _ = if (cond) /*freeze*/u_mut else u; + let _ = if (cond) /*freeze*/u_mut else /*freeze*/u_mut; + } + fun t1(cond: bool, u: &u64, u_mut: &mut u64) { + let (_,_) = if (cond) (u, u) else (/*freeze*/u_mut, /*freeze*/u_mut); + let (_,_) = if (cond) (/*freeze*/u_mut, u) else (u, /*freeze*/u_mut); + let (_,_) = if (cond) (u, /*freeze*/u_mut) else (/*freeze*/u_mut, u); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/if_condition.exp b/third_party/move/move-compiler-v2/tests/checking/typing/if_condition.exp index 554498b46c986..f0b20328e1276 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/if_condition.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/if_condition.exp @@ -25,3 +25,15 @@ module 0x8675309::M { } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + fun t0() { + if (true) (); + if (false) () + } + fun t1() { + if (true) (); + if (false) () + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/if_default_else.exp b/third_party/move/move-compiler-v2/tests/checking/typing/if_default_else.exp index 4794c6c8e1d7c..e3fd81b609527 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/if_default_else.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/if_default_else.exp @@ -24,3 +24,14 @@ module 0x8675309::M { } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + fun t0(cond: bool) { + if (cond) (); + let () = if (cond) (); + let () = if (cond) { + 0; + }; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/if_matched_branches.exp b/third_party/move/move-compiler-v2/tests/checking/typing/if_matched_branches.exp index 780bf81624ba8..1ddad9454c1b9 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/if_matched_branches.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/if_matched_branches.exp @@ -45,7 +45,7 @@ module 0x8675309::M { } else { Tuple(1, true) }; - (_: u64, _: u64, _: &u64, M::R{ dummy_field: _ }): (u64, u64, &u64, M::R) = if cond { + (_: u64, _: u64, _: &u64, M::R{ dummy_field: _ }): (u64, u64, &u64, R) = if cond { Tuple(0, 0, Borrow(Immutable)(0), pack M::R(false)) } else { Tuple(1, 1, Borrow(Immutable)(1), pack M::R(false)) @@ -53,3 +53,23 @@ module 0x8675309::M { Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + } + fun t0(cond: bool) { + if (cond) (); + } + fun t1(cond: bool) { + if (cond) 0 else 0; + if (cond) false else false; + R{} = if (cond) R{} else R{}; + if (cond) &0 else &1; + if (cond) &mut 0 else &mut 1; + } + fun t2(cond: bool) { + if (cond) (0, false) else (1, true); + (_,_,_,R{}) = if (cond) (0, 0, &0, R{}) else (1, 1, &1, R{}); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/implicit_deref_borrow_field.exp b/third_party/move/move-compiler-v2/tests/checking/typing/implicit_deref_borrow_field.exp index 091162a89bff2..cc51779b1ed1b 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/implicit_deref_borrow_field.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/implicit_deref_borrow_field.exp @@ -3,7 +3,17 @@ module 0x8675309::M { struct S { f: u64, } - private fun t0(s: &M::S,s_mut: &mut M::S): (u64, u64) { - Tuple(select M::S.f<&M::S>(s), select M::S.f<&mut M::S>(s_mut)) + private fun t0(s: &S,s_mut: &mut S): (u64, u64) { + Tuple(select M::S.f<&S>(s), select M::S.f<&mut S>(s_mut)) } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct S { + f: u64, + } + fun t0(s: &S, s_mut: &mut S): (u64, u64) { + (s.f, s_mut.f) + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/implicit_deref_borrow_field_chain.exp b/third_party/move/move-compiler-v2/tests/checking/typing/implicit_deref_borrow_field_chain.exp index a295429bd20ef..5f505db3a6d37 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/implicit_deref_borrow_field_chain.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/implicit_deref_borrow_field_chain.exp @@ -1,19 +1,38 @@ // -- Model dump before bytecode pipeline module 0x8675309::M { struct X1 { - x2: M::X2, + x2: 0x8675309::M::X2, } struct X2 { - x3: M::X3, + x3: 0x8675309::M::X3, } struct X3 { f: u64, } - private fun t0(x1: &M::X1,x1_mut: &mut M::X1,x2: &M::X2,x2_mut: &mut M::X2) { - select M::X3.f(select M::X2.x3(select M::X1.x2<&M::X1>(x1))); - select M::X3.f(select M::X2.x3(select M::X1.x2<&mut M::X1>(x1_mut))); - select M::X3.f(select M::X2.x3<&M::X2>(x2)); - select M::X3.f(select M::X2.x3<&mut M::X2>(x2_mut)); + private fun t0(x1: &X1,x1_mut: &mut X1,x2: &X2,x2_mut: &mut X2) { + select M::X3.f(select M::X2.x3(select M::X1.x2<&X1>(x1))); + select M::X3.f(select M::X2.x3(select M::X1.x2<&mut X1>(x1_mut))); + select M::X3.f(select M::X2.x3<&X2>(x2)); + select M::X3.f(select M::X2.x3<&mut X2>(x2_mut)); Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct X1 { + x2: X2, + } + struct X2 { + x3: X3, + } + struct X3 { + f: u64, + } + fun t0(x1: &X1, x1_mut: &mut X1, x2: &X2, x2_mut: &mut X2) { + x1.x2.x3.f; + x1_mut.x2.x3.f; + x2.x3.f; + x2_mut.x3.f; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/implicit_deref_borrow_field_complex_root_expr.exp b/third_party/move/move-compiler-v2/tests/checking/typing/implicit_deref_borrow_field_complex_root_expr.exp index 6a875a79a8dd8..f3d40cef51c37 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/implicit_deref_borrow_field_complex_root_expr.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/implicit_deref_borrow_field_complex_root_expr.exp @@ -3,31 +3,48 @@ module 0x8675309::M { struct S { f: u64, } - private fun t0(cond: bool,s: &M::S,s_mut: &mut M::S) { - select M::S.f<&M::S>(if cond { + private fun t0(cond: bool,s: &S,s_mut: &mut S) { + select M::S.f<&S>(if cond { s } else { s }); - select M::S.f<&M::S>(if cond { + select M::S.f<&S>(if cond { Freeze(false)(s_mut) } else { s }); - select M::S.f<&M::S>(if cond { + select M::S.f<&S>(if cond { s } else { Freeze(false)(s_mut) }); - select M::S.f<&mut M::S>(if cond { + select M::S.f<&mut S>(if cond { s_mut } else { s_mut }); - select M::S.f<&M::S>({ - let s: M::S = pack M::S(0); + select M::S.f<&S>({ + let s: S = pack M::S(0); Borrow(Immutable)(s) }); Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct S has drop { + f: u64, + } + fun t0(cond: bool, s: &S, s_mut: &mut S) { + (if (cond) s else s).f; + (if (cond) /*freeze*/s_mut else s).f; + (if (cond) s else /*freeze*/s_mut).f; + (if (cond) s_mut else s_mut).f; + { + let s = S{f: 0}; + &s + }.f; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/implicit_deref_borrow_field_non_ref_non_local_root.exp b/third_party/move/move-compiler-v2/tests/checking/typing/implicit_deref_borrow_field_non_ref_non_local_root.exp index 71ba5235e8226..f94c9cb4a3e05 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/implicit_deref_borrow_field_non_ref_non_local_root.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/implicit_deref_borrow_field_non_ref_non_local_root.exp @@ -3,21 +3,21 @@ module 0x8675309::M { struct S { f: u64, } - private fun bar(): M::S { + private fun bar(): S { pack M::S(0) } - private fun foo(): &M::S { + private fun foo(): &S { Abort(0) } - private fun t0(cond: bool,_s: M::S) { - select M::S.f<&M::S>(M::foo()); - select M::S.f(M::bar()); - select M::S.f<&M::S>(if cond { + private fun t0(cond: bool,_s: S) { + select M::S.f<&S>(M::foo()); + select M::S.f(M::bar()); + select M::S.f<&S>(if cond { M::foo() } else { Borrow(Immutable)(M::bar()) }); - select M::S.f(if cond { + select M::S.f(if cond { Deref(M::foo()) } else { M::bar() @@ -25,3 +25,22 @@ module 0x8675309::M { Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct S has copy, drop { + f: u64, + } + fun bar(): S { + S{f: 0} + } + fun foo(): &S { + abort 0 + } + fun t0(cond: bool, _s: S) { + foo().f; + bar().f; + (if (cond) foo() else &bar()).f; + (if (cond) *foo() else bar()).f; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/implicit_deref_borrow_field_non_ref_root.exp b/third_party/move/move-compiler-v2/tests/checking/typing/implicit_deref_borrow_field_non_ref_root.exp index 32221dc6ce4a4..730ca3e3600da 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/implicit_deref_borrow_field_non_ref_root.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/implicit_deref_borrow_field_non_ref_root.exp @@ -3,9 +3,9 @@ module 0x8675309::M { struct S { f: u64, } - private fun t0(cond: bool,s: M::S) { - select M::S.f(s); - select M::S.f(if cond { + private fun t0(cond: bool,s: S) { + select M::S.f(s); + select M::S.f(if cond { pack M::S(0) } else { pack M::S(1) @@ -13,3 +13,14 @@ module 0x8675309::M { Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct S has drop { + f: u64, + } + fun t0(cond: bool, s: S) { + s.f; + (if (cond) S{f: 0} else S{f: 1}).f; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/large_binop.exp b/third_party/move/move-compiler-v2/tests/checking/typing/large_binop.exp index f73d7143c36ca..3f70f2058995c 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/large_binop.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/large_binop.exp @@ -5,3 +5,10 @@ module _0 { Tuple() } } // end _0 + +// -- Sourcified model before bytecode pipeline +script { + fun main() { + true; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/loop_body.exp b/third_party/move/move-compiler-v2/tests/checking/typing/loop_body.exp index c38a819cc31da..1c34ecf7e75a0 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/loop_body.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/loop_body.exp @@ -59,3 +59,38 @@ module 0x8675309::M { } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + fun t0() { + loop () + } + fun t1() { + loop () + } + fun t2() { + loop () + } + fun t3() { + loop { + 0; + } + } + fun t4() { + loop if (true) () + } + fun t5() { + loop break; + loop break; + loop return () + } + fun t6() { + loop continue + } + fun t7() { + loop continue + } + fun t8() { + loop loop break + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/loop_result_type.exp b/third_party/move/move-compiler-v2/tests/checking/typing/loop_result_type.exp index 6e4b1c4bce1ba..10ffc738309aa 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/loop_result_type.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/loop_result_type.exp @@ -52,3 +52,35 @@ module 0x2::M { } } } // end 0x2::M + +// -- Sourcified model before bytecode pipeline +module 0x2::X { + struct R { + } +} +module 0x2::M { + use 0x2::X; + fun foo(_x: u64) { + } + fun t0(): X::R { + loop () + } + fun t1(): u64 { + loop { + 0; + } + } + fun t2() { + foo(loop ()) + } + fun t3(): X::R { + let x = loop { + 0; + }; + x + } + fun t4() { + let () = loop break; + let () = loop if (false) break; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/main_arguments.exp b/third_party/move/move-compiler-v2/tests/checking/typing/main_arguments.exp index f48682cc04cc9..b6b7ad1aeadb6 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/main_arguments.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/main_arguments.exp @@ -4,3 +4,9 @@ module _0 { Tuple() } } // end _0 + +// -- Sourcified model before bytecode pipeline +script { + fun main(_sender: signer, _a: address, _x8: u8, _x64: u64, _x128: u128, _b: bool, _v8: vector, _va: vector
, _v64: vector, _v128: vector, _vb: vector, _vv8: vector>, _vva: vector>, _vv64: vector>, _vv128: vector>, _vvb: vector>, _vvv8: vector>>, _vvva: vector>>, _vvv64: vector>>, _vvv128: vector>>, _vvvb: vector>>, _vvvv8: vector>>>, _vvvva: vector>>>, _vvvv64: vector>>>, _vvvv128: vector>>>, _vvvvb: vector>>>) { + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/main_arguments_various_caes.exp b/third_party/move/move-compiler-v2/tests/checking/typing/main_arguments_various_caes.exp index a729ac9e9d988..ebd403606785e 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/main_arguments_various_caes.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/main_arguments_various_caes.exp @@ -9,13 +9,33 @@ module 0x42::M { struct S { dummy_field: bool, } - public fun eat(r: M::R) { + public fun eat(r: R) { M::R{ dummy_field: _ } = r } } // end 0x42::M module _0 { use 0x42::M::{S, R, Cup}; // resolved as: 0x42::M - private fun main(_s: &signer,_a0: #0,_a1: vector<#0>,_a2: vector>,_a3: M::S,_a4: M::R,_a5: M::Cup,_a6: M::Cup<#0>,_a7: vector) { + private fun main(_s: &signer,_a0: T,_a1: vector,_a2: vector>,_a3: M::S,_a4: M::R,_a5: M::Cup,_a6: M::Cup,_a7: vector) { Abort(0) } } // end _0 + +// -- Sourcified model before bytecode pipeline +module 0x42::M { + struct Cup { + f1: T, + } + struct R { + } + struct S { + } + public fun eat(r: R) { + R{} = r + } +} +script { + use 0x42::M; + fun main(_s: &signer, _a0: T, _a1: vector, _a2: vector>, _a3: M::S, _a4: M::R, _a5: M::Cup, _a6: M::Cup, _a7: vector) { + abort 0 + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/main_call_entry.exp b/third_party/move/move-compiler-v2/tests/checking/typing/main_call_entry.exp index f8cdb6a2f8ceb..ca739da5a5a17 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/main_call_entry.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/main_call_entry.exp @@ -9,3 +9,14 @@ module _0 { X::foo() } } // end _0 + +// -- Sourcified model before bytecode pipeline +module 0x2::X { + public entry fun foo() { + } +} +script { + fun main() { + 0x2::X::foo() + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/main_with_type_parameters.exp b/third_party/move/move-compiler-v2/tests/checking/typing/main_with_type_parameters.exp index cb4ca6a2d2269..4ce4ef16c689a 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/main_with_type_parameters.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/main_with_type_parameters.exp @@ -4,3 +4,9 @@ module _0 { Tuple() } } // end _0 + +// -- Sourcified model before bytecode pipeline +script { + fun main() { + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/module_call_entry_function.exp b/third_party/move/move-compiler-v2/tests/checking/typing/module_call_entry_function.exp index cf5eb639e99ea..e0bbe04193eb2 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/module_call_entry_function.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/module_call_entry_function.exp @@ -49,3 +49,49 @@ module 0x2::M { M::f_script() } } // end 0x2::M + +// -- Sourcified model before bytecode pipeline +module 0x2::Y { + friend 0x2::M; + friend fun f_friend() { + } +} +module 0x2::X { + public fun f_public() { + } + public entry fun f_script() { + } +} +module 0x2::M { + use 0x2::Y; + use 0x2::X; + friend fun f_friend() { + } + public fun f_public() { + } + public entry fun f_script() { + } + fun f_private() { + } + public entry fun f_script_call_friend() { + Y::f_friend() + } + public entry fun f_script_call_public() { + X::f_public() + } + public entry fun f_script_call_script() { + X::f_script() + } + public entry fun f_script_call_self_friend() { + f_friend() + } + public entry fun f_script_call_self_private() { + f_private() + } + public entry fun f_script_call_self_public() { + f_public() + } + public entry fun f_script_call_self_script() { + f_script() + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/move_from_type_argument.exp b/third_party/move/move-compiler-v2/tests/checking/typing/move_from_type_argument.exp index 8e154566ebee7..f8c0150058c56 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/move_from_type_argument.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/move_from_type_argument.exp @@ -4,10 +4,10 @@ module 0x42::m { addr: address, } public fun foo(input: address): address - acquires m::A(*) + acquires 0x42::m::A(*) { { - let a: m::A = MoveFrom(input); + let a: A = MoveFrom(input); { let m::A{ addr } = a; addr @@ -15,3 +15,17 @@ module 0x42::m { } } } // end 0x42::m + +// -- Sourcified model before bytecode pipeline +module 0x42::m { + struct A has key { + addr: address, + } + public fun foo(input: address): address + acquires A + { + let a = move_from(input); + let A{addr: addr} = a; + addr + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/mutable_eq_and_neq.exp b/third_party/move/move-compiler-v2/tests/checking/typing/mutable_eq_and_neq.exp index 21143c8c8fed3..adc57ec46e5eb 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/mutable_eq_and_neq.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/mutable_eq_and_neq.exp @@ -4,14 +4,14 @@ module 0x8675309::M { f: bool, } struct P { - b1: M::B, - b2: M::B, + b1: 0x8675309::M::B, + b2: 0x8675309::M::B, } struct S { f: u64, g: u64, } - private fun t(r1: &mut u64,r2: &mut u64,s: &mut M::S) { + private fun t(r1: &mut u64,r2: &mut u64,s: &mut S) { Eq(Freeze(false)(r1), Freeze(false)(r1)); Eq(Freeze(false)(r1), Freeze(false)(r2)); Eq(Freeze(false)(r2), Freeze(false)(r2)); @@ -20,26 +20,67 @@ module 0x8675309::M { Neq(Freeze(false)(r1), Freeze(false)(r2)); Neq(Freeze(false)(r2), Freeze(false)(r2)); Neq(Freeze(false)(r2), Freeze(false)(r2)); - Eq(Freeze(false)(Borrow(Mutable)(select M::S.f<&mut M::S>(s))), Freeze(false)(Borrow(Mutable)(select M::S.f<&mut M::S>(s)))); - Eq(Freeze(false)(Borrow(Mutable)(select M::S.f<&mut M::S>(s))), Freeze(false)(Borrow(Mutable)(select M::S.g<&mut M::S>(s)))); - Eq(Freeze(false)(Borrow(Mutable)(select M::S.g<&mut M::S>(s))), Freeze(false)(Borrow(Mutable)(select M::S.f<&mut M::S>(s)))); - Eq(Freeze(false)(Borrow(Mutable)(select M::S.g<&mut M::S>(s))), Freeze(false)(Borrow(Mutable)(select M::S.g<&mut M::S>(s)))); - Neq(Freeze(false)(Borrow(Mutable)(select M::S.f<&mut M::S>(s))), Freeze(false)(Borrow(Mutable)(select M::S.f<&mut M::S>(s)))); - Neq(Freeze(false)(Borrow(Mutable)(select M::S.f<&mut M::S>(s))), Freeze(false)(Borrow(Mutable)(select M::S.g<&mut M::S>(s)))); - Neq(Freeze(false)(Borrow(Mutable)(select M::S.g<&mut M::S>(s))), Freeze(false)(Borrow(Mutable)(select M::S.f<&mut M::S>(s)))); - Neq(Freeze(false)(Borrow(Mutable)(select M::S.g<&mut M::S>(s))), Freeze(false)(Borrow(Mutable)(select M::S.g<&mut M::S>(s)))); + Eq(Freeze(false)(Borrow(Mutable)(select M::S.f<&mut S>(s))), Freeze(false)(Borrow(Mutable)(select M::S.f<&mut S>(s)))); + Eq(Freeze(false)(Borrow(Mutable)(select M::S.f<&mut S>(s))), Freeze(false)(Borrow(Mutable)(select M::S.g<&mut S>(s)))); + Eq(Freeze(false)(Borrow(Mutable)(select M::S.g<&mut S>(s))), Freeze(false)(Borrow(Mutable)(select M::S.f<&mut S>(s)))); + Eq(Freeze(false)(Borrow(Mutable)(select M::S.g<&mut S>(s))), Freeze(false)(Borrow(Mutable)(select M::S.g<&mut S>(s)))); + Neq(Freeze(false)(Borrow(Mutable)(select M::S.f<&mut S>(s))), Freeze(false)(Borrow(Mutable)(select M::S.f<&mut S>(s)))); + Neq(Freeze(false)(Borrow(Mutable)(select M::S.f<&mut S>(s))), Freeze(false)(Borrow(Mutable)(select M::S.g<&mut S>(s)))); + Neq(Freeze(false)(Borrow(Mutable)(select M::S.g<&mut S>(s))), Freeze(false)(Borrow(Mutable)(select M::S.f<&mut S>(s)))); + Neq(Freeze(false)(Borrow(Mutable)(select M::S.g<&mut S>(s))), Freeze(false)(Borrow(Mutable)(select M::S.g<&mut S>(s)))); Tuple() } - private fun t1(p: &mut M::P) { + private fun t1(p: &mut P) { { - let comp: bool = Eq(Freeze(false)(Borrow(Mutable)(select M::P.b1<&mut M::P>(p))), Freeze(false)(Borrow(Mutable)(select M::P.b2<&mut M::P>(p)))); - select M::B.f(select M::P.b1<&mut M::P>(p)) = comp + let comp: bool = Eq(Freeze(false)(Borrow(Mutable)(select M::P.b1<&mut P>(p))), Freeze(false)(Borrow(Mutable)(select M::P.b2<&mut P>(p)))); + select M::B.f(select M::P.b1<&mut P>(p)) = comp } } - private fun t2(p: &mut M::P) { + private fun t2(p: &mut P) { { - let comp: bool = Neq(Freeze(false)(Borrow(Mutable)(select M::P.b1<&mut M::P>(p))), Freeze(false)(Borrow(Mutable)(select M::P.b2<&mut M::P>(p)))); - select M::B.f(select M::P.b1<&mut M::P>(p)) = comp + let comp: bool = Neq(Freeze(false)(Borrow(Mutable)(select M::P.b1<&mut P>(p))), Freeze(false)(Borrow(Mutable)(select M::P.b2<&mut P>(p)))); + select M::B.f(select M::P.b1<&mut P>(p)) = comp } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct B { + f: bool, + } + struct P { + b1: B, + b2: B, + } + struct S { + f: u64, + g: u64, + } + fun t(r1: &mut u64, r2: &mut u64, s: &mut S) { + /*freeze*/r1 == /*freeze*/r1; + /*freeze*/r1 == /*freeze*/r2; + /*freeze*/r2 == /*freeze*/r2; + /*freeze*/r2 == /*freeze*/r2; + /*freeze*/r1 != /*freeze*/r1; + /*freeze*/r1 != /*freeze*/r2; + /*freeze*/r2 != /*freeze*/r2; + /*freeze*/r2 != /*freeze*/r2; + /*freeze*/&mut s.f == /*freeze*/&mut s.f; + /*freeze*/&mut s.f == /*freeze*/&mut s.g; + /*freeze*/&mut s.g == /*freeze*/&mut s.f; + /*freeze*/&mut s.g == /*freeze*/&mut s.g; + /*freeze*/&mut s.f != /*freeze*/&mut s.f; + /*freeze*/&mut s.f != /*freeze*/&mut s.g; + /*freeze*/&mut s.g != /*freeze*/&mut s.f; + /*freeze*/&mut s.g != /*freeze*/&mut s.g; + } + fun t1(p: &mut P) { + let comp = /*freeze*/&mut p.b1 == /*freeze*/&mut p.b2; + p.b1.f = comp + } + fun t2(p: &mut P) { + let comp = /*freeze*/&mut p.b1 != /*freeze*/&mut p.b2; + p.b1.f = comp + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/mutate.exp b/third_party/move/move-compiler-v2/tests/checking/typing/mutate.exp index f293fbeeac9c4..8ddf9c8239941 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/mutate.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/mutate.exp @@ -3,10 +3,10 @@ module 0x8675309::M { struct S { f: u64, } - private fun bar(s: &mut M::S): &mut M::S { + private fun bar(s: &mut S): &mut S { s } - private fun baz(): M::S { + private fun baz(): S { pack M::S(0) } private fun foo(x: &mut u64): &mut u64 { @@ -14,21 +14,52 @@ module 0x8675309::M { } private fun t0() { Borrow(Mutable)(0) = 1; - Borrow(Mutable)(select M::S.f(pack M::S(0))) = 1; + Borrow(Mutable)(select M::S.f(pack M::S(0))) = 1; M::foo(Borrow(Mutable)(0)) = 1; - select M::S.f<&mut M::S>(M::bar(Borrow(Mutable)(pack M::S(0)))) = 1; - Borrow(Mutable)(select M::S.f<&mut M::S>(M::bar(Borrow(Mutable)(pack M::S(0))))) = 1; - select M::S.f(M::baz()) = 1; - Borrow(Mutable)(select M::S.f(M::baz())) = 1; + select M::S.f<&mut S>(M::bar(Borrow(Mutable)(pack M::S(0)))) = 1; + Borrow(Mutable)(select M::S.f<&mut S>(M::bar(Borrow(Mutable)(pack M::S(0))))) = 1; + select M::S.f(M::baz()) = 1; + Borrow(Mutable)(select M::S.f(M::baz())) = 1; Tuple() } private fun t1() { { - let r: &mut M::S = Borrow(Mutable)(pack M::S(0)); + let r: &mut S = Borrow(Mutable)(pack M::S(0)); r = pack M::S(1); - select M::S.f<&mut M::S>(r) = 1; - Borrow(Mutable)(select M::S.f<&mut M::S>(r)) = 1; + select M::S.f<&mut S>(r) = 1; + Borrow(Mutable)(select M::S.f<&mut S>(r)) = 1; Tuple() } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct S has copy, drop { + f: u64, + } + fun bar(s: &mut S): &mut S { + s + } + fun baz(): S { + S{f: 0} + } + fun foo(x: &mut u64): &mut u64 { + x + } + fun t0() { + *&mut 0 = 1; + *&mut S{f: 0}.f = 1; + *foo(&mut 0) = 1; + bar(&mut S{f: 0}).f = 1; + *&mut bar(&mut S{f: 0}).f = 1; + baz().f = 1; + *&mut baz().f = 1; + } + fun t1() { + let r = &mut S{f: 0}; + *r = S{f: 1}; + r.f = 1; + *&mut r.f = 1; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/neq.exp b/third_party/move/move-compiler-v2/tests/checking/typing/neq.exp index c4c982bba8e20..f1976389c8105 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/neq.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/neq.exp @@ -9,7 +9,7 @@ module 0x8675309::M { struct S { u: u64, } - private fun t0(r: &M::R,r_mut: &mut M::R,s: M::S,s_ref: &M::S,s_mut: &mut M::S) { + private fun t0(r: &R,r_mut: &mut R,s: S,s_ref: &S,s_mut: &mut S) { true; true; true; @@ -18,19 +18,55 @@ module 0x8675309::M { Neq(Borrow(Immutable)(0), Borrow(Immutable)(1)); true; true; - Neq(Borrow(Immutable)(s), s_ref); - Neq(Freeze(false)(Borrow(Mutable)(s)), s_ref); - Neq(Freeze(false)(Borrow(Mutable)(s)), Freeze(false)(s_mut)); - Neq(Borrow(Immutable)(s), Freeze(false)(s_mut)); - Neq(s_ref, Freeze(false)(s_mut)); - Neq(Freeze(false)(s_mut), Freeze(false)(s_mut)); - Neq(pack M::S(0), s); - Neq(r, r); - Neq(Freeze(false)(r_mut), Freeze(false)(r_mut)); - Neq(r, Freeze(false)(r_mut)); - Neq(Freeze(false)(r_mut), r); - Neq>(pack M::G(1), pack M::G(2)); - Neq>(pack M::G(1), pack M::G(2)); + Neq(Borrow(Immutable)(s), s_ref); + Neq(Freeze(false)(Borrow(Mutable)(s)), s_ref); + Neq(Freeze(false)(Borrow(Mutable)(s)), Freeze(false)(s_mut)); + Neq(Borrow(Immutable)(s), Freeze(false)(s_mut)); + Neq(s_ref, Freeze(false)(s_mut)); + Neq(Freeze(false)(s_mut), Freeze(false)(s_mut)); + Neq(pack M::S(0), s); + Neq(r, r); + Neq(Freeze(false)(r_mut), Freeze(false)(r_mut)); + Neq(r, Freeze(false)(r_mut)); + Neq(Freeze(false)(r_mut), r); + Neq>(pack M::G(1), pack M::G(2)); + Neq>(pack M::G(1), pack M::G(2)); Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct G has drop { + f: T, + } + struct R { + f: u64, + } + struct S has drop { + u: u64, + } + fun t0(r: &R, r_mut: &mut R, s: S, s_ref: &S, s_mut: &mut S) { + true; + true; + true; + true; + true; + &0 != &1; + true; + true; + &s != s_ref; + /*freeze*/&mut s != s_ref; + /*freeze*/&mut s != /*freeze*/s_mut; + &s != /*freeze*/s_mut; + s_ref != /*freeze*/s_mut; + /*freeze*/s_mut != /*freeze*/s_mut; + S{u: 0} != s; + r != r; + /*freeze*/r_mut != /*freeze*/r_mut; + r != /*freeze*/r_mut; + /*freeze*/r_mut != r; + G{f: 1} != G{f: 2}; + G{f: 1} != G{f: 2}; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/nested_post_process.exp b/third_party/move/move-compiler-v2/tests/checking/typing/nested_post_process.exp index d82dc536aca59..f962be66efbfa 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/nested_post_process.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/nested_post_process.exp @@ -8,11 +8,11 @@ module 0x42::simple_map { value: #1, } struct SimpleMap { - data: vector>, + data: vector<0x42::simple_map::Element<#0, #1>>, } - public fun borrow(map: &simple_map::SimpleMap<#0, #1>,key: �):  { + public fun borrow(map: &SimpleMap,key: &Key): &Value { { - let maybe_idx: option::Option = simple_map::find(map, key); + let maybe_idx: 0x1::option::Option = simple_map::find(map, key); if option::is_some(Borrow(Immutable)(maybe_idx)) { Tuple() } else { @@ -20,20 +20,20 @@ module 0x42::simple_map { }; { let idx: u64 = option::extract(Borrow(Mutable)(maybe_idx)); - Borrow(Immutable)(select simple_map::Element.value<&simple_map::Element>(vector::borrow>(Borrow(Immutable)(select simple_map::SimpleMap.data<&simple_map::SimpleMap>(map)), idx))) + Borrow(Immutable)(select simple_map::Element.value<&Element>(vector::borrow>(Borrow(Immutable)(select simple_map::SimpleMap.data<&SimpleMap>(map)), idx))) } } } - private fun find(map: &simple_map::SimpleMap<#0, #1>,key: �): option::Option { + private fun find(map: &SimpleMap,key: &Key): 0x1::option::Option { { - let leng: u64 = vector::length>(Borrow(Immutable)(select simple_map::SimpleMap.data<&simple_map::SimpleMap>(map))); + let leng: u64 = vector::length>(Borrow(Immutable)(select simple_map::SimpleMap.data<&SimpleMap>(map))); { let i: u64 = 0; loop { if Lt(i, leng) { { - let element: &simple_map::Element = vector::borrow>(Borrow(Immutable)(select simple_map::SimpleMap.data<&simple_map::SimpleMap>(map)), i); - if Eq(Borrow(Immutable)(select simple_map::Element.key<&simple_map::Element>(element)), key) { + let element: &Element = vector::borrow>(Borrow(Immutable)(select simple_map::SimpleMap.data<&SimpleMap>(map)), i); + if Eq(Borrow(Immutable)(select simple_map::Element.key<&Element>(element)), key) { return option::some(i) } else { Tuple() @@ -50,3 +50,30 @@ module 0x42::simple_map { } } } // end 0x42::simple_map + +// -- Sourcified model before bytecode pipeline +module 0x42::simple_map { + struct Element has copy, drop, store { + key: Key, + value: Value, + } + struct SimpleMap has copy, drop, store { + data: vector>, + } + public fun borrow(map: &SimpleMap, key: &Key): &Value { + let maybe_idx = find(map, key); + if (0x1::option::is_some(&maybe_idx)) () else abort 0x1::error::invalid_argument(2); + let idx = 0x1::option::extract(&mut maybe_idx); + &0x1::vector::borrow>(&map.data, idx).value + } + fun find(map: &SimpleMap, key: &Key): 0x1::option::Option { + let leng = 0x1::vector::length>(&map.data); + let i = 0; + while (i < leng) { + let element = 0x1::vector::borrow>(&map.data, i); + if (&element.key == key) return 0x1::option::some(i); + i = i + 1; + }; + 0x1::option::none() + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/other_builtins.exp b/third_party/move/move-compiler-v2/tests/checking/typing/other_builtins.exp index f55b1ebdbb292..c9bac663000b3 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/other_builtins.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/other_builtins.exp @@ -1,6 +1,6 @@ // -- Model dump before bytecode pipeline module 0x8675309::M { - private fun any(): #0 { + private fun any(): T { Abort(0) } private fun foo(x: &mut u64) { @@ -19,3 +19,16 @@ module 0x8675309::M { Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + fun any(): T { + abort 0 + } + fun foo(x: &mut u64) { + /*freeze*/x; + /*freeze*/&mut any>(); + if (false) () else abort *x; + if (true) () else abort 0; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/phantom_param_struct_decl.exp b/third_party/move/move-compiler-v2/tests/checking/typing/phantom_param_struct_decl.exp index 4e1a345132678..9397cd73cadd2 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/phantom_param_struct_decl.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/phantom_param_struct_decl.exp @@ -4,8 +4,8 @@ module 0x42::M1 { a: u64, } struct S2 { - a: M1::S1<#0>, - b: vector>, + a: 0x42::M1::S1<#0>, + b: vector<0x42::M1::S1<#0>>, } struct S3 { a: #1, @@ -15,6 +15,27 @@ module 0x42::M1 { a: u64, } struct S5 { - a: M1::S4<#0>, + a: 0x42::M1::S4<#0>, } } // end 0x42::M1 + +// -- Sourcified model before bytecode pipeline +module 0x42::M1 { + struct S1 { + a: u64, + } + struct S2 { + a: S1, + b: vector>, + } + struct S3 { + a: T2, + b: T4, + } + struct S4 { + a: u64, + } + struct S5 { + a: S4, + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/return_any_type.exp b/third_party/move/move-compiler-v2/tests/checking/typing/return_any_type.exp index bdaaf2919cd70..9cd94b1ea8825 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/return_any_type.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/return_any_type.exp @@ -3,7 +3,7 @@ module 0x8675309::M { struct Coin { dummy_field: bool, } - private fun foo(c: M::Coin) { + private fun foo(c: Coin) { M::Coin{ dummy_field: _ } = c; Tuple() } @@ -16,3 +16,18 @@ module 0x8675309::M { Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct Coin { + } + fun foo(c: Coin) { + Coin{} = c; + } + fun t0() { + 0 + (return ()); + } + fun t1() { + foo(return ()); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/return_type_explicit_exp.exp b/third_party/move/move-compiler-v2/tests/checking/typing/return_type_explicit_exp.exp index 087f85511cbb4..71676a3601e39 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/return_type_explicit_exp.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/return_type_explicit_exp.exp @@ -13,7 +13,7 @@ module 0x8675309::M { private fun t1(): u64 { return 0 } - private fun t2(): (u64, bool, M::R) { + private fun t2(): (u64, bool, R) { loop { if true { return Tuple(0, false, pack M::R(false)) @@ -24,3 +24,19 @@ module 0x8675309::M { Abort(0) } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + } + fun t0() { + if (true) () else () + } + fun t1(): u64 { + 0 + } + fun t2(): (u64, bool, R) { + while (true) return (0, false, R{}); + abort 0 + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/return_type_last_exp.exp b/third_party/move/move-compiler-v2/tests/checking/typing/return_type_last_exp.exp index d469d10153e28..1efd715b2ff84 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/return_type_last_exp.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/return_type_last_exp.exp @@ -9,7 +9,21 @@ module 0x8675309::M { private fun t1(): u64 { 0 } - private fun t2(): (u64, bool, M::R) { + private fun t2(): (u64, bool, R) { Tuple(0, false, pack M::R(false)) } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + } + fun t0() { + } + fun t1(): u64 { + 0 + } + fun t2(): (u64, bool, R) { + (0, false, R{}) + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/seq_ignores_value.exp b/third_party/move/move-compiler-v2/tests/checking/typing/seq_ignores_value.exp index 36751b65e11ae..ccb4861ab2f24 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/seq_ignores_value.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/seq_ignores_value.exp @@ -24,3 +24,21 @@ module 0x8675309::M { Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct S has drop { + } + fun t0() { + (); + } + fun t1() { + 0; + } + fun t2() { + (0, false, S{}); + } + fun t3() { + if (true) (0, false, S{}) else (0, false, S{}); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/shadowing.exp b/third_party/move/move-compiler-v2/tests/checking/typing/shadowing.exp index 7c470644e168e..5330d3e7bd8c3 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/shadowing.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/shadowing.exp @@ -41,3 +41,44 @@ module 0x8675309::M { Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct S { + f: u64, + b: bool, + } + fun t0() { + { + false; + }; + 0; + { + false; + }; + 0; + { + { + 0x0; + }; + false; + }; + 0; + } + fun t1(cond: bool) { + if (cond) { + false; + } else { + 0x0; + }; + 0; + } + fun t2() { + loop { + let S{f: _,b: x} = S{f: 0,b: false}; + false; + break + }; + 0; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/spec_block_ok.exp b/third_party/move/move-compiler-v2/tests/checking/typing/spec_block_ok.exp index 34634cdef94de..e0af192eb67db 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/spec_block_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/spec_block_ok.exp @@ -6,3 +6,14 @@ module 0x8675309::M { } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + fun specs_in_fun(_x: u64) { + + /* spec { + } + */ + + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/struct_no_field_list.exp b/third_party/move/move-compiler-v2/tests/checking/typing/struct_no_field_list.exp index 9b406f3159e49..070f921e332b9 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/struct_no_field_list.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/struct_no_field_list.exp @@ -3,7 +3,7 @@ module 0x42::m { struct S { dummy_field: bool, } - private fun f(_s: m::S): m::S { + private fun f(_s: S): S { pack m::S(false) } private fun d() { @@ -19,3 +19,17 @@ module 0x42::m { } } } // end 0x42::m + +// -- Sourcified model before bytecode pipeline +module 0x42::m { + struct S has copy, drop { + } + fun f(_s: S): S { + S{} + } + fun d() { + let S{} = S{}; + let S{} = S{}; + let S{} = S{}; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/subtype_annotation.exp b/third_party/move/move-compiler-v2/tests/checking/typing/subtype_annotation.exp index 5b93526f7596c..237df485ea5b1 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/subtype_annotation.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/subtype_annotation.exp @@ -20,3 +20,23 @@ module 0x8675309::M { Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct S has drop { + } + fun t0() { + &mut 0; + /*freeze*/&mut 0; + &0; + &mut S{}; + /*freeze*/&mut S{}; + &S{}; + } + fun t1() { + (&mut 0, &mut 0); + (&mut 0, /*freeze*/&mut 0); + (/*freeze*/&mut 0, &mut 0); + (/*freeze*/&mut 0, /*freeze*/&mut 0); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/subtype_args.exp b/third_party/move/move-compiler-v2/tests/checking/typing/subtype_args.exp index 47591d5ea5698..4f9d394213ba6 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/subtype_args.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/subtype_args.exp @@ -3,23 +3,23 @@ module 0x8675309::M { struct S { dummy_field: bool, } - private fun imm(_x: �) { + private fun imm(_x: &T) { Tuple() } - private fun imm_imm(_x: �,_y: �) { + private fun imm_imm(_x: &T,_y: &T) { Tuple() } - private fun imm_mut(_x: �,_y: &mut #0) { + private fun imm_mut(_x: &T,_y: &mut T) { Tuple() } - private fun mut_imm(_x: &mut #0,_y: �) { + private fun mut_imm(_x: &mut T,_y: &T) { Tuple() } private fun t0() { M::imm(Freeze(false)(Borrow(Mutable)(0))); M::imm(Borrow(Immutable)(0)); - M::imm(Freeze(false)(Borrow(Mutable)(pack M::S(false)))); - M::imm(Borrow(Immutable)(pack M::S(false))); + M::imm(Freeze(false)(Borrow(Mutable)(pack M::S(false)))); + M::imm(Borrow(Immutable)(pack M::S(false))); Tuple() } private fun t1() { @@ -34,3 +34,32 @@ module 0x8675309::M { Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct S has drop { + } + fun imm(_x: &T) { + } + fun imm_imm(_x: &T, _y: &T) { + } + fun imm_mut(_x: &T, _y: &mut T) { + } + fun mut_imm(_x: &mut T, _y: &T) { + } + fun t0() { + imm(/*freeze*/&mut 0); + imm(&0); + imm(/*freeze*/&mut S{}); + imm(&S{}); + } + fun t1() { + imm_mut(/*freeze*/&mut 0, &mut 0); + mut_imm(&mut 0, /*freeze*/&mut 0); + imm_imm(/*freeze*/&mut 0, /*freeze*/&mut 0); + } + inline fun t2(f: |(&u64, &mut u64)|) { + f(&mut 0, &mut 0); + f(&0, &mut 0); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/subtype_assign.exp b/third_party/move/move-compiler-v2/tests/checking/typing/subtype_assign.exp index 4a999869cd4a7..d4493825059b4 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/subtype_assign.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/subtype_assign.exp @@ -33,3 +33,28 @@ module 0x8675309::M { } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct S { + } + fun t0() { + let x; + x = /*freeze*/&mut 0; + x; + } + fun t1() { + let (x,y); + (x,y) = (&mut 0, /*freeze*/&mut 0); + x; + y; + let (x,y); + (x,y) = (/*freeze*/&mut 0, &mut 0); + x; + y; + let (x,y); + (x,y) = (/*freeze*/&mut 0, /*freeze*/&mut 0); + x; + y; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/subtype_bind.exp b/third_party/move/move-compiler-v2/tests/checking/typing/subtype_bind.exp index 70b49a9c85fe5..f0f96e40b7d90 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/subtype_bind.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/subtype_bind.exp @@ -29,3 +29,24 @@ module 0x8675309::M { } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct S { + } + fun t0() { + let x = /*freeze*/&mut 0; + x; + } + fun t1() { + let (x,y) = (&mut 0, /*freeze*/&mut 0); + x; + y; + let (x,y) = (/*freeze*/&mut 0, &mut 0); + x; + y; + let (x,y) = (/*freeze*/&mut 0, /*freeze*/&mut 0); + x; + y; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/subtype_return.exp b/third_party/move/move-compiler-v2/tests/checking/typing/subtype_return.exp index c7ac66f03b81d..ae5aaddde3f22 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/subtype_return.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/subtype_return.exp @@ -6,7 +6,7 @@ module 0x8675309::M { private fun t0(u: &mut u64): &u64 { Freeze(false)(u) } - private fun t1(s: &mut M::S): &M::S { + private fun t1(s: &mut S): &S { Freeze(false)(s) } private fun t2(u1: &mut u64,u2: &mut u64): (&u64, &mut u64) { @@ -19,3 +19,24 @@ module 0x8675309::M { Tuple(Freeze(false)(u1), Freeze(false)(u2)) } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct S { + } + fun t0(u: &mut u64): &u64 { + /*freeze*/u + } + fun t1(s: &mut S): &S { + /*freeze*/s + } + fun t2(u1: &mut u64, u2: &mut u64): (&u64, &mut u64) { + (/*freeze*/u1, u2) + } + fun t3(u1: &mut u64, u2: &mut u64): (&mut u64, &u64) { + (u1, /*freeze*/u2) + } + fun t4(u1: &mut u64, u2: &mut u64): (&u64, &u64) { + (/*freeze*/u1, /*freeze*/u2) + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/tuple.exp b/third_party/move/move-compiler-v2/tests/checking/typing/tuple.exp index 132846113b36a..2b347473d4478 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/tuple.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/tuple.exp @@ -3,13 +3,27 @@ module 0x42::tuple { struct S { f: u64, } - private fun tuple(x: u64): (u64, tuple::S) { + private fun tuple(x: u64): (u64, S) { Tuple(x, pack tuple::S(Add(x, 1))) } private fun use_tuple(x: u64): u64 { { - let (x: u64, tuple::S{ f: y }): (u64, tuple::S) = tuple::tuple(x); + let (x: u64, tuple::S{ f: y }): (u64, S) = tuple::tuple(x); Add(x, y) } } } // end 0x42::tuple + +// -- Sourcified model before bytecode pipeline +module 0x42::tuple { + struct S { + f: u64, + } + fun tuple(x: u64): (u64, S) { + (x, S{f: x + 1}) + } + fun use_tuple(x: u64): u64 { + let (x,S{f: y}) = tuple(x); + x + y + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_pack.exp b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_pack.exp index 0d0ae4c52ac2e..ab361d197f9af 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_pack.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_pack.exp @@ -6,13 +6,27 @@ module 0x42::M { } private fun t0() { { - let b: M::Box = pack M::Box(0, 1); + let b: Box = pack M::Box(0, 1); Deref(Borrow(Immutable)(b)); { - let b2: M::Box> = pack M::Box>(Deref(Borrow(Immutable)(b)), b); + let b2: Box> = pack M::Box>(Deref(Borrow(Immutable)(b)), b); b2; Tuple() } } } } // end 0x42::M + +// -- Sourcified model before bytecode pipeline +module 0x42::M { + struct Box has copy, drop { + f1: T, + f2: T, + } + fun t0() { + let b = Box{f1: 0,f2: 1}; + *&b; + let b2 = Box>{f1: *&b,f2: b}; + b2; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_unpack.exp b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_unpack.exp index 63252d1509136..ebfb56730b924 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_unpack.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_unpack.exp @@ -4,7 +4,7 @@ module 0x8675309::M { f1: #0, f2: #0, } - private fun new(): M::Box<#0> { + private fun new(): Box { Abort(0) } private fun t0() { @@ -13,7 +13,7 @@ module 0x8675309::M { f1; f2; { - let M::Box>{ f1, f2 } = M::new>(); + let M::Box>{ f1, f2 } = M::new>(); f1; f2; Tuple() @@ -21,3 +21,22 @@ module 0x8675309::M { } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct Box has drop { + f1: T, + f2: T, + } + fun new(): Box { + abort 0 + } + fun t0() { + let Box{f1: f1,f2: f2} = new(); + f1; + f2; + let Box>{f1: f1,f2: f2} = new>(); + f1; + f2; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_unpack_assign.exp b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_unpack_assign.exp index 141500cd03452..73269d41aa3c1 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_unpack_assign.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_unpack_assign.exp @@ -4,7 +4,7 @@ module 0x8675309::M { f1: #0, f2: #0, } - private fun new(): M::Box<#0> { + private fun new(): Box { Abort(0) } private fun t0() { @@ -16,10 +16,10 @@ module 0x8675309::M { f1; f2; { - let f1: M::Box; + let f1: Box; { - let f2: M::Box; - M::Box>{ f1, f2 } = M::new>(); + let f2: Box; + M::Box>{ f1, f2 } = M::new>(); f1; f2; Tuple() @@ -29,3 +29,26 @@ module 0x8675309::M { } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct Box has drop { + f1: T, + f2: T, + } + fun new(): Box { + abort 0 + } + fun t0() { + let f1; + let f2; + Box{f1: f1,f2: f2} = new(); + f1; + f2; + let f1; + let f2; + Box>{f1: f1,f2: f2} = new>(); + f1; + f2; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_pack.exp b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_pack.exp index 00bbfae97d9e5..cb79ee03e4703 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_pack.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_pack.exp @@ -3,13 +3,13 @@ module 0x2::Container { struct T { f: #0, } - public fun get(_self: &Container::T<#0>): #0 { + public fun get(_self: &T): V { Abort(0) } - public fun new(): Container::T<#0> { + public fun new(): T { Abort(0) } - public fun put(_self: &mut Container::T<#0>,_item: #0) { + public fun put(_self: &mut T,_item: V) { Abort(0) } } // end 0x2::Container @@ -19,13 +19,13 @@ module 0x2::M { f1: #0, f2: #0, } - private fun t0(): M::Box { + private fun t0(): Box { { let v: Container::T = Container::new(); { let x: u64 = Container::get(Borrow(Immutable)(v)); { - let b: M::Box = pack M::Box(x, x); + let b: Box = pack M::Box(x, x); Container::put(Borrow(Mutable)(v), 0); b } @@ -33,3 +33,33 @@ module 0x2::M { } } } // end 0x2::M + +// -- Sourcified model before bytecode pipeline +module 0x2::Container { + struct T has drop { + f: V, + } + public fun get(_self: &T): V { + abort 0 + } + public fun new(): T { + abort 0 + } + public fun put(_self: &mut T, _item: V) { + abort 0 + } +} +module 0x2::M { + use 0x2::Container; + struct Box has drop { + f1: T, + f2: T, + } + fun t0(): Box { + let v = Container::new(); + let x = Container::get(&v); + let b = Box{f1: x,f2: x}; + Container::put(&mut v, 0); + b + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/unary_not.exp b/third_party/move/move-compiler-v2/tests/checking/typing/unary_not.exp index da126c647eb2c..6028cd1a02094 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/unary_not.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/unary_not.exp @@ -3,16 +3,32 @@ module 0x8675309::M { struct R { f: bool, } - private fun t0(x: bool,r: M::R) { + private fun t0(x: bool,r: R) { false; true; Not(x); Not(Copy(x)); Not(Move(x)); - Not(select M::R.f(r)); + Not(select M::R.f(r)); { let M::R{ f: _ } = r; Tuple() } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + f: bool, + } + fun t0(x: bool, r: R) { + false; + true; + !x; + !(copy x); + !(move x); + !r.f; + let R{f: _} = r; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/unit.exp b/third_party/move/move-compiler-v2/tests/checking/typing/unit.exp index 0e7cba1feba85..d3915ca4454d9 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/unit.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/unit.exp @@ -5,3 +5,10 @@ module 0x8675309::M { Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + fun foo() { + (); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/unused_lambda_param.exp b/third_party/move/move-compiler-v2/tests/checking/typing/unused_lambda_param.exp index 27ff8573fad05..26dddef4b0ac9 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/unused_lambda_param.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/unused_lambda_param.exp @@ -24,3 +24,19 @@ module 0xc0ffee::m { Tuple() } } // end 0xc0ffee::m + +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::m { + inline fun test(p: u64, f: |u64|u64): u64 { + f(p) + } + fun unused_lambda() { + 1; + } + fun unused_lambda_suppressed1() { + 1; + } + fun unused_lambda_suppressed2() { + 1; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/unused_lambda_param_typed.exp b/third_party/move/move-compiler-v2/tests/checking/typing/unused_lambda_param_typed.exp index ca98b47e485f2..a8cb39a936fa9 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/unused_lambda_param_typed.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/unused_lambda_param_typed.exp @@ -24,3 +24,19 @@ module 0xc0ffee::m { Tuple() } } // end 0xc0ffee::m + +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::m { + inline fun test(p: u64, f: |u64|u64): u64 { + f(p) + } + fun unused_lambda() { + 1; + } + fun unused_lambda_suppressed1() { + 1; + } + fun unused_lambda_suppressed2() { + 1; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/unused_local.exp b/third_party/move/move-compiler-v2/tests/checking/typing/unused_local.exp index 0e221c884baf1..f1d8f4b665dd0 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/unused_local.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/unused_local.exp @@ -104,3 +104,37 @@ module 0x8675309::M { Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct S { + f: u64, + g: bool, + } + fun t0() { + } + fun t1() { + } + fun t2() { + let S{f: f,g: g}; + } + fun two_unused(x: u64, y: bool) { + } + fun unused_local_suppressed1() { + } + fun unused_local_suppressed2() { + } + native fun unused_native_ok(x: u64, y: bool) ; + fun unused_param(x: u64) { + } + fun unused_param1_used_param2(x: u64, y: bool): bool { + y + } + fun unused_param2_used_param1(x: u64, y: bool): u64 { + x + } + fun unused_param_suppressed1(_: u64) { + } + fun unused_param_suppressed2(_x: u64) { + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/use_local.exp b/third_party/move/move-compiler-v2/tests/checking/typing/use_local.exp index d211b57c21a2e..6f1a2a0fe293d 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/use_local.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/use_local.exp @@ -8,9 +8,9 @@ module 0x8675309::M { } private fun t() { { - let s: M::S = pack M::S(false); + let s: S = pack M::S(false); { - let r: M::R = pack M::R(false); + let r: R = pack M::R(false); 0; s; M::R{ dummy_field: _ } = r; @@ -19,3 +19,18 @@ module 0x8675309::M { } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + } + struct S has drop { + } + fun t() { + let s = S{}; + let r = R{}; + 0; + s; + R{} = r; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/v1-examples/multi_pool_money_market_token.exp b/third_party/move/move-compiler-v2/tests/checking/typing/v1-examples/multi_pool_money_market_token.exp index afd5f2f73d767..f4e0e789dbb91 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/v1-examples/multi_pool_money_market_token.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/v1-examples/multi_pool_money_market_token.exp @@ -22,25 +22,25 @@ module 0x2::Token { type: #0, value: u64, } - public fun create(type: #0,value: u64): Token::Coin<#0> { + public fun create(type: ATy,value: u64): Coin { pack Token::Coin(type, value) } - public fun value(coin: &Token::Coin<#0>): u64 { - select Token::Coin.value<&Token::Coin>(coin) + public fun value(coin: &Coin): u64 { + select Token::Coin.value<&Coin>(coin) } - public fun deposit(coin: &mut Token::Coin<#0>,check: Token::Coin<#0>) { + public fun deposit(coin: &mut Coin,check: Coin) { { let Token::Coin{ type, value } = check; - if Eq(Borrow(Immutable)(select Token::Coin.type<&mut Token::Coin>(coin)), Borrow(Immutable)(type)) { + if Eq(Borrow(Immutable)(select Token::Coin.type<&mut Coin>(coin)), Borrow(Immutable)(type)) { Tuple() } else { Abort(42) }; - select Token::Coin.value<&mut Token::Coin>(coin) = Add(select Token::Coin.value<&mut Token::Coin>(coin), value); + select Token::Coin.value<&mut Coin>(coin) = Add(select Token::Coin.value<&mut Coin>(coin), value); Tuple() } } - public fun destroy_zero(coin: Token::Coin<#0>) { + public fun destroy_zero(coin: Coin) { { let Token::Coin{ type: _, value } = coin; if Eq(value, 0) { @@ -50,57 +50,57 @@ module 0x2::Token { } } } - public fun join(xus: Token::Coin<#0>,coin2: Token::Coin<#0>): Token::Coin<#0> { + public fun join(xus: Coin,coin2: Coin): Coin { Token::deposit(Borrow(Mutable)(xus), coin2); xus } - public fun split(coin: Token::Coin<#0>,amount: u64): (Token::Coin<#0>, Token::Coin<#0>) { + public fun split(coin: Coin,amount: u64): (Coin, Coin) { { - let other: Token::Coin = Token::withdraw(Borrow(Mutable)(coin), amount); + let other: Coin = Token::withdraw(Borrow(Mutable)(coin), amount); Tuple(coin, other) } } - public fun withdraw(coin: &mut Token::Coin<#0>,amount: u64): Token::Coin<#0> { - if Ge(select Token::Coin.value<&mut Token::Coin>(coin), amount) { + public fun withdraw(coin: &mut Coin,amount: u64): Coin { + if Ge(select Token::Coin.value<&mut Coin>(coin), amount) { Tuple() } else { Abort(10) }; - select Token::Coin.value<&mut Token::Coin>(coin) = Sub(select Token::Coin.value<&mut Token::Coin>(coin), amount); - pack Token::Coin(Deref(Borrow(Immutable)(select Token::Coin.type<&mut Token::Coin>(coin))), amount) + select Token::Coin.value<&mut Coin>(coin) = Sub(select Token::Coin.value<&mut Coin>(coin), amount); + pack Token::Coin(Deref(Borrow(Immutable)(select Token::Coin.type<&mut Coin>(coin))), amount) } } // end 0x2::Token module 0x2::Map { struct T { } - public native fun empty(): Map::T<#0, #1>; - public native fun remove(m: &Map::T<#0, #1>,k: �): #1; - public native fun contains_key(m: &Map::T<#0, #1>,k: �): bool; - public native fun get(m: &Map::T<#0, #1>,k: �):  - public native fun get_mut(m: &mut Map::T<#0, #1>,k: �): &mut #1; - public native fun insert(m: &Map::T<#0, #1>,k: #0,v: #1); + public native fun empty(): T; + public native fun remove(m: &T,k: &K): V; + public native fun contains_key(m: &T,k: &K): bool; + public native fun get(m: &T,k: &K): &V; + public native fun get_mut(m: &mut T,k: &K): &mut V; + public native fun insert(m: &T,k: K,v: V); } // end 0x2::Map module 0x3::OneToOneMarket { use std::signer; use 0x2::Map; // resolved as: 0x2::Map use 0x2::Token; // resolved as: 0x2::Token struct BorrowRecord { - record: Map::T, + record: 0x2::Map::T, } struct DepositRecord { - record: Map::T, + record: 0x2::Map::T, } struct Pool { - coin: Token::Coin<#0>, + coin: 0x2::Token::Coin<#0>, } struct Price { price: u64, } - public fun borrow(account: &signer,pool_owner: address,amount: u64): Token::Coin<#1> - acquires OneToOneMarket::Price(*) - acquires OneToOneMarket::Pool(*) - acquires OneToOneMarket::DepositRecord(*) - acquires OneToOneMarket::BorrowRecord(*) + public fun borrow(account: &signer,pool_owner: address,amount: u64): Token::Coin + acquires 0x3::OneToOneMarket::Price(*) + acquires 0x3::OneToOneMarket::Pool(*) + acquires 0x3::OneToOneMarket::DepositRecord(*) + acquires 0x3::OneToOneMarket::BorrowRecord(*) { if Le(amount, OneToOneMarket::max_borrow_amount(account, pool_owner)) { Tuple() @@ -109,46 +109,46 @@ module 0x3::OneToOneMarket { }; OneToOneMarket::update_borrow_record(account, pool_owner, amount); { - let pool: &mut OneToOneMarket::Pool = BorrowGlobal(Mutable)>(pool_owner); - Token::withdraw(Borrow(Mutable)(select OneToOneMarket::Pool.coin<&mut OneToOneMarket::Pool>(pool)), amount) + let pool: &mut Pool = BorrowGlobal(Mutable)>(pool_owner); + Token::withdraw(Borrow(Mutable)(select OneToOneMarket::Pool.coin<&mut Pool>(pool)), amount) } } - public fun deposit(account: &signer,pool_owner: address,coin: Token::Coin<#0>) - acquires OneToOneMarket::Pool(*) - acquires OneToOneMarket::DepositRecord(*) + public fun deposit(account: &signer,pool_owner: address,coin: Token::Coin) + acquires 0x3::OneToOneMarket::Pool(*) + acquires 0x3::OneToOneMarket::DepositRecord(*) { { let amount: u64 = Token::value(Borrow(Immutable)(coin)); OneToOneMarket::update_deposit_record(account, pool_owner, amount); { - let pool: &mut OneToOneMarket::Pool = BorrowGlobal(Mutable)>(pool_owner); - Token::deposit(Borrow(Mutable)(select OneToOneMarket::Pool.coin<&mut OneToOneMarket::Pool>(pool)), coin) + let pool: &mut Pool = BorrowGlobal(Mutable)>(pool_owner); + Token::deposit(Borrow(Mutable)(select OneToOneMarket::Pool.coin<&mut Pool>(pool)), coin) } } } - private fun accept(account: &signer,init: Token::Coin<#0>) { + private fun accept(account: &signer,init: Token::Coin) { { let sender: address = signer::address_of(account); - if Not(exists>(sender)) { + if Not(exists>(sender)) { Tuple() } else { Abort(42) }; - MoveTo>(account, pack OneToOneMarket::Pool(init)) + MoveTo>(account, pack OneToOneMarket::Pool(init)) } } private fun borrowed_amount(account: &signer,pool_owner: address): u64 - acquires OneToOneMarket::BorrowRecord(*) + acquires 0x3::OneToOneMarket::BorrowRecord(*) { { let sender: address = signer::address_of(account); - if Not(exists>(sender)) { + if Not(exists>(sender)) { return 0 } else { Tuple() }; { - let record: &Map::T = Borrow(Immutable)(select OneToOneMarket::BorrowRecord.record<&OneToOneMarket::BorrowRecord>(BorrowGlobal(Immutable)>(sender))); + let record: &Map::T = Borrow(Immutable)(select OneToOneMarket::BorrowRecord.record<&BorrowRecord>(BorrowGlobal(Immutable)>(sender))); if Map::contains_key(record, Borrow(Immutable)(pool_owner)) { Deref(Map::get(record, Borrow(Immutable)(pool_owner))) } else { @@ -158,17 +158,17 @@ module 0x3::OneToOneMarket { } } private fun deposited_amount(account: &signer,pool_owner: address): u64 - acquires OneToOneMarket::DepositRecord(*) + acquires 0x3::OneToOneMarket::DepositRecord(*) { { let sender: address = signer::address_of(account); - if Not(exists>(sender)) { + if Not(exists>(sender)) { return 0 } else { Tuple() }; { - let record: &Map::T = Borrow(Immutable)(select OneToOneMarket::DepositRecord.record<&OneToOneMarket::DepositRecord>(BorrowGlobal(Immutable)>(sender))); + let record: &Map::T = Borrow(Immutable)(select OneToOneMarket::DepositRecord.record<&DepositRecord>(BorrowGlobal(Immutable)>(sender))); if Map::contains_key(record, Borrow(Immutable)(pool_owner)) { Deref(Map::get(record, Borrow(Immutable)(pool_owner))) } else { @@ -178,17 +178,17 @@ module 0x3::OneToOneMarket { } } private fun max_borrow_amount(account: &signer,pool_owner: address): u64 - acquires OneToOneMarket::Price(*) - acquires OneToOneMarket::Pool(*) - acquires OneToOneMarket::DepositRecord(*) - acquires OneToOneMarket::BorrowRecord(*) + acquires 0x3::OneToOneMarket::Price(*) + acquires 0x3::OneToOneMarket::Pool(*) + acquires 0x3::OneToOneMarket::DepositRecord(*) + acquires 0x3::OneToOneMarket::BorrowRecord(*) { { let input_deposited: u64 = OneToOneMarket::deposited_amount(account, pool_owner); { let output_deposited: u64 = OneToOneMarket::borrowed_amount(account, pool_owner); { - let input_into_output: u64 = Mul(input_deposited, select OneToOneMarket::Price.price<&OneToOneMarket::Price>(BorrowGlobal(Immutable)>(pool_owner))); + let input_into_output: u64 = Mul(input_deposited, select OneToOneMarket::Price.price<&Price>(BorrowGlobal(Immutable)>(pool_owner))); { let max_output: u64 = if Lt(input_into_output, output_deposited) { 0 @@ -197,8 +197,8 @@ module 0x3::OneToOneMarket { }; { let available_output: u64 = { - let pool: &OneToOneMarket::Pool = BorrowGlobal(Immutable)>(pool_owner); - Token::value(Borrow(Immutable)(select OneToOneMarket::Pool.coin<&OneToOneMarket::Pool>(pool))) + let pool: &Pool = BorrowGlobal(Immutable)>(pool_owner); + Token::value(Borrow(Immutable)(select OneToOneMarket::Pool.coin<&Pool>(pool))) }; if Lt(max_output, available_output) { max_output @@ -211,23 +211,23 @@ module 0x3::OneToOneMarket { } } } - public fun register_price(account: &signer,initial_in: Token::Coin<#0>,initial_out: Token::Coin<#1>,price: u64) { + public fun register_price(account: &signer,initial_in: Token::Coin,initial_out: Token::Coin,price: u64) { OneToOneMarket::accept(account, initial_in); OneToOneMarket::accept(account, initial_out); - MoveTo>(account, pack OneToOneMarket::Price(price)) + MoveTo>(account, pack OneToOneMarket::Price(price)) } private fun update_borrow_record(account: &signer,pool_owner: address,amount: u64) - acquires OneToOneMarket::BorrowRecord(*) + acquires 0x3::OneToOneMarket::BorrowRecord(*) { { let sender: address = signer::address_of(account); - if Not(exists>(sender)) { - MoveTo>(account, pack OneToOneMarket::BorrowRecord(Map::empty())) + if Not(exists>(sender)) { + MoveTo>(account, pack OneToOneMarket::BorrowRecord(Map::empty())) } else { Tuple() }; { - let record: &mut Map::T = Borrow(Mutable)(select OneToOneMarket::BorrowRecord.record<&mut OneToOneMarket::BorrowRecord>(BorrowGlobal(Mutable)>(sender))); + let record: &mut Map::T = Borrow(Mutable)(select OneToOneMarket::BorrowRecord.record<&mut BorrowRecord>(BorrowGlobal(Mutable)>(sender))); if Map::contains_key(Freeze(false)(record), Borrow(Immutable)(pool_owner)) { { let old_amount: u64 = Map::remove(Freeze(false)(record), Borrow(Immutable)(pool_owner)); @@ -242,17 +242,17 @@ module 0x3::OneToOneMarket { } } private fun update_deposit_record(account: &signer,pool_owner: address,amount: u64) - acquires OneToOneMarket::DepositRecord(*) + acquires 0x3::OneToOneMarket::DepositRecord(*) { { let sender: address = signer::address_of(account); - if Not(exists>(sender)) { - MoveTo>(account, pack OneToOneMarket::DepositRecord(Map::empty())) + if Not(exists>(sender)) { + MoveTo>(account, pack OneToOneMarket::DepositRecord(Map::empty())) } else { Tuple() }; { - let record: &mut Map::T = Borrow(Mutable)(select OneToOneMarket::DepositRecord.record<&mut OneToOneMarket::DepositRecord>(BorrowGlobal(Mutable)>(sender))); + let record: &mut Map::T = Borrow(Mutable)(select OneToOneMarket::DepositRecord.record<&mut DepositRecord>(BorrowGlobal(Mutable)>(sender))); if Map::contains_key(Freeze(false)(record), Borrow(Immutable)(pool_owner)) { { let old_amount: u64 = Map::remove(Freeze(false)(record), Borrow(Immutable)(pool_owner)); @@ -274,7 +274,7 @@ module 0x70dd::ToddNickels { dummy_field: bool, } struct Wallet { - nickels: Token::Coin, + nickels: 0x2::Token::Coin<0x70dd::ToddNickels::T>, } public fun init(account: &signer) { if Eq
(signer::address_of(account), 0x70dd) { @@ -282,19 +282,181 @@ module 0x70dd::ToddNickels { } else { Abort(42) }; - MoveTo(account, pack ToddNickels::Wallet(Token::create(pack ToddNickels::T(false), 0))) + MoveTo(account, pack ToddNickels::Wallet(Token::create(pack ToddNickels::T(false), 0))) } - public fun destroy(c: Token::Coin) - acquires ToddNickels::Wallet(*) + public fun destroy(c: Token::Coin) + acquires 0x70dd::ToddNickels::Wallet(*) { - Token::deposit(Borrow(Mutable)(select ToddNickels::Wallet.nickels<&mut ToddNickels::Wallet>(BorrowGlobal(Mutable)(0x70dd))), c) + Token::deposit(Borrow(Mutable)(select ToddNickels::Wallet.nickels<&mut Wallet>(BorrowGlobal(Mutable)(0x70dd))), c) } - public fun mint(account: &signer): Token::Coin { + public fun mint(account: &signer): Token::Coin { if Eq
(signer::address_of(account), 0x70dd) { Tuple() } else { Abort(42) }; - Token::create(pack ToddNickels::T(false), 5) + Token::create(pack ToddNickels::T(false), 5) } } // end 0x70dd::ToddNickels + +// -- Sourcified model before bytecode pipeline +module 0x2::Token { + struct Coin has store { + type: AssetType, + value: u64, + } + public fun create(type: ATy, value: u64): Coin { + Coin{type: type,value: value} + } + public fun value(coin: &Coin): u64 { + coin.value + } + public fun deposit(coin: &mut Coin, check: Coin) { + let Coin{type: type,value: value} = check; + if (&coin.type == &type) () else abort 42; + coin.value = coin.value + value; + } + public fun destroy_zero(coin: Coin) { + let Coin{type: _,value: value} = coin; + if (value == 0) () else abort 11 + } + public fun join(xus: Coin, coin2: Coin): Coin { + deposit(&mut xus, coin2); + xus + } + public fun split(coin: Coin, amount: u64): (Coin, Coin) { + let other = withdraw(&mut coin, amount); + (coin, other) + } + public fun withdraw(coin: &mut Coin, amount: u64): Coin { + if (coin.value >= amount) () else abort 10; + coin.value = coin.value - amount; + Coin{type: *&coin.type,value: amount} + } +} +module 0x2::Map { + struct T has copy, drop, store { + } + public native fun empty(): T ; + public native fun remove(m: &T, k: &K): V ; + public native fun contains_key(m: &T, k: &K): bool ; + public native fun get(m: &T, k: &K): &V ; + public native fun get_mut(m: &mut T, k: &K): &mut V ; + public native fun insert(m: &T, k: K, v: V) ; +} +module 0x3::OneToOneMarket { + use 0x2::Token; + use 0x2::Map; + struct BorrowRecord has key { + record: Map::T, + } + struct DepositRecord has key { + record: Map::T, + } + struct Pool has key { + coin: Token::Coin, + } + struct Price has key { + price: u64, + } + public fun borrow(account: &signer, pool_owner: address, amount: u64): Token::Coin + acquires Priceacquires Poolacquires DepositRecordacquires BorrowRecord + { + if (amount <= max_borrow_amount(account, pool_owner)) () else abort 1025; + update_borrow_record(account, pool_owner, amount); + let pool = borrow_global_mut>(pool_owner); + Token::withdraw(&mut pool.coin, amount) + } + public fun deposit(account: &signer, pool_owner: address, coin: Token::Coin) + acquires Poolacquires DepositRecord + { + let amount = Token::value(&coin); + update_deposit_record(account, pool_owner, amount); + let pool = borrow_global_mut>(pool_owner); + Token::deposit(&mut pool.coin, coin) + } + fun accept(account: &signer, init: Token::Coin) { + let sender = 0x1::signer::address_of(account); + if (!exists>(sender)) () else abort 42; + move_to>(account, Pool{coin: init}) + } + fun borrowed_amount(account: &signer, pool_owner: address): u64 + acquires BorrowRecord + { + let sender = 0x1::signer::address_of(account); + if (!exists>(sender)) return 0; + let record = &borrow_global>(sender).record; + if (Map::contains_key(record, &pool_owner)) *Map::get(record, &pool_owner) else 0 + } + fun deposited_amount(account: &signer, pool_owner: address): u64 + acquires DepositRecord + { + let sender = 0x1::signer::address_of(account); + if (!exists>(sender)) return 0; + let record = &borrow_global>(sender).record; + if (Map::contains_key(record, &pool_owner)) *Map::get(record, &pool_owner) else 0 + } + fun max_borrow_amount(account: &signer, pool_owner: address): u64 + acquires Priceacquires Poolacquires DepositRecordacquires BorrowRecord + { + let input_deposited = deposited_amount(account, pool_owner); + let output_deposited = borrowed_amount(account, pool_owner); + let input_into_output = input_deposited * borrow_global>(pool_owner).price; + let max_output = if (input_into_output < output_deposited) 0 else input_into_output - output_deposited; + let available_output = { + let pool = borrow_global>(pool_owner); + Token::value(&pool.coin) + }; + if (max_output < available_output) max_output else available_output + } + public fun register_price(account: &signer, initial_in: Token::Coin, initial_out: Token::Coin, price: u64) { + accept(account, initial_in); + accept(account, initial_out); + move_to>(account, Price{price: price}) + } + fun update_borrow_record(account: &signer, pool_owner: address, amount: u64) + acquires BorrowRecord + { + let sender = 0x1::signer::address_of(account); + if (!exists>(sender)) move_to>(account, BorrowRecord{record: Map::empty()}); + let record = &mut borrow_global_mut>(sender).record; + if (Map::contains_key(/*freeze*/record, &pool_owner)) { + let old_amount = Map::remove(/*freeze*/record, &pool_owner); + amount = amount + old_amount; + }; + Map::insert(/*freeze*/record, pool_owner, amount) + } + fun update_deposit_record(account: &signer, pool_owner: address, amount: u64) + acquires DepositRecord + { + let sender = 0x1::signer::address_of(account); + if (!exists>(sender)) move_to>(account, DepositRecord{record: Map::empty()}); + let record = &mut borrow_global_mut>(sender).record; + if (Map::contains_key(/*freeze*/record, &pool_owner)) { + let old_amount = Map::remove(/*freeze*/record, &pool_owner); + amount = amount + old_amount; + }; + Map::insert(/*freeze*/record, pool_owner, amount) + } +} +module 0x70dd::ToddNickels { + use 0x2::Token; + struct T has copy, drop, store { + } + struct Wallet has key { + nickels: Token::Coin, + } + public fun init(account: &signer) { + if (0x1::signer::address_of(account) == 0x70dd) () else abort 42; + move_to(account, Wallet{nickels: Token::create(T{}, 0)}) + } + public fun destroy(c: Token::Coin) + acquires Wallet + { + Token::deposit(&mut borrow_global_mut(0x70dd).nickels, c) + } + public fun mint(account: &signer): Token::Coin { + if (0x1::signer::address_of(account) == 0x70dd) () else abort 42; + Token::create(T{}, 5) + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/v1-examples/simple_money_market_token.exp b/third_party/move/move-compiler-v2/tests/checking/typing/v1-examples/simple_money_market_token.exp index b2f8b5a64657b..f28f09f7ddb92 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/v1-examples/simple_money_market_token.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/v1-examples/simple_money_market_token.exp @@ -4,25 +4,25 @@ module 0x2::Token { type: #0, value: u64, } - public fun create(type: #0,value: u64): Token::Coin<#0> { + public fun create(type: ATy,value: u64): Coin { pack Token::Coin(type, value) } - public fun value(coin: &Token::Coin<#0>): u64 { - select Token::Coin.value<&Token::Coin>(coin) + public fun value(coin: &Coin): u64 { + select Token::Coin.value<&Coin>(coin) } - public fun deposit(coin: &mut Token::Coin<#0>,check: Token::Coin<#0>) { + public fun deposit(coin: &mut Coin,check: Coin) { { let Token::Coin{ type, value } = check; - if Eq(Borrow(Immutable)(select Token::Coin.type<&mut Token::Coin>(coin)), Borrow(Immutable)(type)) { + if Eq(Borrow(Immutable)(select Token::Coin.type<&mut Coin>(coin)), Borrow(Immutable)(type)) { Tuple() } else { Abort(42) }; - select Token::Coin.value<&mut Token::Coin>(coin) = Add(select Token::Coin.value<&mut Token::Coin>(coin), value); + select Token::Coin.value<&mut Coin>(coin) = Add(select Token::Coin.value<&mut Coin>(coin), value); Tuple() } } - public fun destroy_zero(coin: Token::Coin<#0>) { + public fun destroy_zero(coin: Coin) { { let Token::Coin{ type: _, value } = coin; if Eq(value, 0) { @@ -32,24 +32,24 @@ module 0x2::Token { } } } - public fun join(xus: Token::Coin<#0>,coin2: Token::Coin<#0>): Token::Coin<#0> { + public fun join(xus: Coin,coin2: Coin): Coin { Token::deposit(Borrow(Mutable)(xus), coin2); xus } - public fun split(coin: Token::Coin<#0>,amount: u64): (Token::Coin<#0>, Token::Coin<#0>) { + public fun split(coin: Coin,amount: u64): (Coin, Coin) { { - let other: Token::Coin = Token::withdraw(Borrow(Mutable)(coin), amount); + let other: Coin = Token::withdraw(Borrow(Mutable)(coin), amount); Tuple(coin, other) } } - public fun withdraw(coin: &mut Token::Coin<#0>,amount: u64): Token::Coin<#0> { - if Ge(select Token::Coin.value<&mut Token::Coin>(coin), amount) { + public fun withdraw(coin: &mut Coin,amount: u64): Coin { + if Ge(select Token::Coin.value<&mut Coin>(coin), amount) { Tuple() } else { Abort(10) }; - select Token::Coin.value<&mut Token::Coin>(coin) = Sub(select Token::Coin.value<&mut Token::Coin>(coin), amount); - pack Token::Coin(Deref(Borrow(Immutable)(select Token::Coin.type<&mut Token::Coin>(coin))), amount) + select Token::Coin.value<&mut Coin>(coin) = Sub(select Token::Coin.value<&mut Coin>(coin), amount); + pack Token::Coin(Deref(Borrow(Immutable)(select Token::Coin.type<&mut Coin>(coin))), amount) } } // end 0x2::Token module 0x70dd::ToddNickels { @@ -59,7 +59,7 @@ module 0x70dd::ToddNickels { dummy_field: bool, } struct Wallet { - nickels: Token::Coin, + nickels: 0x2::Token::Coin<0x70dd::ToddNickels::T>, } public fun init(account: &signer) { if Eq
(signer::address_of(account), 0x70dd) { @@ -67,20 +67,20 @@ module 0x70dd::ToddNickels { } else { Abort(42) }; - MoveTo(account, pack ToddNickels::Wallet(Token::create(pack ToddNickels::T(false), 0))) + MoveTo(account, pack ToddNickels::Wallet(Token::create(pack ToddNickels::T(false), 0))) } - public fun destroy(c: Token::Coin) - acquires ToddNickels::Wallet(*) + public fun destroy(c: Token::Coin) + acquires 0x70dd::ToddNickels::Wallet(*) { - Token::deposit(Borrow(Mutable)(select ToddNickels::Wallet.nickels<&mut ToddNickels::Wallet>(BorrowGlobal(Mutable)(0x70dd))), c) + Token::deposit(Borrow(Mutable)(select ToddNickels::Wallet.nickels<&mut Wallet>(BorrowGlobal(Mutable)(0x70dd))), c) } - public fun mint(account: &signer): Token::Coin { + public fun mint(account: &signer): Token::Coin { if Eq
(signer::address_of(account), 0x70dd) { Tuple() } else { Abort(42) }; - Token::create(pack ToddNickels::T(false), 5) + Token::create(pack ToddNickels::T(false), 5) } } // end 0x70dd::ToddNickels module 0xb055::OneToOneMarket { @@ -93,16 +93,16 @@ module 0xb055::OneToOneMarket { record: u64, } struct Pool { - coin: Token::Coin<#0>, + coin: 0x2::Token::Coin<#0>, } struct Price { price: u64, } - public fun borrow(account: &signer,amount: u64): Token::Coin<#1> - acquires OneToOneMarket::Price(*) - acquires OneToOneMarket::Pool(*) - acquires OneToOneMarket::DepositRecord(*) - acquires OneToOneMarket::BorrowRecord(*) + public fun borrow(account: &signer,amount: u64): Token::Coin + acquires 0xb055::OneToOneMarket::Price(*) + acquires 0xb055::OneToOneMarket::Pool(*) + acquires 0xb055::OneToOneMarket::DepositRecord(*) + acquires 0xb055::OneToOneMarket::BorrowRecord(*) { if Le(amount, OneToOneMarket::max_borrow_amount(account)) { Tuple() @@ -111,72 +111,72 @@ module 0xb055::OneToOneMarket { }; OneToOneMarket::update_borrow_record(account, amount); { - let pool: &mut OneToOneMarket::Pool = BorrowGlobal(Mutable)>(0xb055); - Token::withdraw(Borrow(Mutable)(select OneToOneMarket::Pool.coin<&mut OneToOneMarket::Pool>(pool)), amount) + let pool: &mut Pool = BorrowGlobal(Mutable)>(0xb055); + Token::withdraw(Borrow(Mutable)(select OneToOneMarket::Pool.coin<&mut Pool>(pool)), amount) } } - public fun deposit(account: &signer,coin: Token::Coin<#0>) - acquires OneToOneMarket::Pool(*) - acquires OneToOneMarket::DepositRecord(*) + public fun deposit(account: &signer,coin: Token::Coin) + acquires 0xb055::OneToOneMarket::Pool(*) + acquires 0xb055::OneToOneMarket::DepositRecord(*) { { let amount: u64 = Token::value(Borrow(Immutable)(coin)); OneToOneMarket::update_deposit_record(account, amount); { - let pool: &mut OneToOneMarket::Pool = BorrowGlobal(Mutable)>(0xb055); - Token::deposit(Borrow(Mutable)(select OneToOneMarket::Pool.coin<&mut OneToOneMarket::Pool>(pool)), coin) + let pool: &mut Pool = BorrowGlobal(Mutable)>(0xb055); + Token::deposit(Borrow(Mutable)(select OneToOneMarket::Pool.coin<&mut Pool>(pool)), coin) } } } - private fun accept(account: &signer,init: Token::Coin<#0>) { + private fun accept(account: &signer,init: Token::Coin) { { let sender: address = signer::address_of(account); - if Not(exists>(sender)) { + if Not(exists>(sender)) { Tuple() } else { Abort(42) }; - MoveTo>(account, pack OneToOneMarket::Pool(init)) + MoveTo>(account, pack OneToOneMarket::Pool(init)) } } private fun borrowed_amount(account: &signer): u64 - acquires OneToOneMarket::BorrowRecord(*) + acquires 0xb055::OneToOneMarket::BorrowRecord(*) { { let sender: address = signer::address_of(account); - if Not(exists>(sender)) { + if Not(exists>(sender)) { return 0 } else { Tuple() }; - select OneToOneMarket::BorrowRecord.record<&OneToOneMarket::BorrowRecord>(BorrowGlobal(Immutable)>(sender)) + select OneToOneMarket::BorrowRecord.record<&BorrowRecord>(BorrowGlobal(Immutable)>(sender)) } } private fun deposited_amount(account: &signer): u64 - acquires OneToOneMarket::DepositRecord(*) + acquires 0xb055::OneToOneMarket::DepositRecord(*) { { let sender: address = signer::address_of(account); - if Not(exists>(sender)) { + if Not(exists>(sender)) { return 0 } else { Tuple() }; - select OneToOneMarket::DepositRecord.record<&OneToOneMarket::DepositRecord>(BorrowGlobal(Immutable)>(sender)) + select OneToOneMarket::DepositRecord.record<&DepositRecord>(BorrowGlobal(Immutable)>(sender)) } } private fun max_borrow_amount(account: &signer): u64 - acquires OneToOneMarket::Price(*) - acquires OneToOneMarket::Pool(*) - acquires OneToOneMarket::DepositRecord(*) - acquires OneToOneMarket::BorrowRecord(*) + acquires 0xb055::OneToOneMarket::Price(*) + acquires 0xb055::OneToOneMarket::Pool(*) + acquires 0xb055::OneToOneMarket::DepositRecord(*) + acquires 0xb055::OneToOneMarket::BorrowRecord(*) { { let input_deposited: u64 = OneToOneMarket::deposited_amount(account); { let output_deposited: u64 = OneToOneMarket::borrowed_amount(account); { - let input_into_output: u64 = Mul(input_deposited, select OneToOneMarket::Price.price<&OneToOneMarket::Price>(BorrowGlobal(Immutable)>(0xb055))); + let input_into_output: u64 = Mul(input_deposited, select OneToOneMarket::Price.price<&Price>(BorrowGlobal(Immutable)>(0xb055))); { let max_output: u64 = if Lt(input_into_output, output_deposited) { 0 @@ -185,8 +185,8 @@ module 0xb055::OneToOneMarket { }; { let available_output: u64 = { - let pool: &OneToOneMarket::Pool = BorrowGlobal(Immutable)>(0xb055); - Token::value(Borrow(Immutable)(select OneToOneMarket::Pool.coin<&OneToOneMarket::Pool>(pool))) + let pool: &Pool = BorrowGlobal(Immutable)>(0xb055); + Token::value(Borrow(Immutable)(select OneToOneMarket::Pool.coin<&Pool>(pool))) }; if Lt(max_output, available_output) { max_output @@ -199,7 +199,7 @@ module 0xb055::OneToOneMarket { } } } - public fun register_price(account: &signer,initial_in: Token::Coin<#0>,initial_out: Token::Coin<#1>,price: u64) { + public fun register_price(account: &signer,initial_in: Token::Coin,initial_out: Token::Coin,price: u64) { { let sender: address = signer::address_of(account); if Eq
(sender, 0xb055) { @@ -209,39 +209,182 @@ module 0xb055::OneToOneMarket { }; OneToOneMarket::accept(account, initial_in); OneToOneMarket::accept(account, initial_out); - MoveTo>(account, pack OneToOneMarket::Price(price)) + MoveTo>(account, pack OneToOneMarket::Price(price)) } } private fun update_borrow_record(account: &signer,amount: u64) - acquires OneToOneMarket::BorrowRecord(*) + acquires 0xb055::OneToOneMarket::BorrowRecord(*) { { let sender: address = signer::address_of(account); - if Not(exists>(sender)) { - MoveTo>(account, pack OneToOneMarket::BorrowRecord(0)) + if Not(exists>(sender)) { + MoveTo>(account, pack OneToOneMarket::BorrowRecord(0)) } else { Tuple() }; { - let record: &mut u64 = Borrow(Mutable)(select OneToOneMarket::BorrowRecord.record<&mut OneToOneMarket::BorrowRecord>(BorrowGlobal(Mutable)>(sender))); + let record: &mut u64 = Borrow(Mutable)(select OneToOneMarket::BorrowRecord.record<&mut BorrowRecord>(BorrowGlobal(Mutable)>(sender))); record = Add(Deref(record), amount) } } } private fun update_deposit_record(account: &signer,amount: u64) - acquires OneToOneMarket::DepositRecord(*) + acquires 0xb055::OneToOneMarket::DepositRecord(*) { { let sender: address = signer::address_of(account); - if Not(exists>(sender)) { - MoveTo>(account, pack OneToOneMarket::DepositRecord(0)) + if Not(exists>(sender)) { + MoveTo>(account, pack OneToOneMarket::DepositRecord(0)) } else { Tuple() }; { - let record: &mut u64 = Borrow(Mutable)(select OneToOneMarket::DepositRecord.record<&mut OneToOneMarket::DepositRecord>(BorrowGlobal(Mutable)>(sender))); + let record: &mut u64 = Borrow(Mutable)(select OneToOneMarket::DepositRecord.record<&mut DepositRecord>(BorrowGlobal(Mutable)>(sender))); record = Add(Deref(record), amount) } } } } // end 0xb055::OneToOneMarket + +// -- Sourcified model before bytecode pipeline +module 0x2::Token { + struct Coin has store { + type: AssetType, + value: u64, + } + public fun create(type: ATy, value: u64): Coin { + Coin{type: type,value: value} + } + public fun value(coin: &Coin): u64 { + coin.value + } + public fun deposit(coin: &mut Coin, check: Coin) { + let Coin{type: type,value: value} = check; + if (&coin.type == &type) () else abort 42; + coin.value = coin.value + value; + } + public fun destroy_zero(coin: Coin) { + let Coin{type: _,value: value} = coin; + if (value == 0) () else abort 11 + } + public fun join(xus: Coin, coin2: Coin): Coin { + deposit(&mut xus, coin2); + xus + } + public fun split(coin: Coin, amount: u64): (Coin, Coin) { + let other = withdraw(&mut coin, amount); + (coin, other) + } + public fun withdraw(coin: &mut Coin, amount: u64): Coin { + if (coin.value >= amount) () else abort 10; + coin.value = coin.value - amount; + Coin{type: *&coin.type,value: amount} + } +} +module 0x70dd::ToddNickels { + use 0x2::Token; + struct T has copy, drop, store { + } + struct Wallet has key { + nickels: Token::Coin, + } + public fun init(account: &signer) { + if (0x1::signer::address_of(account) == 0x70dd) () else abort 42; + move_to(account, Wallet{nickels: Token::create(T{}, 0)}) + } + public fun destroy(c: Token::Coin) + acquires Wallet + { + Token::deposit(&mut borrow_global_mut(0x70dd).nickels, c) + } + public fun mint(account: &signer): Token::Coin { + if (0x1::signer::address_of(account) == 0x70dd) () else abort 42; + Token::create(T{}, 5) + } +} +module 0xb055::OneToOneMarket { + use 0x2::Token; + struct BorrowRecord has key { + record: u64, + } + struct DepositRecord has key { + record: u64, + } + struct Pool has key { + coin: Token::Coin, + } + struct Price has key { + price: u64, + } + public fun borrow(account: &signer, amount: u64): Token::Coin + acquires Priceacquires Poolacquires DepositRecordacquires BorrowRecord + { + if (amount <= max_borrow_amount(account)) () else abort 1025; + update_borrow_record(account, amount); + let pool = borrow_global_mut>(0xb055); + Token::withdraw(&mut pool.coin, amount) + } + public fun deposit(account: &signer, coin: Token::Coin) + acquires Poolacquires DepositRecord + { + let amount = Token::value(&coin); + update_deposit_record(account, amount); + let pool = borrow_global_mut>(0xb055); + Token::deposit(&mut pool.coin, coin) + } + fun accept(account: &signer, init: Token::Coin) { + let sender = 0x1::signer::address_of(account); + if (!exists>(sender)) () else abort 42; + move_to>(account, Pool{coin: init}) + } + fun borrowed_amount(account: &signer): u64 + acquires BorrowRecord + { + let sender = 0x1::signer::address_of(account); + if (!exists>(sender)) return 0; + borrow_global>(sender).record + } + fun deposited_amount(account: &signer): u64 + acquires DepositRecord + { + let sender = 0x1::signer::address_of(account); + if (!exists>(sender)) return 0; + borrow_global>(sender).record + } + fun max_borrow_amount(account: &signer): u64 + acquires Priceacquires Poolacquires DepositRecordacquires BorrowRecord + { + let input_deposited = deposited_amount(account); + let output_deposited = borrowed_amount(account); + let input_into_output = input_deposited * borrow_global>(0xb055).price; + let max_output = if (input_into_output < output_deposited) 0 else input_into_output - output_deposited; + let available_output = { + let pool = borrow_global>(0xb055); + Token::value(&pool.coin) + }; + if (max_output < available_output) max_output else available_output + } + public fun register_price(account: &signer, initial_in: Token::Coin, initial_out: Token::Coin, price: u64) { + let sender = 0x1::signer::address_of(account); + if (sender == 0xb055) () else abort 42; + accept(account, initial_in); + accept(account, initial_out); + move_to>(account, Price{price: price}) + } + fun update_borrow_record(account: &signer, amount: u64) + acquires BorrowRecord + { + let sender = 0x1::signer::address_of(account); + if (!exists>(sender)) move_to>(account, BorrowRecord{record: 0}); + let record = &mut borrow_global_mut>(sender).record; + *record = *record + amount + } + fun update_deposit_record(account: &signer, amount: u64) + acquires DepositRecord + { + let sender = 0x1::signer::address_of(account); + if (!exists>(sender)) move_to>(account, DepositRecord{record: 0}); + let record = &mut borrow_global_mut>(sender).record; + *record = *record + amount + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/values.exp b/third_party/move/move-compiler-v2/tests/checking/typing/values.exp index 4b5bcacdedbcc..4946b50f1eaf6 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/values.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/values.exp @@ -9,3 +9,14 @@ module 0x8675309::M { Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + fun t() { + 0x1; + 0; + 10000; + true; + false; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/vector_basic_cases.exp b/third_party/move/move-compiler-v2/tests/checking/typing/vector_basic_cases.exp index fd4c8a5d38bce..e06c3d6abf801 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/vector_basic_cases.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/vector_basic_cases.exp @@ -8,7 +8,7 @@ module 0x42::Test { [Number(0), Number(1), Number(2)]; [Number(0), Number(1), Number(2)]; [Address(Numerical(0000000000000000000000000000000000000000000000000000000000000000)), Address(Numerical(0000000000000000000000000000000000000000000000000000000000000001))]; - Vector(pack Test::X(false), pack Test::X(false)); + Vector(pack Test::X(false), pack Test::X(false)); Vector>(Vector
(), Vector
()); Vector>>(Vector>(Vector
(), Vector
()), Vector>()); Tuple() @@ -22,9 +22,36 @@ module 0x42::Test { [Number(0)]; [Number(0)]; [Address(Numerical(0000000000000000000000000000000000000000000000000000000000000000))]; - Vector(pack Test::X(false)); + Vector(pack Test::X(false)); Vector>(Vector
()); Vector>>(Vector>(Vector
())); Tuple() } } // end 0x42::Test + +// -- Sourcified model before bytecode pipeline +module 0x42::Test { + struct X has drop { + } + fun many() { + vector[0u8, 1u8, 2u8]; + vector[0, 1, 2]; + vector[0u128, 1u128, 2u128]; + vector[0x0, 0x1]; + vector[X{}, X{}]; + vector[vector[], vector[]]; + vector[vector[vector[], vector[]], vector[]]; + } + fun none() { + vector[]; + } + fun one() { + vector[0u8]; + vector[0]; + vector[0u128]; + vector[0x0]; + vector[X{}]; + vector[vector[]]; + vector[vector[vector[]]]; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/while_body.exp b/third_party/move/move-compiler-v2/tests/checking/typing/while_body.exp index c71c0fe643d07..e2b63bd3fa16b 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/while_body.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/while_body.exp @@ -91,3 +91,22 @@ module 0x8675309::M { } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + fun t0(cond: bool) { + while (cond) (); + while (cond) (); + while (cond) (); + while (cond) { + 0; + }; + while (cond) if (cond) (); + while (cond) break; + while (cond) break; + while (cond) continue; + while (cond) continue; + while (cond) return (); + while (cond) while (cond) break + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/while_condition.exp b/third_party/move/move-compiler-v2/tests/checking/typing/while_condition.exp index a939866f306f8..039489df286e3 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/while_condition.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/while_condition.exp @@ -33,3 +33,15 @@ module 0x8675309::M { } } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + fun t0() { + while (true) (); + while (false) () + } + fun t1() { + while (true) (); + while (false) () + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/unused/local_var.exp b/third_party/move/move-compiler-v2/tests/checking/unused/local_var.exp index da933d7ffa6a1..4dd44d731fac7 100644 --- a/third_party/move/move-compiler-v2/tests/checking/unused/local_var.exp +++ b/third_party/move/move-compiler-v2/tests/checking/unused/local_var.exp @@ -4,3 +4,10 @@ module 0xc0ffee::m { 5 } } // end 0xc0ffee::m + +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::m { + public fun test(): u64 { + 5 + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/unused/unused_enum.exp b/third_party/move/move-compiler-v2/tests/checking/unused/unused_enum.exp index 118953e1f7238..1905db1c3f9dc 100644 --- a/third_party/move/move-compiler-v2/tests/checking/unused/unused_enum.exp +++ b/third_party/move/move-compiler-v2/tests/checking/unused/unused_enum.exp @@ -4,10 +4,23 @@ module 0x42::enum_types { enum MessageHolder { Empty, Message { - message: string::String, + message: 0x1::string::String, } NewMessage { - message: string::String, + message: 0x1::string::String, } } } // end 0x42::enum_types + +// -- Sourcified model before bytecode pipeline +module 0x42::enum_types { + enum MessageHolder has drop, key { + Empty, + Message { + message: 0x1::string::String, + } + NewMessage { + message: 0x1::string::String, + } + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/variants/variants_allow_match_empty_block.exp b/third_party/move/move-compiler-v2/tests/checking/variants/variants_allow_match_empty_block.exp index 763597db69434..211d1c533310f 100644 --- a/third_party/move/move-compiler-v2/tests/checking/variants/variants_allow_match_empty_block.exp +++ b/third_party/move/move-compiler-v2/tests/checking/variants/variants_allow_match_empty_block.exp @@ -4,3 +4,9 @@ module 0x815::m { Tuple() } } // end 0x815::m + +// -- Sourcified model before bytecode pipeline +module 0x815::m { + fun match() { + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/variants/variants_allow_match_fun_1.exp b/third_party/move/move-compiler-v2/tests/checking/variants/variants_allow_match_fun_1.exp index 310eee4728c3c..1abaaa8079872 100644 --- a/third_party/move/move-compiler-v2/tests/checking/variants/variants_allow_match_fun_1.exp +++ b/third_party/move/move-compiler-v2/tests/checking/variants/variants_allow_match_fun_1.exp @@ -10,18 +10,41 @@ module 0x815::m { z: u32, } } - private fun caller(c: m::CommonFields): bool { + private fun caller(c: CommonFields): bool { m::match(c) } - private fun match(c: m::CommonFields): bool { + private fun match(c: CommonFields): bool { match (c) { m::CommonFields::Foo{ x, y: _ } => { Gt(x, 0) } - _: m::CommonFields => { + _: CommonFields => { false } } } } // end 0x815::m + +// -- Sourcified model before bytecode pipeline +module 0x815::m { + enum CommonFields { + Foo { + x: u64, + y: u8, + } + Bar { + x: u64, + z: u32, + } + } + fun caller(c: CommonFields): bool { + match(c) + } + fun match(c: CommonFields): bool { + match (c) { + CommonFields::Foo{x: x,y: _} => x > 0, + _ => false, + } + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/variants/variants_allow_match_fun_2.exp b/third_party/move/move-compiler-v2/tests/checking/variants/variants_allow_match_fun_2.exp index 4f144439aeab2..3c6136be07907 100644 --- a/third_party/move/move-compiler-v2/tests/checking/variants/variants_allow_match_fun_2.exp +++ b/third_party/move/move-compiler-v2/tests/checking/variants/variants_allow_match_fun_2.exp @@ -15,12 +15,12 @@ module 0x815::m { } private fun match(): bool { { - let c: m::CommonFields = pack m::CommonFields::Foo(0, 0); + let c: CommonFields = pack m::CommonFields::Foo(0, 0); match (c) { m::CommonFields::Foo{ x, y: _ } => { Gt(x, 0) } - _: m::CommonFields => { + _: CommonFields => { false } } @@ -28,3 +28,27 @@ module 0x815::m { } } } // end 0x815::m + +// -- Sourcified model before bytecode pipeline +module 0x815::m { + enum CommonFields { + Foo { + x: u64, + y: u8, + } + Bar { + x: u64, + z: u32, + } + } + fun caller(): bool { + match() + } + fun match(): bool { + let c = CommonFields::Foo{x: 0,y: 0u8}; + match (c) { + CommonFields::Foo{x: x,y: _} => x > 0, + _ => false, + } + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/variants/variants_allow_match_fun_3.exp b/third_party/move/move-compiler-v2/tests/checking/variants/variants_allow_match_fun_3.exp index fd62c81d4e4be..16ae0b37ecef0 100644 --- a/third_party/move/move-compiler-v2/tests/checking/variants/variants_allow_match_fun_3.exp +++ b/third_party/move/move-compiler-v2/tests/checking/variants/variants_allow_match_fun_3.exp @@ -10,18 +10,41 @@ module 0x815::m { z: u32, } } - private fun caller(c: m::CommonFields): bool { + private fun caller(c: CommonFields): bool { And(m::match(c, 22), true) } - private fun match(c: m::CommonFields,t: u64): bool { + private fun match(c: CommonFields,t: u64): bool { match (c) { m::CommonFields::Foo{ x, y: _ } => { Gt(x, t) } - _: m::CommonFields => { + _: CommonFields => { false } } } } // end 0x815::m + +// -- Sourcified model before bytecode pipeline +module 0x815::m { + enum CommonFields { + Foo { + x: u64, + y: u8, + } + Bar { + x: u64, + z: u32, + } + } + fun caller(c: CommonFields): bool { + match(c, 22) && true + } + fun match(c: CommonFields, t: u64): bool { + match (c) { + CommonFields::Foo{x: x,y: _} => x > t, + _ => false, + } + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/variants/variants_allow_match_var.exp b/third_party/move/move-compiler-v2/tests/checking/variants/variants_allow_match_var.exp index b9760d48fca83..574285468902b 100644 --- a/third_party/move/move-compiler-v2/tests/checking/variants/variants_allow_match_var.exp +++ b/third_party/move/move-compiler-v2/tests/checking/variants/variants_allow_match_var.exp @@ -10,7 +10,7 @@ module 0x815::m { z: u32, } } - private fun match(c: m::CommonFields,t: u64): bool { + private fun match(c: CommonFields,t: u64): bool { match (c) { m::CommonFields::Foo{ x, y: _ } => { { @@ -18,10 +18,33 @@ module 0x815::m { match } } - _: m::CommonFields => { + _: CommonFields => { false } } } } // end 0x815::m + +// -- Sourcified model before bytecode pipeline +module 0x815::m { + enum CommonFields { + Foo { + x: u64, + y: u8, + } + Bar { + x: u64, + z: u32, + } + } + fun match(c: CommonFields, t: u64): bool { + match (c) { + CommonFields::Foo{x: x,y: _} => { + let match = x > t; + match + }, + _ => false, + } + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/variants/variants_constants.exp b/third_party/move/move-compiler-v2/tests/checking/variants/variants_constants.exp index 3dd980bb022e7..a58db1808bd05 100644 --- a/third_party/move/move-compiler-v2/tests/checking/variants/variants_constants.exp +++ b/third_party/move/move-compiler-v2/tests/checking/variants/variants_constants.exp @@ -11,29 +11,29 @@ module 0x815::m { } private fun t0(): bool { { - let c: m::Color = pack m::Color::Red(); - Eq(select_variants m::Color.RGB.red(c), 1) + let c: Color = pack m::Color::Red(); + Eq(select_variants m::Color.RGB.red(c), 1) } } private fun t1(): bool { { - let c: m::Color = pack m::Color::Red(); - Eq(select_variants m::Color.RGB.red(c), 1) + let c: Color = pack m::Color::Red(); + Eq(select_variants m::Color.RGB.red(c), 1) } } private fun t2(): bool { { - let c: m::Color = pack m::Color::Blue(); - Eq(select_variants m::Color.RGB.red(c), 1) + let c: Color = pack m::Color::Blue(); + Eq(select_variants m::Color.RGB.red(c), 1) } } private fun t3(): bool { { - let c: m::Color = pack m::Color::Blue(); - Eq(select_variants m::Color.RGB.red(c), 1) + let c: Color = pack m::Color::Blue(); + Eq(select_variants m::Color.RGB.red(c), 1) } } - private fun t4(c: &m::Color) { + private fun t4(c: &Color) { match (c) { m::Color::Red => { Abort(1) @@ -46,6 +46,41 @@ module 0x815::m { } } // end 0x815::m +// -- Sourcified model before bytecode pipeline +module 0x815::m { + enum Color { + RGB { + red: u64, + green: u64, + blue: u64, + } + Red, + Blue, + } + fun t0(): bool { + let c = Color::Red{}; + c.RGB.red == 1 + } + fun t1(): bool { + let c = Color::Red{}; + c.RGB.red == 1 + } + fun t2(): bool { + let c = Color::Blue{}; + c.RGB.red == 1 + } + fun t3(): bool { + let c = Color::Blue{}; + c.RGB.red == 1 + } + fun t4(c: &Color) { + match (c) { + Color::Red{} => abort 1, + Color::Blue{} => abort 2, + } + } +} + Diagnostics: error: match not exhaustive diff --git a/third_party/move/move-compiler-v2/tests/checking/variants/variants_ok.exp b/third_party/move/move-compiler-v2/tests/checking/variants/variants_ok.exp index 94a7918c9b8f3..3327aba9b16e9 100644 --- a/third_party/move/move-compiler-v2/tests/checking/variants/variants_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/variants/variants_ok.exp @@ -32,7 +32,7 @@ module 0x815::m { other: u32, } } - private fun t1(self: m::Color): bool { + private fun t1(self: Color): bool { match (self) { m::Color::RGB{ red, green, blue } => { Gt(Add(Add(red, green), blue), 0) @@ -46,7 +46,7 @@ module 0x815::m { } } - private fun t1_address_qualified(self: m::Color): bool { + private fun t1_address_qualified(self: Color): bool { match (self) { m::Color::RGB{ red, green, blue } => { Gt(Add(Add(red, green), blue), 0) @@ -60,7 +60,7 @@ module 0x815::m { } } - private fun t1_field_named(self: m::Color): bool { + private fun t1_field_named(self: Color): bool { match (self) { m::Color::RGB{ red: r, green: g, blue } => { Gt(Add(Add(r, g), blue), 0) @@ -74,7 +74,7 @@ module 0x815::m { } } - private fun t1_module_qualified(self: m::Color): bool { + private fun t1_module_qualified(self: Color): bool { match (self) { m::Color::RGB{ red, green, blue } => { Gt(Add(Add(red, green), blue), 0) @@ -88,7 +88,7 @@ module 0x815::m { } } - private fun t1_uses_block(self: m::Color): bool { + private fun t1_uses_block(self: Color): bool { match (self) { m::Color::RGB{ red, green, blue } => { Gt(Add(Add(red, green), blue), 0) @@ -102,7 +102,7 @@ module 0x815::m { } } - private fun t1_uses_block_no_comma(self: m::Color): bool { + private fun t1_uses_block_no_comma(self: Color): bool { match (self) { m::Color::RGB{ red, green, blue } => { Gt(Add(Add(red, green), blue), 0) @@ -116,41 +116,41 @@ module 0x815::m { } } - private fun t2(self: m::Color): bool { + private fun t2(self: Color): bool { match (self) { m::Color::RGB{ red, green, blue } => { Gt(Add(Add(red, green), blue), 0) } - _: m::Color => { + _: Color => { true } } } - private fun t3(self: m::Color): bool { + private fun t3(self: Color): bool { match (Borrow(Immutable)(self)) { m::Color::RGB{ red, green, blue } => { Gt(Add(Add(Deref(red), Deref(green)), Deref(blue)), 0) } - _: &m::Color => { + _: &Color => { true } } } - private fun t4(self: m::Color): m::Color { + private fun t4(self: Color): Color { match (Borrow(Mutable)(self)) { m::Color::RGB{ red, green: _, blue: _ } => { red = 2 } - _: &mut m::Color => { + _: &mut Color => { Tuple() } } ; self } - private fun t5_freeze(self: m::Color): u64 { + private fun t5_freeze(self: Color): u64 { { let x: u64 = 1; { @@ -161,7 +161,7 @@ module 0x815::m { m::Color::Blue => { Freeze(false)(Borrow(Mutable)(x)) } - _: &mut m::Color => { + _: &mut Color => { Freeze(false)(Borrow(Mutable)(x)) } } @@ -170,24 +170,24 @@ module 0x815::m { } } } - private fun t6_construct(self: m::Color): m::Color { + private fun t6_construct(self: Color): Color { match (self) { m::Color::RGB{ red, green, blue } => { pack m::Color::RGB(Add(red, 1), Sub(green, 1), blue) } - _: m::Color => { + _: Color => { self } } } - private fun t7_let_unpack(self: m::Color): u64 { + private fun t7_let_unpack(self: Color): u64 { { let m::Color::RGB{ red, green, blue } = self; Add(Add(red, green), blue) } } - private fun t8_unqualified_variant(self: m::Color): bool { + private fun t8_unqualified_variant(self: Color): bool { match (self) { m::Color::RGB{ red, green, blue } => { And(Neq(red, green), Neq(green, blue)) @@ -201,10 +201,139 @@ module 0x815::m { } } - private fun t9_common_field(self: m::CommonFields): u64 { - select_variants m::CommonFields.Foo.x|m::CommonFields.Bar.x(self) + private fun t9_common_field(self: CommonFields): u64 { + select_variants m::CommonFields.Foo.x|m::CommonFields.Bar.x(self) } - private fun t9_common_field_ref(self: &m::CommonFields): &u64 { - Borrow(Immutable)(select_variants m::CommonFields.Foo.x|m::CommonFields.Bar.x<&m::CommonFields>(self)) + private fun t9_common_field_ref(self: &CommonFields): &u64 { + Borrow(Immutable)(select_variants m::CommonFields.Foo.x|m::CommonFields.Bar.x<&CommonFields>(self)) } } // end 0x815::m + +// -- Sourcified model before bytecode pipeline +module 0x815::m { + use 0x815::m; + enum Color { + RGB { + red: u64, + green: u64, + blue: u64, + } + Red, + Blue, + } + enum ColorUsesBlockNoComma { + RGB { + red: u64, + green: u64, + blue: u64, + } + Red, + Blue, + } + enum CommonFields { + Foo { + x: u64, + y: u8, + } + Bar { + x: u64, + z: u32, + } + Baz { + other: u32, + } + } + fun t1(self: Color): bool { + match (self) { + Color::RGB{red: red,green: green,blue: blue} => red + green + blue > 0, + Color::Red{} => true, + Color::Blue{} => false, + } + } + fun t1_address_qualified(self: Color): bool { + match (self) { + Color::RGB{red: red,green: green,blue: blue} => red + green + blue > 0, + Color::Red{} => true, + Color::Blue{} => false, + } + } + fun t1_field_named(self: Color): bool { + match (self) { + Color::RGB{red: r,green: g,blue: blue} => r + g + blue > 0, + Color::Red{} => true, + Color::Blue{} => false, + } + } + fun t1_module_qualified(self: Color): bool { + match (self) { + Color::RGB{red: red,green: green,blue: blue} => red + green + blue > 0, + Color::Red{} => true, + Color::Blue{} => false, + } + } + fun t1_uses_block(self: Color): bool { + match (self) { + Color::RGB{red: red,green: green,blue: blue} => red + green + blue > 0, + Color::Red{} => true, + Color::Blue{} => false, + } + } + fun t1_uses_block_no_comma(self: Color): bool { + match (self) { + Color::RGB{red: red,green: green,blue: blue} => red + green + blue > 0, + Color::Red{} => true, + Color::Blue{} => false, + } + } + fun t2(self: Color): bool { + match (self) { + Color::RGB{red: red,green: green,blue: blue} => red + green + blue > 0, + _ => true, + } + } + fun t3(self: Color): bool { + match (&self) { + Color::RGB{red: red,green: green,blue: blue} => *red + *green + *blue > 0, + _ => true, + } + } + fun t4(self: Color): Color { + match (&mut self) { + Color::RGB{red: red,green: _,blue: _} => *red = 2, + _ => (), + }; + self + } + fun t5_freeze(self: Color): u64 { + let x = 1; + let r = match (&mut self) { + Color::Red{} => &x, + Color::Blue{} => /*freeze*/&mut x, + _ => /*freeze*/&mut x, + }; + *r + } + fun t6_construct(self: Color): Color { + match (self) { + Color::RGB{red: red,green: green,blue: blue} => Color::RGB{red: red + 1,green: green - 1,blue: blue}, + _ => self, + } + } + fun t7_let_unpack(self: Color): u64 { + let Color::RGB{red: red,green: green,blue: blue} = self; + red + green + blue + } + fun t8_unqualified_variant(self: Color): bool { + match (self) { + Color::RGB{red: red,green: green,blue: blue} => red != green && green != blue, + Color::Red{} => true, + Color::Blue{} => false, + } + } + fun t9_common_field(self: CommonFields): u64 { + self.Foo.x + } + fun t9_common_field_ref(self: &CommonFields): &u64 { + &self.Foo.x + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_no_parenthesis_ok.exp b/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_no_parenthesis_ok.exp index 2662bcbd649a7..97f7cc058eebf 100644 --- a/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_no_parenthesis_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_no_parenthesis_ok.exp @@ -17,19 +17,55 @@ module 0x815::m { 0: u64, } } - private fun test(c: m::Color): bool { + private fun test(c: Color): bool { test_variants m::Color::Red|RGB(c) } - private fun test_fully_qualified(c: m::Color): bool { + private fun test_fully_qualified(c: Color): bool { test_variants m::Color::Red(c) } - private fun test_generic(x: &m::Generic<#0>): bool { + private fun test_generic(x: &Generic): bool { test_variants m::Generic::Foo(x) } - private fun test_generic_qualified(x: &m::Generic<#0>): bool { + private fun test_generic_qualified(x: &Generic): bool { test_variants m::Generic::Foo(x) } - private fun test_qualified(c: m::Color): bool { + private fun test_qualified(c: Color): bool { test_variants m::Color::Red|RGB(c) } } // end 0x815::m + +// -- Sourcified model before bytecode pipeline +module 0x815::m { + enum Color { + RGB { + red: u64, + green: u64, + blue: u64, + } + Red, + Blue, + } + enum Generic { + Foo { + 0: T, + } + Bar { + 0: u64, + } + } + fun test(c: Color): bool { + c is Red | RGB + } + fun test_fully_qualified(c: Color): bool { + c is Red + } + fun test_generic(x: &Generic): bool { + x is Foo + } + fun test_generic_qualified(x: &Generic): bool { + x is Foo + } + fun test_qualified(c: Color): bool { + c is Red | RGB + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_ok.exp b/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_ok.exp index 2662bcbd649a7..97f7cc058eebf 100644 --- a/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_ok.exp @@ -17,19 +17,55 @@ module 0x815::m { 0: u64, } } - private fun test(c: m::Color): bool { + private fun test(c: Color): bool { test_variants m::Color::Red|RGB(c) } - private fun test_fully_qualified(c: m::Color): bool { + private fun test_fully_qualified(c: Color): bool { test_variants m::Color::Red(c) } - private fun test_generic(x: &m::Generic<#0>): bool { + private fun test_generic(x: &Generic): bool { test_variants m::Generic::Foo(x) } - private fun test_generic_qualified(x: &m::Generic<#0>): bool { + private fun test_generic_qualified(x: &Generic): bool { test_variants m::Generic::Foo(x) } - private fun test_qualified(c: m::Color): bool { + private fun test_qualified(c: Color): bool { test_variants m::Color::Red|RGB(c) } } // end 0x815::m + +// -- Sourcified model before bytecode pipeline +module 0x815::m { + enum Color { + RGB { + red: u64, + green: u64, + blue: u64, + } + Red, + Blue, + } + enum Generic { + Foo { + 0: T, + } + Bar { + 0: u64, + } + } + fun test(c: Color): bool { + c is Red | RGB + } + fun test_fully_qualified(c: Color): bool { + c is Red + } + fun test_generic(x: &Generic): bool { + x is Foo + } + fun test_generic_qualified(x: &Generic): bool { + x is Foo + } + fun test_qualified(c: Color): bool { + c is Red | RGB + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_parse_ok2.exp b/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_parse_ok2.exp index 0db60293cf7d3..89a8fa4425a82 100644 --- a/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_parse_ok2.exp +++ b/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_parse_ok2.exp @@ -9,7 +9,23 @@ module 0x815::m { Red, Blue, } - private fun test_red_or_rgb(c: m::Color): bool { + private fun test_red_or_rgb(c: Color): bool { test_variants m::Color::Red(c) } } // end 0x815::m + +// -- Sourcified model before bytecode pipeline +module 0x815::m { + enum Color { + RGB { + red: u64, + green: u64, + blue: u64, + } + Red, + Blue, + } + fun test_red_or_rgb(c: Color): bool { + c is Red + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/visibility-checker/direct_visibility.exp b/third_party/move/move-compiler-v2/tests/checking/visibility-checker/direct_visibility.exp index 90e9da4323862..01606d3099264 100644 --- a/third_party/move/move-compiler-v2/tests/checking/visibility-checker/direct_visibility.exp +++ b/third_party/move/move-compiler-v2/tests/checking/visibility-checker/direct_visibility.exp @@ -20,3 +20,24 @@ module 0x815::c { Tuple() } } // end 0x815::c + +// -- Sourcified model before bytecode pipeline +module 0x815::b { + friend 0x815::c; + friend fun f() { + } +} +module 0x815::a { + friend 0x815::c; + friend fun f() { + } + friend fun g() { + } +} +module 0x815::c { + public fun f() { + 0x815::a::f(); + 0x815::a::g(); + 0x815::b::f(); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/visibility-checker/module_call_visibility_friend.exp b/third_party/move/move-compiler-v2/tests/checking/visibility-checker/module_call_visibility_friend.exp index f3424d16dd504..46adaacca8b01 100644 --- a/third_party/move/move-compiler-v2/tests/checking/visibility-checker/module_call_visibility_friend.exp +++ b/third_party/move/move-compiler-v2/tests/checking/visibility-checker/module_call_visibility_friend.exp @@ -49,3 +49,51 @@ module 0x2::M { M::f_friend() } } // end 0x2::M + +// -- Sourcified model before bytecode pipeline +module 0x2::Y { + friend 0x2::M; + friend fun f_friend() { + } +} +module 0x2::X { + public fun f_public() { + } +} +module 0x2::M { + use 0x2::Y; + use 0x2::X; + friend fun f_friend() { + } + public fun f_public() { + } + friend fun f_friend_call_friend() { + Y::f_friend() + } + friend fun f_friend_call_public() { + X::f_public() + } + friend fun f_friend_call_self_friend() { + f_friend() + } + friend fun f_friend_call_self_private() { + f_private() + } + friend fun f_friend_call_self_public() { + f_public() + } + fun f_private() { + } + fun f_private_call_friend() { + Y::f_friend() + } + fun f_private_call_self_friend() { + f_friend() + } + public fun f_public_call_friend() { + Y::f_friend() + } + public fun f_public_call_self_friend() { + f_friend() + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/visibility-checker/parser_package_keyword.exp b/third_party/move/move-compiler-v2/tests/checking/visibility-checker/parser_package_keyword.exp index 89a30d8357d83..d40b04a4fe2dd 100644 --- a/third_party/move/move-compiler-v2/tests/checking/visibility-checker/parser_package_keyword.exp +++ b/third_party/move/move-compiler-v2/tests/checking/visibility-checker/parser_package_keyword.exp @@ -7,3 +7,11 @@ module 0x42::package { } } } // end 0x42::package + +// -- Sourcified model before bytecode pipeline +module 0x42::package { + friend fun package(package: u8): u8 { + let package = package + 1u8; + package + } +} diff --git a/third_party/move/move-compiler-v2/tests/control-flow-simplification/jump-label.on.exp b/third_party/move/move-compiler-v2/tests/control-flow-simplification/jump-label.on.exp index 450d583197d37..5ad35eeb9ecae 100644 --- a/third_party/move/move-compiler-v2/tests/control-flow-simplification/jump-label.on.exp +++ b/third_party/move/move-compiler-v2/tests/control-flow-simplification/jump-label.on.exp @@ -3,20 +3,20 @@ [variant baseline] fun test::test<#0>($t0: vector): #0 { var $t1: #0 - var $t2: string::String + var $t2: 0x1::string::String var $t3: bool - var $t4: string::String - var $t5: string::String + var $t4: 0x1::string::String + var $t5: 0x1::string::String var $t6: vector var $t7: bool var $t8: bool - var $t9: string::String - var $t10: string::String + var $t9: 0x1::string::String + var $t10: 0x1::string::String var $t11: vector var $t12: bool var $t13: bool - var $t14: string::String - var $t15: string::String + var $t14: 0x1::string::String + var $t15: 0x1::string::String var $t16: vector var $t17: bool var $t18: u64 @@ -75,8 +75,8 @@ fun test::baz<#0>($t0: vector): #0 { [variant baseline] -fun test::foo<#0>(): string::String { - var $t0: string::String [unused] +fun test::foo<#0>(): 0x1::string::String { + var $t0: 0x1::string::String [unused] var $t1: u64 0: $t1 := 0 1: abort($t1) diff --git a/third_party/move/move-compiler-v2/tests/copy-propagation/mut_refs_2.exp b/third_party/move/move-compiler-v2/tests/copy-propagation/mut_refs_2.exp index ef9bd20a5bed4..f5a73992e920b 100644 --- a/third_party/move/move-compiler-v2/tests/copy-propagation/mut_refs_2.exp +++ b/third_party/move/move-compiler-v2/tests/copy-propagation/mut_refs_2.exp @@ -1,30 +1,30 @@ ============ initial bytecode ================ [variant baseline] -fun m::test($t0: m::S): u64 { +fun m::test($t0: 0xc0ffee::m::S): u64 { var $t1: u64 - var $t2: m::S - var $t3: m::S + var $t2: 0xc0ffee::m::S + var $t3: 0xc0ffee::m::S var $t4: &mut u64 - var $t5: &mut m::S + var $t5: &mut 0xc0ffee::m::S var $t6: u64 - var $t7: &m::S + var $t7: &0xc0ffee::m::S var $t8: &u64 0: $t2 := infer($t0) 1: $t3 := infer($t2) 2: $t5 := borrow_local($t2) - 3: $t4 := borrow_field.a($t5) + 3: $t4 := borrow_field<0xc0ffee::m::S>.a($t5) 4: $t6 := 0 5: write_ref($t4, $t6) 6: $t7 := borrow_local($t3) - 7: $t8 := borrow_field.a($t7) + 7: $t8 := borrow_field<0xc0ffee::m::S>.a($t7) 8: $t1 := read_ref($t8) 9: return $t1 } Diagnostics: -error: local `p` of type `m::S` does not have the `copy` ability +error: local `p` of type `S` does not have the `copy` ability ┌─ tests/copy-propagation/mut_refs_2.move:10:17 │ 10 │ let q = p; @@ -32,13 +32,13 @@ error: local `p` of type `m::S` does not have the `copy` ability 11 │ let ref = &mut p.a; │ - used here -error: local `p` of type `m::S` does not have the `drop` ability +error: local `p` of type `S` does not have the `drop` ability ┌─ tests/copy-propagation/mut_refs_2.move:11:24 │ 11 │ let ref = &mut p.a; │ ^ still borrowed but will be implicitly dropped later since it is no longer used -error: local `q` of type `m::S` does not have the `drop` ability +error: local `q` of type `S` does not have the `drop` ability ┌─ tests/copy-propagation/mut_refs_2.move:13:9 │ 13 │ q.a diff --git a/third_party/move/move-compiler-v2/tests/copy-propagation/sequential_assign_struct.exp b/third_party/move/move-compiler-v2/tests/copy-propagation/sequential_assign_struct.exp index 4497f58bc7399..0b75ab964eac4 100644 --- a/third_party/move/move-compiler-v2/tests/copy-propagation/sequential_assign_struct.exp +++ b/third_party/move/move-compiler-v2/tests/copy-propagation/sequential_assign_struct.exp @@ -1,13 +1,13 @@ ============ initial bytecode ================ [variant baseline] -fun m::sequential($t0: m::Foo): m::Foo { - var $t1: m::Foo - var $t2: m::Foo - var $t3: m::Foo - var $t4: m::Foo - var $t5: m::Foo - var $t6: m::Foo +fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { + var $t1: 0xc0ffee::m::Foo + var $t2: 0xc0ffee::m::Foo + var $t3: 0xc0ffee::m::Foo + var $t4: 0xc0ffee::m::Foo + var $t5: 0xc0ffee::m::Foo + var $t6: 0xc0ffee::m::Foo 0: $t2 := infer($t0) 1: $t3 := infer($t2) 2: $t4 := infer($t3) @@ -20,13 +20,13 @@ fun m::sequential($t0: m::Foo): m::Foo { ============ after DeadStoreElimination: ================ [variant baseline] -fun m::sequential($t0: m::Foo): m::Foo { - var $t1: m::Foo - var $t2: m::Foo - var $t3: m::Foo - var $t4: m::Foo - var $t5: m::Foo - var $t6: m::Foo +fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { + var $t1: 0xc0ffee::m::Foo + var $t2: 0xc0ffee::m::Foo + var $t3: 0xc0ffee::m::Foo + var $t4: 0xc0ffee::m::Foo + var $t5: 0xc0ffee::m::Foo + var $t6: 0xc0ffee::m::Foo 0: $t2 := move($t0) 1: $t3 := move($t2) 2: $t4 := move($t3) diff --git a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/recursive_type_instantiation.exp b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/recursive_type_instantiation.exp index 2982749beb36a..fc66bb2fb5ef9 100644 --- a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/recursive_type_instantiation.exp +++ b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/recursive_type_instantiation.exp @@ -6,7 +6,7 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr 6 │ public fun simple_recursion() { │ ^^^^^^^^^^^^^^^^ │ - = `simple_recursion` calls `simple_recursion>` at tests/cyclic-instantiation-checker/recursive_type_instantiation.move:7 + = `simple_recursion` calls `simple_recursion>` at tests/cyclic-instantiation-checker/recursive_type_instantiation.move:7 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/recursive_type_instantiation.move:10:9 @@ -15,7 +15,7 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr │ ^^^^^^^^^^^^^^^^^^^^^ │ = `two_level_recursion_0` calls `two_level_recursion_1` at tests/cyclic-instantiation-checker/recursive_type_instantiation.move:11 - = `two_level_recursion_1` calls `two_level_recursion_0>` at tests/cyclic-instantiation-checker/recursive_type_instantiation.move:15 + = `two_level_recursion_1` calls `two_level_recursion_0>` at tests/cyclic-instantiation-checker/recursive_type_instantiation.move:15 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/recursive_type_instantiation.move:14:9 @@ -23,8 +23,8 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr 14 │ fun two_level_recursion_1() { │ ^^^^^^^^^^^^^^^^^^^^^ │ - = `two_level_recursion_1` calls `two_level_recursion_0>` at tests/cyclic-instantiation-checker/recursive_type_instantiation.move:15 - = `two_level_recursion_0>` calls `two_level_recursion_1>` at tests/cyclic-instantiation-checker/recursive_type_instantiation.move:11 + = `two_level_recursion_1` calls `two_level_recursion_0>` at tests/cyclic-instantiation-checker/recursive_type_instantiation.move:15 + = `two_level_recursion_0>` calls `two_level_recursion_1>` at tests/cyclic-instantiation-checker/recursive_type_instantiation.move:11 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/recursive_type_instantiation.move:18:9 @@ -34,7 +34,7 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr │ = `three_level_recursion_0` calls `three_level_recursion_1` at tests/cyclic-instantiation-checker/recursive_type_instantiation.move:19 = `three_level_recursion_1` calls `three_level_recursion_2` at tests/cyclic-instantiation-checker/recursive_type_instantiation.move:23 - = `three_level_recursion_2` calls `three_level_recursion_0>` at tests/cyclic-instantiation-checker/recursive_type_instantiation.move:27 + = `three_level_recursion_2` calls `three_level_recursion_0>` at tests/cyclic-instantiation-checker/recursive_type_instantiation.move:27 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/recursive_type_instantiation.move:22:9 @@ -43,8 +43,8 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr │ ^^^^^^^^^^^^^^^^^^^^^^^ │ = `three_level_recursion_1` calls `three_level_recursion_2` at tests/cyclic-instantiation-checker/recursive_type_instantiation.move:23 - = `three_level_recursion_2` calls `three_level_recursion_0>` at tests/cyclic-instantiation-checker/recursive_type_instantiation.move:27 - = `three_level_recursion_0>` calls `three_level_recursion_1>` at tests/cyclic-instantiation-checker/recursive_type_instantiation.move:19 + = `three_level_recursion_2` calls `three_level_recursion_0>` at tests/cyclic-instantiation-checker/recursive_type_instantiation.move:27 + = `three_level_recursion_0>` calls `three_level_recursion_1>` at tests/cyclic-instantiation-checker/recursive_type_instantiation.move:19 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/recursive_type_instantiation.move:26:9 @@ -52,9 +52,9 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr 26 │ fun three_level_recursion_2() { │ ^^^^^^^^^^^^^^^^^^^^^^^ │ - = `three_level_recursion_2` calls `three_level_recursion_0>` at tests/cyclic-instantiation-checker/recursive_type_instantiation.move:27 - = `three_level_recursion_0>` calls `three_level_recursion_1>` at tests/cyclic-instantiation-checker/recursive_type_instantiation.move:19 - = `three_level_recursion_1>` calls `three_level_recursion_2>` at tests/cyclic-instantiation-checker/recursive_type_instantiation.move:23 + = `three_level_recursion_2` calls `three_level_recursion_0>` at tests/cyclic-instantiation-checker/recursive_type_instantiation.move:27 + = `three_level_recursion_0>` calls `three_level_recursion_1>` at tests/cyclic-instantiation-checker/recursive_type_instantiation.move:19 + = `three_level_recursion_1>` calls `three_level_recursion_2>` at tests/cyclic-instantiation-checker/recursive_type_instantiation.move:23 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/recursive_type_instantiation.move:30:9 @@ -62,7 +62,7 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr 30 │ fun recurse_at_different_position() { │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ │ - = `recurse_at_different_position` calls `recurse_at_different_position>` at tests/cyclic-instantiation-checker/recursive_type_instantiation.move:31 + = `recurse_at_different_position` calls `recurse_at_different_position>` at tests/cyclic-instantiation-checker/recursive_type_instantiation.move:31 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/recursive_type_instantiation.move:44:9 diff --git a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/complex_1.exp b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/complex_1.exp index 8ada1df6f41e8..1bb77ca0c249f 100644 --- a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/complex_1.exp +++ b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/complex_1.exp @@ -8,7 +8,7 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr │ = `c` calls `d` at tests/cyclic-instantiation-checker/v1-tests/complex_1.move:15 = `d` calls `b` at tests/cyclic-instantiation-checker/v1-tests/complex_1.move:20 - = `b` calls `c, bool>` at tests/cyclic-instantiation-checker/v1-tests/complex_1.move:10 + = `b` calls `c, bool>` at tests/cyclic-instantiation-checker/v1-tests/complex_1.move:10 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/v1-tests/complex_1.move:26:9 @@ -17,7 +17,7 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr │ ^ │ = `f` calls `g` at tests/cyclic-instantiation-checker/v1-tests/complex_1.move:27 - = `g` calls `f>` at tests/cyclic-instantiation-checker/v1-tests/complex_1.move:31 + = `g` calls `f>` at tests/cyclic-instantiation-checker/v1-tests/complex_1.move:31 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/v1-tests/complex_1.move:30:9 @@ -25,5 +25,5 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr 30 │ fun g() { │ ^ │ - = `g` calls `f>` at tests/cyclic-instantiation-checker/v1-tests/complex_1.move:31 - = `f>` calls `g>` at tests/cyclic-instantiation-checker/v1-tests/complex_1.move:27 + = `g` calls `f>` at tests/cyclic-instantiation-checker/v1-tests/complex_1.move:31 + = `f>` calls `g>` at tests/cyclic-instantiation-checker/v1-tests/complex_1.move:27 diff --git a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_just_type_params_ok.exp b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_just_type_params_ok.exp index 96b0d3038b3ec..331fad3cf4272 100644 --- a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_just_type_params_ok.exp +++ b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_just_type_params_ok.exp @@ -7,3 +7,13 @@ module 0x8675309::M { M::f() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + fun f() { + g() + } + fun g() { + f() + } +} diff --git a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_non_generic_type_ok.exp b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_non_generic_type_ok.exp index 079ed8439d493..ee9f393b3f473 100644 --- a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_non_generic_type_ok.exp +++ b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_non_generic_type_ok.exp @@ -4,9 +4,22 @@ module 0x8675309::M { f: #0, } private fun f() { - M::g>() + M::g>() } private fun g() { M::f() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct S { + f: T, + } + fun f() { + g>() + } + fun g() { + f() + } +} diff --git a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_just_type_params_shitfing_ok.exp b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_just_type_params_shitfing_ok.exp index f6b05b6205cce..d8a3df9022b92 100644 --- a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_just_type_params_shitfing_ok.exp +++ b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_just_type_params_shitfing_ok.exp @@ -10,3 +10,16 @@ module 0x8675309::M { M::f() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + fun f() { + g() + } + fun g() { + h() + } + fun h() { + f() + } +} diff --git a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_non_generic_types_ok.exp b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_non_generic_types_ok.exp index 970a22f456bec..a4cbf1c179a07 100644 --- a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_non_generic_types_ok.exp +++ b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_non_generic_types_ok.exp @@ -7,8 +7,8 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr │ ^ │ = `f` calls `g` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_non_generic_types_ok.move:5 - = `g` calls `h>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_non_generic_types_ok.move:9 - = `h>` calls `f>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_non_generic_types_ok.move:14 + = `g` calls `h>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_non_generic_types_ok.move:9 + = `h>` calls `f>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_non_generic_types_ok.move:14 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_non_generic_types_ok.move:8:9 @@ -16,9 +16,9 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr 8 │ fun g() { │ ^ │ - = `g` calls `h>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_non_generic_types_ok.move:9 - = `h>` calls `f>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_non_generic_types_ok.move:14 - = `f>` calls `g, T1>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_non_generic_types_ok.move:5 + = `g` calls `h>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_non_generic_types_ok.move:9 + = `h>` calls `f>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_non_generic_types_ok.move:14 + = `f>` calls `g, T1>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_non_generic_types_ok.move:5 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_non_generic_types_ok.move:12:9 @@ -28,4 +28,4 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr │ = `h` calls `f` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_non_generic_types_ok.move:14 = `f` calls `g` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_non_generic_types_ok.move:5 - = `g` calls `h>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_non_generic_types_ok.move:9 + = `g` calls `h>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_non_generic_types_ok.move:9 diff --git a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_shifting.exp b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_shifting.exp index 4a656d29b6bec..db55cc263c7ba 100644 --- a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_shifting.exp +++ b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_shifting.exp @@ -7,8 +7,8 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr │ ^ │ = `f` calls `g` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_shifting.move:5 - = `g` calls `h>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_shifting.move:9 - = `h>` calls `f>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_shifting.move:13 + = `g` calls `h>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_shifting.move:9 + = `h>` calls `f>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_shifting.move:13 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_shifting.move:8:9 @@ -16,9 +16,9 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr 8 │ fun g() { │ ^ │ - = `g` calls `h>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_shifting.move:9 - = `h>` calls `f>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_shifting.move:13 - = `f>` calls `g, T1>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_shifting.move:5 + = `g` calls `h>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_shifting.move:9 + = `h>` calls `f>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_shifting.move:13 + = `f>` calls `g, T1>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_shifting.move:5 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_shifting.move:12:9 @@ -28,4 +28,4 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr │ = `h` calls `f` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_shifting.move:13 = `f` calls `g` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_shifting.move:5 - = `g` calls `h>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_shifting.move:9 + = `g` calls `h>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_three_args_type_con_shifting.move:9 diff --git a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_two_args_non_generic_type_and_type_param_ok.exp b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_two_args_non_generic_type_and_type_param_ok.exp index 2d82b3c7326e7..8fd13c702bc93 100644 --- a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_two_args_non_generic_type_and_type_param_ok.exp +++ b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_two_args_non_generic_type_and_type_param_ok.exp @@ -7,3 +7,13 @@ module 0x8675309::M { M::f() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + fun f() { + g() + } + fun g() { + f() + } +} diff --git a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_two_args_swapping_just_type_params_ok.exp b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_two_args_swapping_just_type_params_ok.exp index 3033747e7d84a..0f757f0c9298b 100644 --- a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_two_args_swapping_just_type_params_ok.exp +++ b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_two_args_swapping_just_type_params_ok.exp @@ -9,3 +9,13 @@ module 0x8675309::M { Tuple() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + fun f() { + g(); + } + fun g() { + f(); + } +} diff --git a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_two_args_swapping_type_con.exp b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_two_args_swapping_type_con.exp index 106f433858593..1066db9abfad9 100644 --- a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_two_args_swapping_type_con.exp +++ b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_two_args_swapping_type_con.exp @@ -7,7 +7,7 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr │ ^ │ = `f` calls `g` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_two_args_swapping_type_con.move:5 - = `g` calls `f, u64>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_two_args_swapping_type_con.move:9 + = `g` calls `f, u64>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_two_args_swapping_type_con.move:9 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_two_args_swapping_type_con.move:8:9 @@ -15,5 +15,5 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr 8 │ fun g() { │ ^ │ - = `g` calls `f, u64>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_two_args_swapping_type_con.move:9 - = `f, u64>` calls `g, T1>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_two_args_swapping_type_con.move:5 + = `g` calls `f, u64>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_two_args_swapping_type_con.move:9 + = `f, u64>` calls `g, T1>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_two_args_swapping_type_con.move:5 diff --git a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_type_con.exp b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_type_con.exp index 78f036b15c4b4..13dda3ae7a1ba 100644 --- a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_type_con.exp +++ b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_type_con.exp @@ -6,8 +6,8 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr 7 │ fun f() { │ ^ │ - = `f` calls `g>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_type_con.move:8 - = `g>` calls `f>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_type_con.move:12 + = `f` calls `g>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_type_con.move:8 + = `g>` calls `f>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_type_con.move:12 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_type_con.move:11:9 @@ -16,4 +16,4 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr │ ^ │ = `g` calls `f` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_type_con.move:12 - = `f` calls `g>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_type_con.move:8 + = `f` calls `g>` at tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_type_con.move:8 diff --git a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/nested_types_1.exp b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/nested_types_1.exp index d1798cea03482..4c7b9af8fd5e8 100644 --- a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/nested_types_1.exp +++ b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/nested_types_1.exp @@ -6,4 +6,4 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr 4 │ fun foo() { │ ^^^ │ - = `foo` calls `foo>>` at tests/cyclic-instantiation-checker/v1-tests/nested_types_1.move:5 + = `foo` calls `foo>>` at tests/cyclic-instantiation-checker/v1-tests/nested_types_1.move:5 diff --git a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/nested_types_2.exp b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/nested_types_2.exp index 53a1b6a0bfa1f..4b510f95aa137 100644 --- a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/nested_types_2.exp +++ b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/nested_types_2.exp @@ -6,4 +6,4 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr 5 │ fun foo() { │ ^^^ │ - = `foo` calls `foo>>>` at tests/cyclic-instantiation-checker/v1-tests/nested_types_2.move:6 + = `foo` calls `foo>>>` at tests/cyclic-instantiation-checker/v1-tests/nested_types_2.move:6 diff --git a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/recursive_infinite_type_terminates.exp b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/recursive_infinite_type_terminates.exp index 7fc325aa27a60..aa91ac66ecc19 100644 --- a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/recursive_infinite_type_terminates.exp +++ b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/recursive_infinite_type_terminates.exp @@ -6,4 +6,4 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr 9 │ fun f(n: u64, x: T): T { │ ^ │ - = `f` calls `f>` at tests/cyclic-instantiation-checker/v1-tests/recursive_infinite_type_terminates.move:11 + = `f` calls `f>` at tests/cyclic-instantiation-checker/v1-tests/recursive_infinite_type_terminates.move:11 diff --git a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/recursive_one_arg_just_type_params_ok.exp b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/recursive_one_arg_just_type_params_ok.exp index 3e04246fb2bb0..d5e393f16eb61 100644 --- a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/recursive_one_arg_just_type_params_ok.exp +++ b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/recursive_one_arg_just_type_params_ok.exp @@ -1,6 +1,13 @@ // -- Model dump before bytecode pipeline module 0x8675309::M { - public fun f(x: #0) { + public fun f(x: T) { M::f(x) } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + public fun f(x: T) { + f(x) + } +} diff --git a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/recursive_one_arg_non_generic_type_ok.exp b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/recursive_one_arg_non_generic_type_ok.exp index f0921c5777493..cc5ac27ef18fa 100644 --- a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/recursive_one_arg_non_generic_type_ok.exp +++ b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/recursive_one_arg_non_generic_type_ok.exp @@ -4,3 +4,10 @@ module 0x8675309::M { M::f() } } // end 0x8675309::M + +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + fun f() { + f() + } +} diff --git a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/recursive_one_arg_type_con.exp b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/recursive_one_arg_type_con.exp index 189a74b48d385..e9041a1b05430 100644 --- a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/recursive_one_arg_type_con.exp +++ b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/recursive_one_arg_type_con.exp @@ -6,4 +6,4 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr 6 │ fun f(x: T) { │ ^ │ - = `f` calls `f>` at tests/cyclic-instantiation-checker/v1-tests/recursive_one_arg_type_con.move:7 + = `f` calls `f>` at tests/cyclic-instantiation-checker/v1-tests/recursive_one_arg_type_con.move:7 diff --git a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/recursive_two_args_swapping_type_con.exp b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/recursive_two_args_swapping_type_con.exp index e652867004204..4892af9de9b66 100644 --- a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/recursive_two_args_swapping_type_con.exp +++ b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/recursive_two_args_swapping_type_con.exp @@ -6,4 +6,4 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr 7 │ fun f(a: T1, x: T2) { │ ^ │ - = `f` calls `f, T1>` at tests/cyclic-instantiation-checker/v1-tests/recursive_two_args_swapping_type_con.move:8 + = `f` calls `f, T1>` at tests/cyclic-instantiation-checker/v1-tests/recursive_two_args_swapping_type_con.move:8 diff --git a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/two_loops.exp b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/two_loops.exp index 37fe8076ba422..ca960a47c8c83 100644 --- a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/two_loops.exp +++ b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/two_loops.exp @@ -6,7 +6,7 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr 7 │ fun f() { │ ^ │ - = `f` calls `f>` at tests/cyclic-instantiation-checker/v1-tests/two_loops.move:8 + = `f` calls `f>` at tests/cyclic-instantiation-checker/v1-tests/two_loops.move:8 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/v1-tests/two_loops.move:11:9 @@ -14,4 +14,4 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr 11 │ fun g() { │ ^ │ - = `g` calls `g>` at tests/cyclic-instantiation-checker/v1-tests/two_loops.move:12 + = `g` calls `g>` at tests/cyclic-instantiation-checker/v1-tests/two_loops.move:12 diff --git a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.exp b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.exp index 69f2b94f77c68..b5a0ebd9a7cd4 100644 --- a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.exp @@ -6,7 +6,7 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr 6 │ public fun t() { │ ^ │ - = `t` calls `t>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:7 + = `t` calls `t>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:7 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:10:16 @@ -14,8 +14,8 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr 10 │ public fun x() { │ ^ │ - = `x` calls `y>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:11 - = `y>` calls `x>>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:14 + = `x` calls `y>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:11 + = `y>` calls `x>>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:14 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:13:16 @@ -23,8 +23,8 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr 13 │ public fun y() { │ ^ │ - = `y` calls `x>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:14 - = `x>` calls `y>>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:11 + = `y` calls `x>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:14 + = `x>` calls `y>>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:11 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:17:16 @@ -34,7 +34,7 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr │ = `a` calls `b` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:18 = `b` calls `c` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:21 - = `c` calls `a>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:24 + = `c` calls `a>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:24 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:20:16 @@ -43,8 +43,8 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr │ ^ │ = `b` calls `c` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:21 - = `c` calls `a>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:24 - = `a>` calls `b>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:18 + = `c` calls `a>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:24 + = `a>` calls `b>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:18 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:23:16 @@ -52,9 +52,9 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr 23 │ public fun c() { │ ^ │ - = `c` calls `a>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:24 - = `a>` calls `b>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:18 - = `b>` calls `c>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:21 + = `c` calls `a>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:24 + = `a>` calls `b>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:18 + = `b>` calls `c>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:21 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:37:16 @@ -62,7 +62,7 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr 37 │ public fun z() { │ ^ │ - = `z` calls `z>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:38 + = `z` calls `z>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:38 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:41:16 @@ -72,8 +72,8 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr │ = `a` calls `b` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:42 = `b` calls `c` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:45 - = `c` calls `d>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:48 - = `d>` calls `a>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:51 + = `c` calls `d>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:48 + = `d>` calls `a>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:51 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:44:16 @@ -82,9 +82,9 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr │ ^ │ = `b` calls `c` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:45 - = `c` calls `d>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:48 - = `d>` calls `a>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:51 - = `a>` calls `b>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:42 + = `c` calls `d>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:48 + = `d>` calls `a>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:51 + = `a>` calls `b>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:42 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:47:16 @@ -92,10 +92,10 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr 47 │ public fun c() { │ ^ │ - = `c` calls `d>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:48 - = `d>` calls `a>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:51 - = `a>` calls `b>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:42 - = `b>` calls `c>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:45 + = `c` calls `d>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:48 + = `d>` calls `a>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:51 + = `a>` calls `b>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:42 + = `b>` calls `c>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:45 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:50:16 @@ -106,7 +106,7 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr = `d` calls `a` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:51 = `a` calls `b` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:42 = `b` calls `c` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:45 - = `c` calls `d>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:48 + = `c` calls `d>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:48 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:58:16 @@ -115,8 +115,8 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr │ ^^ │ = `tl` calls `tr` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:59 - = `tr` calls `bl>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:62 - = `bl>` calls `tl>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:69 + = `tr` calls `bl>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:62 + = `bl>` calls `tl>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:69 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:61:16 @@ -124,9 +124,9 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr 61 │ public fun tr() { │ ^^ │ - = `tr` calls `bl>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:62 - = `bl>` calls `tl>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:69 - = `tl>` calls `tr>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:59 + = `tr` calls `bl>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:62 + = `bl>` calls `tl>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:69 + = `tl>` calls `tr>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:59 error: cyclic type instantiation: a cycle of recursive calls causes a type to grow without bound ┌─ tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:68:16 @@ -136,4 +136,4 @@ error: cyclic type instantiation: a cycle of recursive calls causes a type to gr │ = `bl` calls `tl` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:69 = `tl` calls `tr` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:59 - = `tr` calls `bl>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:62 + = `tr` calls `bl>` at tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.move:62 diff --git a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_valid.exp b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_valid.exp index 01e7a4ee24a6a..d986f83593d1a 100644 --- a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_valid.exp +++ b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_valid.exp @@ -12,10 +12,10 @@ module 0x42::M { M::t1() } public fun x() { - M::y>() + M::y>() } public fun y() { - M::z>() + M::z>() } public fun z() { M::z() @@ -27,3 +27,33 @@ module 0x42::N { M::t0>() } } // end 0x42::N + +// -- Sourcified model before bytecode pipeline +module 0x42::M { + struct Box { + f: T, + } + public fun t0() { + t1(); + t0() + } + public fun t1() { + t0(); + t1() + } + public fun x() { + y>() + } + public fun y() { + z>() + } + public fun z() { + z() + } +} +module 0x42::N { + use 0x42::M; + public fun t() { + M::t0>() + } +} diff --git a/third_party/move/move-compiler-v2/tests/folding/constant_folding_addresses.exp b/third_party/move/move-compiler-v2/tests/folding/constant_folding_addresses.exp index 42c1f4eb0702c..1fdc7289870ba 100644 --- a/third_party/move/move-compiler-v2/tests/folding/constant_folding_addresses.exp +++ b/third_party/move/move-compiler-v2/tests/folding/constant_folding_addresses.exp @@ -8,5 +8,15 @@ module 0x8675309::M { } } // end 0x8675309::M +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + fun const_addr(): address { + 0x1234 + } + fun const_addr_let(): address { + 0x1234 + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/folding/constant_values.exp b/third_party/move/move-compiler-v2/tests/folding/constant_values.exp index 5ff1d119edddf..9a90765e9018a 100644 --- a/third_party/move/move-compiler-v2/tests/folding/constant_values.exp +++ b/third_party/move/move-compiler-v2/tests/folding/constant_values.exp @@ -20,5 +20,27 @@ module 0x8675309::M { } } // end 0x8675309::M +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + fun int128(): u128 { + 4u128 + } + fun int16(): u16 { + 123u16 + } + fun int256(): u256 { + 4u256 + } + fun int32(): u32 { + 137u32 + } + fun int64(): u64 { + 5 + } + fun int8(): u8 { + 1u8 + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/folding/empty_tvectors.exp b/third_party/move/move-compiler-v2/tests/folding/empty_tvectors.exp index 66bf0e6e4f6ad..51166063aa526 100644 --- a/third_party/move/move-compiler-v2/tests/folding/empty_tvectors.exp +++ b/third_party/move/move-compiler-v2/tests/folding/empty_tvectors.exp @@ -5,8 +5,8 @@ module 0x42::m { use std::vector; public entry fun init() { { - let _: vector = { - let result: vector = Vector(); + let _: vector<0x1::string::String> = { + let result: vector<0x1::string::String> = Vector<0x1::string::String>(); { let (v: vector>): (vector>) = Tuple([]); vector::reverse>(Borrow(Mutable)(v)); @@ -16,7 +16,7 @@ module 0x42::m { let e: vector = vector::pop_back>(Borrow(Mutable)(v)); { let (elem: vector): (vector) = Tuple(e); - vector::push_back(Borrow(Mutable)(result), { + vector::push_back<0x1::string::String>(Borrow(Mutable)(result), { let (key: vector): (vector) = Tuple(elem); string::utf8(key) }) @@ -64,5 +64,47 @@ module 0x42::m { } } // end 0x42::m +// -- Sourcified model before bytecode pipeline +module 0x42::m { + public entry fun init() { + let _ = { + let result = vector[]; + { + let (v) = (vector[]); + 0x1::vector::reverse>(&mut v); + while (!0x1::vector::is_empty>(&v)) { + let e = 0x1::vector::pop_back>(&mut v); + { + let (elem) = (e); + 0x1::vector::push_back<0x1::string::String>(&mut result, { + let (key) = (elem); + 0x1::string::utf8(key) + }) + }; + }; + }; + result + }; + let _ = { + let result = vector[]; + { + let (v) = (vector[]); + 0x1::vector::reverse(&mut v); + while (!0x1::vector::is_empty(&v)) { + let e = 0x1::vector::pop_back(&mut v); + { + let (elem) = (e); + 0x1::vector::push_back>(&mut result, { + let (v) = (elem); + 0x1::bcs::to_bytes(&v) + }) + }; + }; + }; + result + }; + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/folding/empty_vectors.exp b/third_party/move/move-compiler-v2/tests/folding/empty_vectors.exp index 2f4734fb55c28..3402cc93608e2 100644 --- a/third_party/move/move-compiler-v2/tests/folding/empty_vectors.exp +++ b/third_party/move/move-compiler-v2/tests/folding/empty_vectors.exp @@ -65,5 +65,48 @@ module 0x42::m { } } // end 0x42::m +// -- Sourcified model before bytecode pipeline +module 0x42::m { + public entry fun init() { + let _x = { + let result = vector[]; + { + let (v) = (vector[]); + 0x1::vector::reverse>(&mut v); + while (!0x1::vector::is_empty>(&v)) { + let e = 0x1::vector::pop_back>(&mut v); + { + let (elem) = (e); + 0x1::vector::push_back(&mut result, { + let (key) = (elem); + let t = key; + 0x1::vector::length(&t) + 2 + }) + }; + }; + }; + result + }; + let _y = { + let result = vector[]; + { + let (v) = (vector[]); + 0x1::vector::reverse(&mut v); + while (!0x1::vector::is_empty(&v)) { + let e = 0x1::vector::pop_back(&mut v); + { + let (elem) = (e); + 0x1::vector::push_back(&mut result, { + let (v) = (elem); + v + 3 + }) + }; + }; + }; + result + }; + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/folding/empty_vectors2.exp b/third_party/move/move-compiler-v2/tests/folding/empty_vectors2.exp index ba0862f8e2ead..6c622215906da 100644 --- a/third_party/move/move-compiler-v2/tests/folding/empty_vectors2.exp +++ b/third_party/move/move-compiler-v2/tests/folding/empty_vectors2.exp @@ -71,5 +71,50 @@ module 0x42::m { } } // end 0x42::m +// -- Sourcified model before bytecode pipeline +module 0x42::m { + public entry fun init() { + let _x = { + let (v) = (*0x1::vector::borrow>>(&vector[vector[]], 0)); + let result = vector[]; + { + let (v) = (v); + 0x1::vector::reverse>(&mut v); + while (!0x1::vector::is_empty>(&v)) { + let e = 0x1::vector::pop_back>(&mut v); + { + let (elem) = (e); + 0x1::vector::push_back(&mut result, { + let (key) = (elem); + let t = key; + 0x1::vector::length(&t) + 2 + }) + }; + }; + }; + result + }; + let _y = { + let (v) = (*0x1::vector::borrow>(&vector[vector[]], 0)); + let result = vector[]; + { + let (v) = (v); + 0x1::vector::reverse(&mut v); + while (!0x1::vector::is_empty(&v)) { + let e = 0x1::vector::pop_back(&mut v); + { + let (elem) = (e); + 0x1::vector::push_back(&mut result, { + let (v) = (elem); + v + 3 + }) + }; + }; + }; + result + }; + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/folding/non_constant_empty_vec.exp b/third_party/move/move-compiler-v2/tests/folding/non_constant_empty_vec.exp index 2a78724f1fe13..339a8bdf36d94 100644 --- a/third_party/move/move-compiler-v2/tests/folding/non_constant_empty_vec.exp +++ b/third_party/move/move-compiler-v2/tests/folding/non_constant_empty_vec.exp @@ -3,10 +3,10 @@ module 0x42::M { struct S { dummy_field: bool, } - public fun empty_generic_vec(): vector<#0> { + public fun empty_generic_vec(): vector { Vector() } - public fun empty_generic_vec_vec(): vector> { + public fun empty_generic_vec_vec(): vector> { Vector>() } public fun empty_signer_vec(): vector { @@ -15,13 +15,37 @@ module 0x42::M { public fun empty_signer_vec_vec(): vector> { Vector>() } - public fun empty_struct_vec(): vector { - Vector() + public fun empty_struct_vec(): vector { + Vector() } - public fun empty_struct_vec_vec(): vector> { - Vector>() + public fun empty_struct_vec_vec(): vector> { + Vector>() } } // end 0x42::M +// -- Sourcified model before bytecode pipeline +module 0x42::M { + struct S { + } + public fun empty_generic_vec(): vector { + vector[] + } + public fun empty_generic_vec_vec(): vector> { + vector[] + } + public fun empty_signer_vec(): vector { + vector[] + } + public fun empty_signer_vec_vec(): vector> { + vector[] + } + public fun empty_struct_vec(): vector { + vector[] + } + public fun empty_struct_vec_vec(): vector> { + vector[] + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/folding/nonempty_tvectors.exp b/third_party/move/move-compiler-v2/tests/folding/nonempty_tvectors.exp index 7bf7030c145e4..f8822d3a0a187 100644 --- a/third_party/move/move-compiler-v2/tests/folding/nonempty_tvectors.exp +++ b/third_party/move/move-compiler-v2/tests/folding/nonempty_tvectors.exp @@ -5,8 +5,8 @@ module 0x42::m { use std::vector; public entry fun init() { { - let _: vector = { - let result: vector = Vector(); + let _: vector<0x1::string::String> = { + let result: vector<0x1::string::String> = Vector<0x1::string::String>(); { let (v: vector>): (vector>) = Tuple([Vector([Number(3)])]); vector::reverse>(Borrow(Mutable)(v)); @@ -16,7 +16,7 @@ module 0x42::m { let e: vector = vector::pop_back>(Borrow(Mutable)(v)); { let (elem: vector): (vector) = Tuple(e); - vector::push_back(Borrow(Mutable)(result), { + vector::push_back<0x1::string::String>(Borrow(Mutable)(result), { let (key: vector): (vector) = Tuple(elem); string::utf8(key) }) @@ -64,5 +64,47 @@ module 0x42::m { } } // end 0x42::m +// -- Sourcified model before bytecode pipeline +module 0x42::m { + public entry fun init() { + let _ = { + let result = vector[]; + { + let (v) = (vector[vector[3u8]]); + 0x1::vector::reverse>(&mut v); + while (!0x1::vector::is_empty>(&v)) { + let e = 0x1::vector::pop_back>(&mut v); + { + let (elem) = (e); + 0x1::vector::push_back<0x1::string::String>(&mut result, { + let (key) = (elem); + 0x1::string::utf8(key) + }) + }; + }; + }; + result + }; + let _ = { + let result = vector[]; + { + let (v) = (vector[3]); + 0x1::vector::reverse(&mut v); + while (!0x1::vector::is_empty(&v)) { + let e = 0x1::vector::pop_back(&mut v); + { + let (elem) = (e); + 0x1::vector::push_back>(&mut result, { + let (v) = (elem); + 0x1::bcs::to_bytes(&v) + }) + }; + }; + }; + result + }; + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/folding/nonempty_vectors.exp b/third_party/move/move-compiler-v2/tests/folding/nonempty_vectors.exp index 396a5f522928b..9c4bc6ee25968 100644 --- a/third_party/move/move-compiler-v2/tests/folding/nonempty_vectors.exp +++ b/third_party/move/move-compiler-v2/tests/folding/nonempty_vectors.exp @@ -65,5 +65,48 @@ module 0x42::m { } } // end 0x42::m +// -- Sourcified model before bytecode pipeline +module 0x42::m { + public entry fun init() { + let _x = { + let result = vector[]; + { + let (v) = (vector[vector[1u8]]); + 0x1::vector::reverse>(&mut v); + while (!0x1::vector::is_empty>(&v)) { + let e = 0x1::vector::pop_back>(&mut v); + { + let (elem) = (e); + 0x1::vector::push_back(&mut result, { + let (key) = (elem); + let t = key; + 0x1::vector::length(&t) + 2 + }) + }; + }; + }; + result + }; + let _y = { + let result = vector[]; + { + let (v) = (vector[3]); + 0x1::vector::reverse(&mut v); + while (!0x1::vector::is_empty(&v)) { + let e = 0x1::vector::pop_back(&mut v); + { + let (elem) = (e); + 0x1::vector::push_back(&mut result, { + let (v) = (elem); + v + 3 + }) + }; + }; + }; + result + }; + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/lambda-lifting/pattern.exp b/third_party/move/move-compiler-v2/tests/lambda-lifting/pattern.exp index c61dde92a484d..0b9d7af753a8c 100644 --- a/third_party/move/move-compiler-v2/tests/lambda-lifting/pattern.exp +++ b/third_party/move/move-compiler-v2/tests/lambda-lifting/pattern.exp @@ -3,11 +3,11 @@ module 0xcafe::m { struct S { x: #0, } - private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { + private fun consume(s: S,x: T,f: |(S, T)|T): T { (f)(s, x) } - private fun pattern(s: m::S,x: u64): u64 { - m::consume(s, x, |(m::S{ x }, _y: u64): (m::S, u64)| { + private fun pattern(s: S,x: u64): u64 { + m::consume(s, x, |(m::S{ x }, _y: u64): (S, u64)| { let y: u64 = x; Add(x, y) }) @@ -20,13 +20,13 @@ module 0xcafe::m { struct S { x: #0, } - private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { + private fun consume(s: S,x: T,f: |(S, T)|T): T { (f)(s, x) } - private fun pattern(s: m::S,x: u64): u64 { + private fun pattern(s: S,x: u64): u64 { m::consume(s, x, closure m::pattern$lambda$1()) } - private fun pattern$lambda$1(param$0: m::S,_y: u64): u64 { + private fun pattern$lambda$1(param$0: S,_y: u64): u64 { { let m::S{ x } = param$0; { diff --git a/third_party/move/move-compiler-v2/tests/live-var/mut_ref.exp b/third_party/move/move-compiler-v2/tests/live-var/mut_ref.exp index 9e5ec15c0ef21..b2dabe6d743a4 100644 --- a/third_party/move/move-compiler-v2/tests/live-var/mut_ref.exp +++ b/third_party/move/move-compiler-v2/tests/live-var/mut_ref.exp @@ -2,11 +2,11 @@ [variant baseline] fun m::f1_ok() { - var $t0: m::R + var $t0: 0x42::m::R var $t1: u64 - var $t2: &mut m::R + var $t2: &mut 0x42::m::R 0: $t1 := 0 - 1: $t0 := pack m::R($t1) + 1: $t0 := pack 0x42::m::R($t1) 2: $t2 := borrow_local($t0) 3: m::some($t2) 4: m::some($t2) @@ -16,12 +16,12 @@ fun m::f1_ok() { [variant baseline] fun m::f1a_ok() { - var $t0: m::R + var $t0: 0x42::m::R var $t1: u64 - var $t2: &mut m::R - var $t3: m::R + var $t2: &mut 0x42::m::R + var $t3: 0x42::m::R 0: $t1 := 0 - 1: $t0 := pack m::R($t1) + 1: $t0 := pack 0x42::m::R($t1) 2: $t2 := borrow_local($t0) 3: $t3 := read_ref($t2) 4: m::some($t2) @@ -32,12 +32,12 @@ fun m::f1a_ok() { [variant baseline] fun m::f1b_ok() { - var $t0: m::R + var $t0: 0x42::m::R var $t1: u64 - var $t2: &mut m::R - var $t3: m::R + var $t2: &mut 0x42::m::R + var $t3: 0x42::m::R 0: $t1 := 0 - 1: $t0 := pack m::R($t1) + 1: $t0 := pack 0x42::m::R($t1) 2: $t2 := borrow_local($t0) 3: m::some($t2) 4: $t3 := read_ref($t2) @@ -48,11 +48,11 @@ fun m::f1b_ok() { [variant baseline] fun m::f2_fail() { - var $t0: m::R + var $t0: 0x42::m::R var $t1: u64 - var $t2: &mut m::R + var $t2: &mut 0x42::m::R 0: $t1 := 0 - 1: $t0 := pack m::R($t1) + 1: $t0 := pack 0x42::m::R($t1) 2: $t2 := borrow_local($t0) 3: m::some2($t2, $t2) 4: return () @@ -61,12 +61,12 @@ fun m::f2_fail() { [variant baseline] fun m::f3_ok() { - var $t0: m::R + var $t0: 0x42::m::R var $t1: u64 - var $t2: &mut m::R - var $t3: &mut m::R + var $t2: &mut 0x42::m::R + var $t3: &mut 0x42::m::R 0: $t1 := 0 - 1: $t0 := pack m::R($t1) + 1: $t0 := pack 0x42::m::R($t1) 2: $t2 := borrow_local($t0) 3: m::some($t2) 4: $t3 := borrow_local($t0) @@ -78,12 +78,12 @@ fun m::f3_ok() { [variant baseline] fun m::f4_ok() { - var $t0: m::R + var $t0: 0x42::m::R var $t1: u64 - var $t2: &mut m::R - var $t3: &mut m::R + var $t2: &mut 0x42::m::R + var $t3: &mut 0x42::m::R 0: $t1 := 0 - 1: $t0 := pack m::R($t1) + 1: $t0 := pack 0x42::m::R($t1) 2: $t2 := borrow_local($t0) 3: $t3 := m::id($t2) 4: $t2 := infer($t3) @@ -94,12 +94,12 @@ fun m::f4_ok() { [variant baseline] fun m::f5_fail($t0: bool) { - var $t1: m::R + var $t1: 0x42::m::R var $t2: u64 - var $t3: &mut m::R - var $t4: &mut m::R + var $t3: &mut 0x42::m::R + var $t4: &mut 0x42::m::R 0: $t2 := 0 - 1: $t1 := pack m::R($t2) + 1: $t1 := pack 0x42::m::R($t2) 2: $t3 := borrow_local($t1) 3: $t4 := infer($t3) 4: if ($t0) goto 5 else goto 9 @@ -116,21 +116,21 @@ fun m::f5_fail($t0: bool) { [variant baseline] -fun m::id($t0: &mut m::R): &mut m::R { - var $t1: &mut m::R +fun m::id($t0: &mut 0x42::m::R): &mut 0x42::m::R { + var $t1: &mut 0x42::m::R 0: $t1 := infer($t0) 1: return $t1 } [variant baseline] -fun m::some($t0: &mut m::R) { +fun m::some($t0: &mut 0x42::m::R) { 0: return () } [variant baseline] -fun m::some2($t0: &mut m::R, $t1: &mut m::R) { +fun m::some2($t0: &mut 0x42::m::R, $t1: &mut 0x42::m::R) { 0: return () } @@ -138,13 +138,13 @@ fun m::some2($t0: &mut m::R, $t1: &mut m::R) { [variant baseline] fun m::f1_ok() { - var $t0: m::R + var $t0: 0x42::m::R var $t1: u64 - var $t2: &mut m::R + var $t2: &mut 0x42::m::R # live vars: 0: $t1 := 0 # live vars: $t1 - 1: $t0 := pack m::R($t1) + 1: $t0 := pack 0x42::m::R($t1) # live vars: $t0 2: $t2 := borrow_local($t0) # live vars: $t2 @@ -158,14 +158,14 @@ fun m::f1_ok() { [variant baseline] fun m::f1a_ok() { - var $t0: m::R + var $t0: 0x42::m::R var $t1: u64 - var $t2: &mut m::R - var $t3: m::R + var $t2: &mut 0x42::m::R + var $t3: 0x42::m::R # live vars: 0: $t1 := 0 # live vars: $t1 - 1: $t0 := pack m::R($t1) + 1: $t0 := pack 0x42::m::R($t1) # live vars: $t0 2: $t2 := borrow_local($t0) # live vars: $t2 @@ -181,14 +181,14 @@ fun m::f1a_ok() { [variant baseline] fun m::f1b_ok() { - var $t0: m::R + var $t0: 0x42::m::R var $t1: u64 - var $t2: &mut m::R - var $t3: m::R + var $t2: &mut 0x42::m::R + var $t3: 0x42::m::R # live vars: 0: $t1 := 0 # live vars: $t1 - 1: $t0 := pack m::R($t1) + 1: $t0 := pack 0x42::m::R($t1) # live vars: $t0 2: $t2 := borrow_local($t0) # live vars: $t2 @@ -204,13 +204,13 @@ fun m::f1b_ok() { [variant baseline] fun m::f2_fail() { - var $t0: m::R + var $t0: 0x42::m::R var $t1: u64 - var $t2: &mut m::R + var $t2: &mut 0x42::m::R # live vars: 0: $t1 := 0 # live vars: $t1 - 1: $t0 := pack m::R($t1) + 1: $t0 := pack 0x42::m::R($t1) # live vars: $t0 2: $t2 := borrow_local($t0) # live vars: $t2 @@ -222,14 +222,14 @@ fun m::f2_fail() { [variant baseline] fun m::f3_ok() { - var $t0: m::R + var $t0: 0x42::m::R var $t1: u64 - var $t2: &mut m::R - var $t3: &mut m::R + var $t2: &mut 0x42::m::R + var $t3: &mut 0x42::m::R # live vars: 0: $t1 := 0 # live vars: $t1 - 1: $t0 := pack m::R($t1) + 1: $t0 := pack 0x42::m::R($t1) # live vars: $t0 2: $t2 := borrow_local($t0) # live vars: $t0, $t2 @@ -247,14 +247,14 @@ fun m::f3_ok() { [variant baseline] fun m::f4_ok() { - var $t0: m::R + var $t0: 0x42::m::R var $t1: u64 - var $t2: &mut m::R - var $t3: &mut m::R + var $t2: &mut 0x42::m::R + var $t3: &mut 0x42::m::R # live vars: 0: $t1 := 0 # live vars: $t1 - 1: $t0 := pack m::R($t1) + 1: $t0 := pack 0x42::m::R($t1) # live vars: $t0 2: $t2 := borrow_local($t0) # live vars: $t2 @@ -270,14 +270,14 @@ fun m::f4_ok() { [variant baseline] fun m::f5_fail($t0: bool) { - var $t1: m::R + var $t1: 0x42::m::R var $t2: u64 - var $t3: &mut m::R - var $t4: &mut m::R + var $t3: &mut 0x42::m::R + var $t4: &mut 0x42::m::R # live vars: $t0 0: $t2 := 0 # live vars: $t0, $t2 - 1: $t1 := pack m::R($t2) + 1: $t1 := pack 0x42::m::R($t2) # live vars: $t0, $t1 2: $t3 := borrow_local($t1) # live vars: $t0, $t3 @@ -306,8 +306,8 @@ fun m::f5_fail($t0: bool) { [variant baseline] -fun m::id($t0: &mut m::R): &mut m::R { - var $t1: &mut m::R +fun m::id($t0: &mut 0x42::m::R): &mut 0x42::m::R { + var $t1: &mut 0x42::m::R # live vars: $t0 0: $t1 := infer($t0) # live vars: $t1 @@ -316,14 +316,14 @@ fun m::id($t0: &mut m::R): &mut m::R { [variant baseline] -fun m::some($t0: &mut m::R) { +fun m::some($t0: &mut 0x42::m::R) { # live vars: $t0 0: return () } [variant baseline] -fun m::some2($t0: &mut m::R, $t1: &mut m::R) { +fun m::some2($t0: &mut 0x42::m::R, $t1: &mut 0x42::m::R) { # live vars: $t0, $t1 0: return () } diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/mut_ref2.exp b/third_party/move/move-compiler-v2/tests/more-v1/liveness/mut_ref2.exp index 9d2cce8b6b8c3..5549335eb8a0c 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/liveness/mut_ref2.exp +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/mut_ref2.exp @@ -1,54 +1,54 @@ Diagnostics: -error: local `r` of type `m::R` does not have the `drop` ability +error: local `r` of type `R` does not have the `drop` ability ┌─ tests/more-v1/liveness/mut_ref2.move:15:17 │ 15 │ let x = &mut r; │ ^^^^^^ still borrowed but will be implicitly dropped later since it is no longer used -error: local `r` of type `m::R` does not have the `drop` ability +error: local `r` of type `R` does not have the `drop` ability ┌─ tests/more-v1/liveness/mut_ref2.move:23:17 │ 23 │ let x = &mut r; │ ^^^^^^ still borrowed but will be implicitly dropped later since it is no longer used -error: local `x` of type `m::R` does not have the `copy` ability +error: local `x` of type `R` does not have the `copy` ability ┌─ tests/more-v1/liveness/mut_ref2.move:24:9 │ 24 │ *x; // Expected ok because x is only read; ability analysis will check whether read is ok │ ^^ reference content copied here -error: value of type `m::R` does not have the `drop` ability +error: value of type `R` does not have the `drop` ability ┌─ tests/more-v1/liveness/mut_ref2.move:24:9 │ 24 │ *x; // Expected ok because x is only read; ability analysis will check whether read is ok │ ^^ implicitly dropped here since it is no longer used -error: local `r` of type `m::R` does not have the `drop` ability +error: local `r` of type `R` does not have the `drop` ability ┌─ tests/more-v1/liveness/mut_ref2.move:31:17 │ 31 │ let x = &mut r; │ ^^^^^^ still borrowed but will be implicitly dropped later since it is no longer used -error: local `x` of type `m::R` does not have the `copy` ability +error: local `x` of type `R` does not have the `copy` ability ┌─ tests/more-v1/liveness/mut_ref2.move:33:9 │ 33 │ *x; // Same as f1aok │ ^^ reference content copied here -error: value of type `m::R` does not have the `drop` ability +error: value of type `R` does not have the `drop` ability ┌─ tests/more-v1/liveness/mut_ref2.move:33:9 │ 33 │ *x; // Same as f1aok │ ^^ implicitly dropped here since it is no longer used -error: local `r` of type `m::R` does not have the `drop` ability +error: local `r` of type `R` does not have the `drop` ability ┌─ tests/more-v1/liveness/mut_ref2.move:42:13 │ 42 │ x = &mut r; │ ^^^^^^ still borrowed but will be implicitly dropped later since it is no longer used -error: local `r` of type `m::R` does not have the `drop` ability +error: local `r` of type `R` does not have the `drop` ability ┌─ tests/more-v1/liveness/mut_ref2.move:48:17 │ 48 │ let x = &mut r; diff --git a/third_party/move/move-compiler-v2/tests/more-v1/locals/assign_partial_resource.exp b/third_party/move/move-compiler-v2/tests/more-v1/locals/assign_partial_resource.exp index be7644dd18716..17f1975f56719 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/locals/assign_partial_resource.exp +++ b/third_party/move/move-compiler-v2/tests/more-v1/locals/assign_partial_resource.exp @@ -26,19 +26,19 @@ warning: Unused assignment to `r`. Consider removing or prefixing with an unders Diagnostics: -error: local `r` of type `M::R` does not have the `drop` ability +error: local `r` of type `R` does not have the `drop` ability ┌─ tests/more-v1/locals/assign_partial_resource.move:6:21 │ 6 │ if (cond) { r = R{}; }; │ ^^^^^^^ implicitly dropped here since it is no longer used -error: local `r` of type `M::R` does not have the `drop` ability +error: local `r` of type `R` does not have the `drop` ability ┌─ tests/more-v1/locals/assign_partial_resource.move:13:29 │ 13 │ if (cond) {} else { r = R{}; }; │ ^^^^^^^ implicitly dropped here since it is no longer used -error: local `r` of type `M::R` does not have the `drop` ability +error: local `r` of type `R` does not have the `drop` ability ┌─ tests/more-v1/locals/assign_partial_resource.move:20:24 │ 20 │ while (cond) { r = R{} }; diff --git a/third_party/move/move-compiler-v2/tests/more-v1/locals/assign_resource.exp b/third_party/move/move-compiler-v2/tests/more-v1/locals/assign_resource.exp index b99889c927077..6c7b79d54a2ce 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/locals/assign_resource.exp +++ b/third_party/move/move-compiler-v2/tests/more-v1/locals/assign_resource.exp @@ -14,25 +14,25 @@ warning: Unused assignment to `r`. Consider removing or prefixing with an unders Diagnostics: -error: local `r` of type `M::R` does not have the `drop` ability +error: local `r` of type `R` does not have the `drop` ability ┌─ tests/more-v1/locals/assign_resource.move:5:17 │ 5 │ let r = R{}; │ ^^^ implicitly dropped here since it is no longer used -error: local `r` of type `M::R` does not have the `drop` ability +error: local `r` of type `R` does not have the `drop` ability ┌─ tests/more-v1/locals/assign_resource.move:12:19 │ 12 │ if (cond) { r = R{}; }; │ ^^^^^^^^^^^^ implicitly dropped here since it is no longer used -error: local `r` of type `M::R` does not have the `drop` ability +error: local `r` of type `R` does not have the `drop` ability ┌─ tests/more-v1/locals/assign_resource.move:18:27 │ 18 │ if (cond) {} else { r = R{}; }; │ ^^^^^^^^^^^^ implicitly dropped here since it is no longer used -error: local `r` of type `M::R` does not have the `drop` ability +error: local `r` of type `R` does not have the `drop` ability ┌─ tests/more-v1/locals/assign_resource.move:24:24 │ 24 │ while (cond) { r = R{} }; diff --git a/third_party/move/move-compiler-v2/tests/more-v1/locals/unused_resource.exp b/third_party/move/move-compiler-v2/tests/more-v1/locals/unused_resource.exp index c26fec6cde656..a6c368f98dfca 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/locals/unused_resource.exp +++ b/third_party/move/move-compiler-v2/tests/more-v1/locals/unused_resource.exp @@ -46,43 +46,43 @@ warning: Unused assignment to `r`. Consider removing or prefixing with an unders Diagnostics: -error: local `r` of type `M::R` does not have the `drop` ability +error: local `r` of type `R` does not have the `drop` ability ┌─ tests/more-v1/locals/unused_resource.move:5:17 │ 5 │ let r = R{}; │ ^^^ implicitly dropped here since it is no longer used -error: local `_r` of type `M::R` does not have the `drop` ability +error: local `_r` of type `R` does not have the `drop` ability ┌─ tests/more-v1/locals/unused_resource.move:10:18 │ 10 │ let _r = R{}; │ ^^^ implicitly dropped here since it is no longer used -error: local `r` of type `M::R` does not have the `drop` ability +error: local `r` of type `R` does not have the `drop` ability ┌─ tests/more-v1/locals/unused_resource.move:15:21 │ 15 │ if (cond) { r = R{}; }; │ ^^^^^^^ implicitly dropped here since it is no longer used -error: local `r` of type `M::R` does not have the `drop` ability +error: local `r` of type `R` does not have the `drop` ability ┌─ tests/more-v1/locals/unused_resource.move:20:29 │ 20 │ if (cond) {} else { r = R{}; }; │ ^^^^^^^ implicitly dropped here since it is no longer used -error: local `r` of type `M::R` does not have the `drop` ability +error: local `r` of type `R` does not have the `drop` ability ┌─ tests/more-v1/locals/unused_resource.move:25:24 │ 25 │ while (cond) { r = R{} }; │ ^^^^^^^ implicitly dropped here since it is no longer used -error: value of type `M::R` does not have the `drop` ability +error: value of type `R` does not have the `drop` ability ┌─ tests/more-v1/locals/unused_resource.move:33:17 │ 33 │ let _ = &R{}; │ ^^^^ still borrowed but will be implicitly dropped later since it is no longer used -error: local `_x` of type `M::R` does not have the `drop` ability +error: local `_x` of type `R` does not have the `drop` ability ┌─ tests/more-v1/locals/unused_resource.move:36:22 │ 36 │ fun t7(_x: R) { diff --git a/third_party/move/move-compiler-v2/tests/more-v1/locals/unused_resource_explicit_return.exp b/third_party/move/move-compiler-v2/tests/more-v1/locals/unused_resource_explicit_return.exp index e6c1bf612b336..48ea71a1d6fcc 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/locals/unused_resource_explicit_return.exp +++ b/third_party/move/move-compiler-v2/tests/more-v1/locals/unused_resource_explicit_return.exp @@ -40,43 +40,43 @@ warning: Unused assignment to `x`. Consider removing or prefixing with an unders Diagnostics: -error: local `r` of type `M::R` does not have the `drop` ability +error: local `r` of type `R` does not have the `drop` ability ┌─ tests/more-v1/locals/unused_resource_explicit_return.move:5:17 │ 5 │ let r = R{}; │ ^^^ implicitly dropped here since it is no longer used -error: local `r` of type `M::R` does not have the `drop` ability +error: local `r` of type `R` does not have the `drop` ability ┌─ tests/more-v1/locals/unused_resource_explicit_return.move:11:21 │ 11 │ if (cond) { return () }; │ ^^^^^^^^^ implicitly dropped here since it is no longer used -error: local `r` of type `M::R` does not have the `drop` ability +error: local `r` of type `R` does not have the `drop` ability ┌─ tests/more-v1/locals/unused_resource_explicit_return.move:17:29 │ 17 │ if (cond) {} else { return () }; │ ^^^^^^^^^ implicitly dropped here since it is no longer used -error: local `r` of type `M::R` does not have the `drop` ability +error: local `r` of type `R` does not have the `drop` ability ┌─ tests/more-v1/locals/unused_resource_explicit_return.move:23:24 │ 23 │ while (cond) { return () }; │ ^^^^^^^^^ implicitly dropped here since it is no longer used -error: local `r` of type `M::R` does not have the `drop` ability +error: local `r` of type `R` does not have the `drop` ability ┌─ tests/more-v1/locals/unused_resource_explicit_return.move:28:17 │ 28 │ let r = R{}; │ ^^^ implicitly dropped here since it is no longer used -error: value of type `M::R` does not have the `drop` ability +error: value of type `R` does not have the `drop` ability ┌─ tests/more-v1/locals/unused_resource_explicit_return.move:33:17 │ 33 │ let x = &R{}; │ ^^^^ implicitly dropped here since it is no longer used -error: local `_x` of type `M::R` does not have the `drop` ability +error: local `_x` of type `R` does not have the `drop` ability ┌─ tests/more-v1/locals/unused_resource_explicit_return.move:38:9 │ 38 │ return () diff --git a/third_party/move/move-compiler-v2/tests/no-simplifier/constant_folding_ristretto.exp b/third_party/move/move-compiler-v2/tests/no-simplifier/constant_folding_ristretto.exp index b6a72eeed3745..8a40a0cf6ddc3 100644 --- a/third_party/move/move-compiler-v2/tests/no-simplifier/constant_folding_ristretto.exp +++ b/third_party/move/move-compiler-v2/tests/no-simplifier/constant_folding_ristretto.exp @@ -16,5 +16,14 @@ module 0xcafe::Ristretto { } } // end 0xcafe::Ristretto +// -- Sourcified model before bytecode pipeline +module 0xcafe::Ristretto { + public fun test() { + let non_canonical_highbit = vector[0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 128u8]; + let non_canonical_highbit_hex = vector[0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 128u8]; + if (non_canonical_highbit == non_canonical_highbit_hex) () else abort 1; + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/no-simplifier/moved_var_not_simplified.exp b/third_party/move/move-compiler-v2/tests/no-simplifier/moved_var_not_simplified.exp index 6c96a94dd70d5..0ed31e88c7ef1 100644 --- a/third_party/move/move-compiler-v2/tests/no-simplifier/moved_var_not_simplified.exp +++ b/third_party/move/move-compiler-v2/tests/no-simplifier/moved_var_not_simplified.exp @@ -11,6 +11,15 @@ module 0xc0ffee::m { } } // end 0xc0ffee::m +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::m { + public fun test(): u8 { + let x = 40u8; + let y = move x; + x + y + } +} + Diagnostics: error: cannot move local `x` since it is still in use diff --git a/third_party/move/move-compiler-v2/tests/no-simplifier/moved_var_not_simplified2.exp b/third_party/move/move-compiler-v2/tests/no-simplifier/moved_var_not_simplified2.exp index ee86deb4ac415..73e1150d1e95c 100644 --- a/third_party/move/move-compiler-v2/tests/no-simplifier/moved_var_not_simplified2.exp +++ b/third_party/move/move-compiler-v2/tests/no-simplifier/moved_var_not_simplified2.exp @@ -14,6 +14,16 @@ module 0xc0ffee::m { } } // end 0xc0ffee::m +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::m { + public fun test(): u8 { + let x = 40u8; + let y = move x; + let _z = x; + y + } +} + Diagnostics: error: cannot move local `x` since it is still in use diff --git a/third_party/move/move-compiler-v2/tests/op-equal/eval_order.exp b/third_party/move/move-compiler-v2/tests/op-equal/eval_order.exp index af73f4aa09c89..8d0574ecb6ed7 100644 --- a/third_party/move/move-compiler-v2/tests/op-equal/eval_order.exp +++ b/third_party/move/move-compiler-v2/tests/op-equal/eval_order.exp @@ -63,6 +63,70 @@ module 0xc0ffee::m { } } // end 0xc0ffee::m +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::m { + fun mod1(r: &mut u64) { + { + let $t1 = r; + *$t1 = *$t1 + 2 + }; + } + fun mod2(r: &mut u64): u64 { + { + let $t1 = r; + *$t1 = *$t1 + 2 + }; + *r + } + public fun test0(): u64 { + let v = 1; + { + let $t = { + { + let $t = { + v = v + 2; + v + }; + v = v + $t + }; + v + }; + v = v + $t + }; + v + } + public fun test1(): u64 { + let v = 1; + { + let $t = { + v = v + 2; + v + }; + v = v + $t + }; + v + } + public fun test2(): u64 { + let v = 1; + { + let $t = { + mod1(&mut v); + v + }; + v = v + $t + }; + v + } + public fun test3(): u64 { + let v = 1; + { + let $t = mod2(&mut v); + v = v + $t + }; + v + } +} + ============ initial bytecode ================ [variant baseline] diff --git a/third_party/move/move-compiler-v2/tests/op-equal/invalid1.exp b/third_party/move/move-compiler-v2/tests/op-equal/invalid1.exp index c4d6ef7d6de9f..e615879b5173c 100644 --- a/third_party/move/move-compiler-v2/tests/op-equal/invalid1.exp +++ b/third_party/move/move-compiler-v2/tests/op-equal/invalid1.exp @@ -17,6 +17,20 @@ module 0x42::test { } } // end 0x42::test +// -- Sourcified model before bytecode pipeline +module 0x42::test { + fun test() { + let x = 42; + let p = &mut x; + x = x + 1; + { + let $t1 = p; + *$t1 = *$t1 + 1 + }; + x; + } +} + ============ initial bytecode ================ [variant baseline] diff --git a/third_party/move/move-compiler-v2/tests/op-equal/invalid6.exp b/third_party/move/move-compiler-v2/tests/op-equal/invalid6.exp index b0f19991064b6..01616fe6ce2a2 100644 --- a/third_party/move/move-compiler-v2/tests/op-equal/invalid6.exp +++ b/third_party/move/move-compiler-v2/tests/op-equal/invalid6.exp @@ -13,6 +13,19 @@ module 0x42::test { } } // end 0x42::test +// -- Sourcified model before bytecode pipeline +module 0x42::test { + fun inc_new(x: &u256) { + { + let $t1 = x; + *$t1 = *$t1 + 1u256 + }; + } + fun inc_old(x: &u256) { + *x = *x + 1u256; + } +} + Diagnostics: error: expected `&mut` but found `&u256` diff --git a/third_party/move/move-compiler-v2/tests/op-equal/valid0.exp b/third_party/move/move-compiler-v2/tests/op-equal/valid0.exp index f8abe9f33a24b..3d819831e8a3e 100644 --- a/third_party/move/move-compiler-v2/tests/op-equal/valid0.exp +++ b/third_party/move/move-compiler-v2/tests/op-equal/valid0.exp @@ -14,38 +14,38 @@ module 0x42::test { x: u256 = Add(x, 1); x } - private fun coin_inc_new_1(self: &mut test::Coin) { + private fun coin_inc_new_1(self: &mut Coin) { { - let $t1: &mut u256 = Borrow(Mutable)(select test::Coin.0<&mut test::Coin>(self)); + let $t1: &mut u256 = Borrow(Mutable)(select test::Coin.0<&mut Coin>(self)); $t1 = Add(Deref($t1), 1) }; Tuple() } - private fun coin_inc_new_2(self: &mut test::Coin) { + private fun coin_inc_new_2(self: &mut Coin) { { - let p: &mut u256 = Borrow(Mutable)(select test::Coin.0<&mut test::Coin>(self)); + let p: &mut u256 = Borrow(Mutable)(select test::Coin.0<&mut Coin>(self)); p = Add(Deref(p), 1); Tuple() } } - private fun coin_inc_old_1(self: &mut test::Coin) { - select test::Coin.0<&mut test::Coin>(self) = Add(select test::Coin.0<&mut test::Coin>(self), 1); + private fun coin_inc_old_1(self: &mut Coin) { + select test::Coin.0<&mut Coin>(self) = Add(select test::Coin.0<&mut Coin>(self), 1); Tuple() } - private fun coin_inc_old_2(self: &mut test::Coin) { + private fun coin_inc_old_2(self: &mut Coin) { { - let p: &mut u256 = Borrow(Mutable)(select test::Coin.0<&mut test::Coin>(self)); + let p: &mut u256 = Borrow(Mutable)(select test::Coin.0<&mut Coin>(self)); p = Add(Deref(p), 1); Tuple() } } private fun inc_coin_at(addr: address) - acquires test::Coin(*) + acquires 0x42::test::Coin(*) { { - let coin: &mut test::Coin = BorrowGlobal(Mutable)(addr); + let coin: &mut Coin = BorrowGlobal(Mutable)(addr); { - let $t1: &mut u256 = Borrow(Mutable)(select test::Coin.0<&mut test::Coin>(coin)); + let $t1: &mut u256 = Borrow(Mutable)(select test::Coin.0<&mut Coin>(coin)); $t1 = Add(Deref($t1), 1) }; Tuple() @@ -62,15 +62,15 @@ module 0x42::test { x = Add(Deref(x), 1); Tuple() } - private fun inc_vec_coin_new(x: vector,index: u64) { + private fun inc_vec_coin_new(x: vector,index: u64) { { - let $t1: &mut u256 = Borrow(Mutable)(select test::Coin.0(vector::borrow_mut(Borrow(Mutable)(x), index))); + let $t1: &mut u256 = Borrow(Mutable)(select test::Coin.0(vector::borrow_mut(Borrow(Mutable)(x), index))); $t1 = Add(Deref($t1), 1) }; Tuple() } - private fun inc_vec_coin_old(x: vector,index: u64) { - select test::Coin.0(vector::borrow_mut(Borrow(Mutable)(x), index)) = Add(select test::Coin.0(vector::borrow(Borrow(Immutable)(x), index)), 1); + private fun inc_vec_coin_old(x: vector,index: u64) { + select test::Coin.0(vector::borrow_mut(Borrow(Mutable)(x), index)) = Add(select test::Coin.0(vector::borrow(Borrow(Immutable)(x), index)), 1); Tuple() } private fun inc_vec_new(x: &mut vector,index: u64) { @@ -84,30 +84,119 @@ module 0x42::test { vector::borrow_mut(Borrow(Mutable)(x), index) = Add(Deref(vector::borrow(Borrow(Immutable)(x), index)), 1); Tuple() } - private fun inc_vec_wrapped_coin_new(x: vector>,index: u64) { + private fun inc_vec_wrapped_coin_new(x: vector>,index: u64) { { - let $t1: &mut u256 = Borrow(Mutable)(select test::Coin.0(select test::Wrapper.0>(vector::borrow_mut>(Borrow(Mutable)(x), index)))); + let $t1: &mut u256 = Borrow(Mutable)(select test::Coin.0(select test::Wrapper.0>(vector::borrow_mut>(Borrow(Mutable)(x), index)))); $t1 = Add(Deref($t1), 1) }; Tuple() } - private fun inc_vec_wrapped_coin_old(x: vector>,index: u64) { - select test::Coin.0(select test::Wrapper.0>(vector::borrow_mut>(Borrow(Mutable)(x), index))) = Add(select test::Coin.0(select test::Wrapper.0>(vector::borrow>(Borrow(Immutable)(x), index))), 1); + private fun inc_vec_wrapped_coin_old(x: vector>,index: u64) { + select test::Coin.0(select test::Wrapper.0>(vector::borrow_mut>(Borrow(Mutable)(x), index))) = Add(select test::Coin.0(select test::Wrapper.0>(vector::borrow>(Borrow(Immutable)(x), index))), 1); Tuple() } - private fun inc_wrapped_coin_new(x: &mut test::Wrapper) { + private fun inc_wrapped_coin_new(x: &mut Wrapper) { { - let $t1: &mut u256 = Borrow(Mutable)(select test::Coin.0(select test::Wrapper.0<&mut test::Wrapper>(x))); + let $t1: &mut u256 = Borrow(Mutable)(select test::Coin.0(select test::Wrapper.0<&mut Wrapper>(x))); $t1 = Add(Deref($t1), 1) }; Tuple() } - private fun inc_wrapped_coin_old(x: &mut test::Wrapper) { - select test::Coin.0(select test::Wrapper.0<&mut test::Wrapper>(x)) = Add(select test::Coin.0(select test::Wrapper.0<&mut test::Wrapper>(x)), 1); + private fun inc_wrapped_coin_old(x: &mut Wrapper) { + select test::Coin.0(select test::Wrapper.0<&mut Wrapper>(x)) = Add(select test::Coin.0(select test::Wrapper.0<&mut Wrapper>(x)), 1); Tuple() } } // end 0x42::test +// -- Sourcified model before bytecode pipeline +module 0x42::test { + struct Coin has drop, key { + 0: u256, + } + struct Wrapper has drop, key { + 0: T, + } + fun add1_new(x: u256): u256 { + x = x + 1u256; + x + } + fun add1_old(x: u256): u256 { + x = x + 1u256; + x + } + fun coin_inc_new_1(self: &mut Coin) { + { + let $t1 = &mut self.0; + *$t1 = *$t1 + 1u256 + }; + } + fun coin_inc_new_2(self: &mut Coin) { + let p = &mut self.0; + *p = *p + 1u256; + } + fun coin_inc_old_1(self: &mut Coin) { + self.0 = self.0 + 1u256; + } + fun coin_inc_old_2(self: &mut Coin) { + let p = &mut self.0; + *p = *p + 1u256; + } + fun inc_coin_at(addr: address) + acquires Coin + { + let coin = borrow_global_mut(addr); + { + let $t1 = &mut coin.0; + *$t1 = *$t1 + 1u256 + }; + } + fun inc_new(x: &mut u256) { + { + let $t1 = x; + *$t1 = *$t1 + 1u256 + }; + } + fun inc_old(x: &mut u256) { + *x = *x + 1u256; + } + fun inc_vec_coin_new(x: vector, index: u64) { + { + let $t1 = &mut 0x1::vector::borrow_mut(&mut x, index).0; + *$t1 = *$t1 + 1u256 + }; + } + fun inc_vec_coin_old(x: vector, index: u64) { + 0x1::vector::borrow_mut(&mut x, index).0 = 0x1::vector::borrow(&x, index).0 + 1u256; + } + fun inc_vec_new(x: &mut vector, index: u64) { + { + let $t1 = 0x1::vector::borrow_mut(x, index); + *$t1 = *$t1 + 1u256 + }; + } + fun inc_vec_old(x: vector, index: u64) { + *0x1::vector::borrow_mut(&mut x, index) = *0x1::vector::borrow(&x, index) + 1u256; + } + fun inc_vec_wrapped_coin_new(x: vector>, index: u64) { + { + let $t1 = &mut 0x1::vector::borrow_mut>(&mut x, index).0.0; + *$t1 = *$t1 + 1u256 + }; + } + fun inc_vec_wrapped_coin_old(x: vector>, index: u64) { + 0x1::vector::borrow_mut>(&mut x, index).0.0 = 0x1::vector::borrow>(&x, index).0.0 + 1u256; + } + fun inc_wrapped_coin_new(x: &mut Wrapper) { + { + let $t1 = &mut x.0.0; + *$t1 = *$t1 + 1u256 + }; + } + fun inc_wrapped_coin_old(x: &mut Wrapper) { + x.0.0 = x.0.0 + 1u256; + } +} + ============ initial bytecode ================ [variant baseline] @@ -137,12 +226,12 @@ fun test::add1_old($t0: u256): u256 { [variant baseline] -fun test::coin_inc_new_1($t0: &mut test::Coin) { +fun test::coin_inc_new_1($t0: &mut 0x42::test::Coin) { var $t1: &mut u256 var $t2: u256 var $t3: u256 var $t4: u256 - 0: $t1 := borrow_field.0($t0) + 0: $t1 := borrow_field<0x42::test::Coin>.0($t0) 1: $t3 := read_ref($t1) 2: $t4 := 1 3: $t2 := +($t3, $t4) @@ -152,12 +241,12 @@ fun test::coin_inc_new_1($t0: &mut test::Coin) { [variant baseline] -fun test::coin_inc_new_2($t0: &mut test::Coin) { +fun test::coin_inc_new_2($t0: &mut 0x42::test::Coin) { var $t1: &mut u256 var $t2: u256 var $t3: u256 var $t4: u256 - 0: $t1 := borrow_field.0($t0) + 0: $t1 := borrow_field<0x42::test::Coin>.0($t0) 1: $t3 := read_ref($t1) 2: $t4 := 1 3: $t2 := +($t3, $t4) @@ -167,29 +256,29 @@ fun test::coin_inc_new_2($t0: &mut test::Coin) { [variant baseline] -fun test::coin_inc_old_1($t0: &mut test::Coin) { +fun test::coin_inc_old_1($t0: &mut 0x42::test::Coin) { var $t1: u256 var $t2: u256 var $t3: &u256 var $t4: u256 var $t5: &mut u256 - 0: $t3 := borrow_field.0($t0) + 0: $t3 := borrow_field<0x42::test::Coin>.0($t0) 1: $t2 := read_ref($t3) 2: $t4 := 1 3: $t1 := +($t2, $t4) - 4: $t5 := borrow_field.0($t0) + 4: $t5 := borrow_field<0x42::test::Coin>.0($t0) 5: write_ref($t5, $t1) 6: return () } [variant baseline] -fun test::coin_inc_old_2($t0: &mut test::Coin) { +fun test::coin_inc_old_2($t0: &mut 0x42::test::Coin) { var $t1: &mut u256 var $t2: u256 var $t3: u256 var $t4: u256 - 0: $t1 := borrow_field.0($t0) + 0: $t1 := borrow_field<0x42::test::Coin>.0($t0) 1: $t3 := read_ref($t1) 2: $t4 := 1 3: $t2 := +($t3, $t4) @@ -200,13 +289,13 @@ fun test::coin_inc_old_2($t0: &mut test::Coin) { [variant baseline] fun test::inc_coin_at($t0: address) { - var $t1: &mut test::Coin + var $t1: &mut 0x42::test::Coin var $t2: &mut u256 var $t3: u256 var $t4: u256 var $t5: u256 - 0: $t1 := borrow_global($t0) - 1: $t2 := borrow_field.0($t1) + 0: $t1 := borrow_global<0x42::test::Coin>($t0) + 1: $t2 := borrow_field<0x42::test::Coin>.0($t1) 2: $t4 := read_ref($t2) 3: $t5 := 1 4: $t3 := +($t4, $t5) @@ -244,16 +333,16 @@ fun test::inc_old($t0: &mut u256) { [variant baseline] -fun test::inc_vec_coin_new($t0: vector, $t1: u64) { +fun test::inc_vec_coin_new($t0: vector<0x42::test::Coin>, $t1: u64) { var $t2: &mut u256 - var $t3: &mut test::Coin - var $t4: &mut vector + var $t3: &mut 0x42::test::Coin + var $t4: &mut vector<0x42::test::Coin> var $t5: u256 var $t6: u256 var $t7: u256 0: $t4 := borrow_local($t0) - 1: $t3 := vector::borrow_mut($t4, $t1) - 2: $t2 := borrow_field.0($t3) + 1: $t3 := vector::borrow_mut<0x42::test::Coin>($t4, $t1) + 2: $t2 := borrow_field<0x42::test::Coin>.0($t3) 3: $t6 := read_ref($t2) 4: $t7 := 1 5: $t5 := +($t6, $t7) @@ -263,25 +352,25 @@ fun test::inc_vec_coin_new($t0: vector, $t1: u64) { [variant baseline] -fun test::inc_vec_coin_old($t0: vector, $t1: u64) { +fun test::inc_vec_coin_old($t0: vector<0x42::test::Coin>, $t1: u64) { var $t2: u256 var $t3: u256 - var $t4: &test::Coin - var $t5: &vector + var $t4: &0x42::test::Coin + var $t5: &vector<0x42::test::Coin> var $t6: &u256 var $t7: u256 var $t8: &mut u256 - var $t9: &mut test::Coin - var $t10: &mut vector + var $t9: &mut 0x42::test::Coin + var $t10: &mut vector<0x42::test::Coin> 0: $t5 := borrow_local($t0) - 1: $t4 := vector::borrow($t5, $t1) - 2: $t6 := borrow_field.0($t4) + 1: $t4 := vector::borrow<0x42::test::Coin>($t5, $t1) + 2: $t6 := borrow_field<0x42::test::Coin>.0($t4) 3: $t3 := read_ref($t6) 4: $t7 := 1 5: $t2 := +($t3, $t7) 6: $t10 := borrow_local($t0) - 7: $t9 := vector::borrow_mut($t10, $t1) - 8: $t8 := borrow_field.0($t9) + 7: $t9 := vector::borrow_mut<0x42::test::Coin>($t10, $t1) + 8: $t8 := borrow_field<0x42::test::Coin>.0($t9) 9: write_ref($t8, $t2) 10: return () } @@ -324,18 +413,18 @@ fun test::inc_vec_old($t0: vector, $t1: u64) { [variant baseline] -fun test::inc_vec_wrapped_coin_new($t0: vector>, $t1: u64) { +fun test::inc_vec_wrapped_coin_new($t0: vector<0x42::test::Wrapper<0x42::test::Coin>>, $t1: u64) { var $t2: &mut u256 - var $t3: &mut test::Coin - var $t4: &mut test::Wrapper - var $t5: &mut vector> + var $t3: &mut 0x42::test::Coin + var $t4: &mut 0x42::test::Wrapper<0x42::test::Coin> + var $t5: &mut vector<0x42::test::Wrapper<0x42::test::Coin>> var $t6: u256 var $t7: u256 var $t8: u256 0: $t5 := borrow_local($t0) - 1: $t4 := vector::borrow_mut>($t5, $t1) - 2: $t3 := borrow_field>.0($t4) - 3: $t2 := borrow_field.0($t3) + 1: $t4 := vector::borrow_mut<0x42::test::Wrapper<0x42::test::Coin>>($t5, $t1) + 2: $t3 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t4) + 3: $t2 := borrow_field<0x42::test::Coin>.0($t3) 4: $t7 := read_ref($t2) 5: $t8 := 1 6: $t6 := +($t7, $t8) @@ -345,43 +434,43 @@ fun test::inc_vec_wrapped_coin_new($t0: vector>, $t1: [variant baseline] -fun test::inc_vec_wrapped_coin_old($t0: vector>, $t1: u64) { +fun test::inc_vec_wrapped_coin_old($t0: vector<0x42::test::Wrapper<0x42::test::Coin>>, $t1: u64) { var $t2: u256 var $t3: u256 - var $t4: &test::Coin - var $t5: &test::Wrapper - var $t6: &vector> + var $t4: &0x42::test::Coin + var $t5: &0x42::test::Wrapper<0x42::test::Coin> + var $t6: &vector<0x42::test::Wrapper<0x42::test::Coin>> var $t7: &u256 var $t8: u256 var $t9: &mut u256 - var $t10: &mut test::Coin - var $t11: &mut test::Wrapper - var $t12: &mut vector> + var $t10: &mut 0x42::test::Coin + var $t11: &mut 0x42::test::Wrapper<0x42::test::Coin> + var $t12: &mut vector<0x42::test::Wrapper<0x42::test::Coin>> 0: $t6 := borrow_local($t0) - 1: $t5 := vector::borrow>($t6, $t1) - 2: $t4 := borrow_field>.0($t5) - 3: $t7 := borrow_field.0($t4) + 1: $t5 := vector::borrow<0x42::test::Wrapper<0x42::test::Coin>>($t6, $t1) + 2: $t4 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t5) + 3: $t7 := borrow_field<0x42::test::Coin>.0($t4) 4: $t3 := read_ref($t7) 5: $t8 := 1 6: $t2 := +($t3, $t8) 7: $t12 := borrow_local($t0) - 8: $t11 := vector::borrow_mut>($t12, $t1) - 9: $t10 := borrow_field>.0($t11) - 10: $t9 := borrow_field.0($t10) + 8: $t11 := vector::borrow_mut<0x42::test::Wrapper<0x42::test::Coin>>($t12, $t1) + 9: $t10 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t11) + 10: $t9 := borrow_field<0x42::test::Coin>.0($t10) 11: write_ref($t9, $t2) 12: return () } [variant baseline] -fun test::inc_wrapped_coin_new($t0: &mut test::Wrapper) { +fun test::inc_wrapped_coin_new($t0: &mut 0x42::test::Wrapper<0x42::test::Coin>) { var $t1: &mut u256 - var $t2: &mut test::Coin + var $t2: &mut 0x42::test::Coin var $t3: u256 var $t4: u256 var $t5: u256 - 0: $t2 := borrow_field>.0($t0) - 1: $t1 := borrow_field.0($t2) + 0: $t2 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t0) + 1: $t1 := borrow_field<0x42::test::Coin>.0($t2) 2: $t4 := read_ref($t1) 3: $t5 := 1 4: $t3 := +($t4, $t5) @@ -391,21 +480,21 @@ fun test::inc_wrapped_coin_new($t0: &mut test::Wrapper) { [variant baseline] -fun test::inc_wrapped_coin_old($t0: &mut test::Wrapper) { +fun test::inc_wrapped_coin_old($t0: &mut 0x42::test::Wrapper<0x42::test::Coin>) { var $t1: u256 var $t2: u256 - var $t3: &test::Coin + var $t3: &0x42::test::Coin var $t4: &u256 var $t5: u256 var $t6: &mut u256 - var $t7: &mut test::Coin - 0: $t3 := borrow_field>.0($t0) - 1: $t4 := borrow_field.0($t3) + var $t7: &mut 0x42::test::Coin + 0: $t3 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t0) + 1: $t4 := borrow_field<0x42::test::Coin>.0($t3) 2: $t2 := read_ref($t4) 3: $t5 := 1 4: $t1 := +($t2, $t5) - 5: $t7 := borrow_field>.0($t0) - 6: $t6 := borrow_field.0($t7) + 5: $t7 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t0) + 6: $t6 := borrow_field<0x42::test::Coin>.0($t7) 7: write_ref($t6, $t1) 8: return () } @@ -445,13 +534,13 @@ fun test::add1_old($t0: u256): u256 { [variant baseline] -fun test::coin_inc_new_1($t0: &mut test::Coin) { +fun test::coin_inc_new_1($t0: &mut 0x42::test::Coin) { var $t1: &mut u256 var $t2: u256 [unused] var $t3: u256 var $t4: u256 # live vars: $t0 - 0: $t1 := borrow_field.0($t0) + 0: $t1 := borrow_field<0x42::test::Coin>.0($t0) # live vars: $t1 1: $t3 := read_ref($t1) # live vars: $t1, $t3 @@ -466,13 +555,13 @@ fun test::coin_inc_new_1($t0: &mut test::Coin) { [variant baseline] -fun test::coin_inc_new_2($t0: &mut test::Coin) { +fun test::coin_inc_new_2($t0: &mut 0x42::test::Coin) { var $t1: &mut u256 var $t2: u256 [unused] var $t3: u256 var $t4: u256 # live vars: $t0 - 0: $t1 := borrow_field.0($t0) + 0: $t1 := borrow_field<0x42::test::Coin>.0($t0) # live vars: $t1 1: $t3 := read_ref($t1) # live vars: $t1, $t3 @@ -487,14 +576,14 @@ fun test::coin_inc_new_2($t0: &mut test::Coin) { [variant baseline] -fun test::coin_inc_old_1($t0: &mut test::Coin) { +fun test::coin_inc_old_1($t0: &mut 0x42::test::Coin) { var $t1: u256 [unused] var $t2: u256 var $t3: &u256 var $t4: u256 var $t5: &mut u256 # live vars: $t0 - 0: $t3 := borrow_field.0($t0) + 0: $t3 := borrow_field<0x42::test::Coin>.0($t0) # live vars: $t0, $t3 1: $t2 := read_ref($t3) # live vars: $t0, $t2 @@ -502,7 +591,7 @@ fun test::coin_inc_old_1($t0: &mut test::Coin) { # live vars: $t0, $t2, $t4 3: $t2 := +($t2, $t4) # live vars: $t0, $t2 - 4: $t5 := borrow_field.0($t0) + 4: $t5 := borrow_field<0x42::test::Coin>.0($t0) # live vars: $t2, $t5 5: write_ref($t5, $t2) # live vars: @@ -511,13 +600,13 @@ fun test::coin_inc_old_1($t0: &mut test::Coin) { [variant baseline] -fun test::coin_inc_old_2($t0: &mut test::Coin) { +fun test::coin_inc_old_2($t0: &mut 0x42::test::Coin) { var $t1: &mut u256 var $t2: u256 [unused] var $t3: u256 var $t4: u256 # live vars: $t0 - 0: $t1 := borrow_field.0($t0) + 0: $t1 := borrow_field<0x42::test::Coin>.0($t0) # live vars: $t1 1: $t3 := read_ref($t1) # live vars: $t1, $t3 @@ -533,15 +622,15 @@ fun test::coin_inc_old_2($t0: &mut test::Coin) { [variant baseline] fun test::inc_coin_at($t0: address) { - var $t1: &mut test::Coin + var $t1: &mut 0x42::test::Coin var $t2: &mut u256 var $t3: u256 [unused] var $t4: u256 var $t5: u256 # live vars: $t0 - 0: $t1 := borrow_global($t0) + 0: $t1 := borrow_global<0x42::test::Coin>($t0) # live vars: $t1 - 1: $t2 := borrow_field.0($t1) + 1: $t2 := borrow_field<0x42::test::Coin>.0($t1) # live vars: $t2 2: $t4 := read_ref($t2) # live vars: $t2, $t4 @@ -593,19 +682,19 @@ fun test::inc_old($t0: &mut u256) { [variant baseline] -fun test::inc_vec_coin_new($t0: vector, $t1: u64) { +fun test::inc_vec_coin_new($t0: vector<0x42::test::Coin>, $t1: u64) { var $t2: &mut u256 - var $t3: &mut test::Coin - var $t4: &mut vector + var $t3: &mut 0x42::test::Coin + var $t4: &mut vector<0x42::test::Coin> var $t5: u256 [unused] var $t6: u256 var $t7: u256 # live vars: $t0, $t1 0: $t4 := borrow_local($t0) # live vars: $t1, $t4 - 1: $t3 := vector::borrow_mut($t4, $t1) + 1: $t3 := vector::borrow_mut<0x42::test::Coin>($t4, $t1) # live vars: $t3 - 2: $t2 := borrow_field.0($t3) + 2: $t2 := borrow_field<0x42::test::Coin>.0($t3) # live vars: $t2 3: $t6 := read_ref($t2) # live vars: $t2, $t6 @@ -620,22 +709,22 @@ fun test::inc_vec_coin_new($t0: vector, $t1: u64) { [variant baseline] -fun test::inc_vec_coin_old($t0: vector, $t1: u64) { +fun test::inc_vec_coin_old($t0: vector<0x42::test::Coin>, $t1: u64) { var $t2: u256 [unused] var $t3: u256 - var $t4: &test::Coin - var $t5: &vector + var $t4: &0x42::test::Coin + var $t5: &vector<0x42::test::Coin> var $t6: &u256 var $t7: u256 var $t8: &mut u256 - var $t9: &mut test::Coin - var $t10: &mut vector + var $t9: &mut 0x42::test::Coin + var $t10: &mut vector<0x42::test::Coin> # live vars: $t0, $t1 0: $t5 := borrow_local($t0) # live vars: $t0, $t1, $t5 - 1: $t4 := vector::borrow($t5, $t1) + 1: $t4 := vector::borrow<0x42::test::Coin>($t5, $t1) # live vars: $t0, $t1, $t4 - 2: $t6 := borrow_field.0($t4) + 2: $t6 := borrow_field<0x42::test::Coin>.0($t4) # live vars: $t0, $t1, $t6 3: $t3 := read_ref($t6) # live vars: $t0, $t1, $t3 @@ -645,9 +734,9 @@ fun test::inc_vec_coin_old($t0: vector, $t1: u64) { # live vars: $t0, $t1, $t3 6: $t10 := borrow_local($t0) # live vars: $t1, $t3, $t10 - 7: $t9 := vector::borrow_mut($t10, $t1) + 7: $t9 := vector::borrow_mut<0x42::test::Coin>($t10, $t1) # live vars: $t3, $t9 - 8: $t8 := borrow_field.0($t9) + 8: $t8 := borrow_field<0x42::test::Coin>.0($t9) # live vars: $t3, $t8 9: write_ref($t8, $t3) # live vars: @@ -707,22 +796,22 @@ fun test::inc_vec_old($t0: vector, $t1: u64) { [variant baseline] -fun test::inc_vec_wrapped_coin_new($t0: vector>, $t1: u64) { +fun test::inc_vec_wrapped_coin_new($t0: vector<0x42::test::Wrapper<0x42::test::Coin>>, $t1: u64) { var $t2: &mut u256 - var $t3: &mut test::Coin - var $t4: &mut test::Wrapper - var $t5: &mut vector> + var $t3: &mut 0x42::test::Coin + var $t4: &mut 0x42::test::Wrapper<0x42::test::Coin> + var $t5: &mut vector<0x42::test::Wrapper<0x42::test::Coin>> var $t6: u256 [unused] var $t7: u256 var $t8: u256 # live vars: $t0, $t1 0: $t5 := borrow_local($t0) # live vars: $t1, $t5 - 1: $t4 := vector::borrow_mut>($t5, $t1) + 1: $t4 := vector::borrow_mut<0x42::test::Wrapper<0x42::test::Coin>>($t5, $t1) # live vars: $t4 - 2: $t3 := borrow_field>.0($t4) + 2: $t3 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t4) # live vars: $t3 - 3: $t2 := borrow_field.0($t3) + 3: $t2 := borrow_field<0x42::test::Coin>.0($t3) # live vars: $t2 4: $t7 := read_ref($t2) # live vars: $t2, $t7 @@ -737,26 +826,26 @@ fun test::inc_vec_wrapped_coin_new($t0: vector>, $t1: [variant baseline] -fun test::inc_vec_wrapped_coin_old($t0: vector>, $t1: u64) { +fun test::inc_vec_wrapped_coin_old($t0: vector<0x42::test::Wrapper<0x42::test::Coin>>, $t1: u64) { var $t2: u256 [unused] var $t3: u256 - var $t4: &test::Coin - var $t5: &test::Wrapper - var $t6: &vector> + var $t4: &0x42::test::Coin + var $t5: &0x42::test::Wrapper<0x42::test::Coin> + var $t6: &vector<0x42::test::Wrapper<0x42::test::Coin>> var $t7: &u256 var $t8: u256 var $t9: &mut u256 - var $t10: &mut test::Coin - var $t11: &mut test::Wrapper - var $t12: &mut vector> + var $t10: &mut 0x42::test::Coin + var $t11: &mut 0x42::test::Wrapper<0x42::test::Coin> + var $t12: &mut vector<0x42::test::Wrapper<0x42::test::Coin>> # live vars: $t0, $t1 0: $t6 := borrow_local($t0) # live vars: $t0, $t1, $t6 - 1: $t5 := vector::borrow>($t6, $t1) + 1: $t5 := vector::borrow<0x42::test::Wrapper<0x42::test::Coin>>($t6, $t1) # live vars: $t0, $t1, $t5 - 2: $t4 := borrow_field>.0($t5) + 2: $t4 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t5) # live vars: $t0, $t1, $t4 - 3: $t7 := borrow_field.0($t4) + 3: $t7 := borrow_field<0x42::test::Coin>.0($t4) # live vars: $t0, $t1, $t7 4: $t3 := read_ref($t7) # live vars: $t0, $t1, $t3 @@ -766,11 +855,11 @@ fun test::inc_vec_wrapped_coin_old($t0: vector>, $t1: # live vars: $t0, $t1, $t3 7: $t12 := borrow_local($t0) # live vars: $t1, $t3, $t12 - 8: $t11 := vector::borrow_mut>($t12, $t1) + 8: $t11 := vector::borrow_mut<0x42::test::Wrapper<0x42::test::Coin>>($t12, $t1) # live vars: $t3, $t11 - 9: $t10 := borrow_field>.0($t11) + 9: $t10 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t11) # live vars: $t3, $t10 - 10: $t9 := borrow_field.0($t10) + 10: $t9 := borrow_field<0x42::test::Coin>.0($t10) # live vars: $t3, $t9 11: write_ref($t9, $t3) # live vars: @@ -779,16 +868,16 @@ fun test::inc_vec_wrapped_coin_old($t0: vector>, $t1: [variant baseline] -fun test::inc_wrapped_coin_new($t0: &mut test::Wrapper) { +fun test::inc_wrapped_coin_new($t0: &mut 0x42::test::Wrapper<0x42::test::Coin>) { var $t1: &mut u256 - var $t2: &mut test::Coin + var $t2: &mut 0x42::test::Coin var $t3: u256 [unused] var $t4: u256 var $t5: u256 # live vars: $t0 - 0: $t2 := borrow_field>.0($t0) + 0: $t2 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t0) # live vars: $t2 - 1: $t1 := borrow_field.0($t2) + 1: $t1 := borrow_field<0x42::test::Coin>.0($t2) # live vars: $t1 2: $t4 := read_ref($t1) # live vars: $t1, $t4 @@ -803,18 +892,18 @@ fun test::inc_wrapped_coin_new($t0: &mut test::Wrapper) { [variant baseline] -fun test::inc_wrapped_coin_old($t0: &mut test::Wrapper) { +fun test::inc_wrapped_coin_old($t0: &mut 0x42::test::Wrapper<0x42::test::Coin>) { var $t1: u256 [unused] var $t2: u256 - var $t3: &test::Coin + var $t3: &0x42::test::Coin var $t4: &u256 var $t5: u256 var $t6: &mut u256 - var $t7: &mut test::Coin + var $t7: &mut 0x42::test::Coin # live vars: $t0 - 0: $t3 := borrow_field>.0($t0) + 0: $t3 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t0) # live vars: $t0, $t3 - 1: $t4 := borrow_field.0($t3) + 1: $t4 := borrow_field<0x42::test::Coin>.0($t3) # live vars: $t0, $t4 2: $t2 := read_ref($t4) # live vars: $t0, $t2 @@ -822,9 +911,9 @@ fun test::inc_wrapped_coin_old($t0: &mut test::Wrapper) { # live vars: $t0, $t2, $t5 4: $t2 := +($t2, $t5) # live vars: $t0, $t2 - 5: $t7 := borrow_field>.0($t0) + 5: $t7 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t0) # live vars: $t2, $t7 - 6: $t6 := borrow_field.0($t7) + 6: $t6 := borrow_field<0x42::test::Coin>.0($t7) # live vars: $t2, $t6 7: write_ref($t6, $t2) # live vars: diff --git a/third_party/move/move-compiler-v2/tests/op-equal/valid1.exp b/third_party/move/move-compiler-v2/tests/op-equal/valid1.exp index e6a3ff288eab3..1369ebdbc51c5 100644 --- a/third_party/move/move-compiler-v2/tests/op-equal/valid1.exp +++ b/third_party/move/move-compiler-v2/tests/op-equal/valid1.exp @@ -6,9 +6,9 @@ module 0x42::test { struct Wrapper { 0: #0, } - private fun bitand_vec_coin_new(x: vector,index: u64) { + private fun bitand_vec_coin_new(x: vector,index: u64) { { - let $t1: &mut u256 = Borrow(Mutable)(select test::Coin.0(vector::borrow_mut(Borrow(Mutable)(x), index))); + let $t1: &mut u256 = Borrow(Mutable)(select test::Coin.0(vector::borrow_mut(Borrow(Mutable)(x), index))); $t1 = BitAnd(Deref($t1), 42) }; Tuple() @@ -20,41 +20,41 @@ module 0x42::test { }; Tuple() } - private fun coin_double(self: &mut test::Coin) { + private fun coin_double(self: &mut Coin) { { - let $t1: &mut u256 = Borrow(Mutable)(select test::Coin.0<&mut test::Coin>(self)); + let $t1: &mut u256 = Borrow(Mutable)(select test::Coin.0<&mut Coin>(self)); $t1 = Mul(Deref($t1), 2) }; Tuple() } - private fun coin_mod_2(self: &mut test::Coin) { + private fun coin_mod_2(self: &mut Coin) { { - let $t1: &mut u256 = Borrow(Mutable)(select test::Coin.0<&mut test::Coin>(self)); + let $t1: &mut u256 = Borrow(Mutable)(select test::Coin.0<&mut Coin>(self)); $t1 = Mod(Deref($t1), 2) }; Tuple() } - private fun half_wrapped_coin_new(x: &mut test::Wrapper) { + private fun half_wrapped_coin_new(x: &mut Wrapper) { { - let $t1: &mut u256 = Borrow(Mutable)(select test::Coin.0(select test::Wrapper.0<&mut test::Wrapper>(x))); + let $t1: &mut u256 = Borrow(Mutable)(select test::Coin.0(select test::Wrapper.0<&mut Wrapper>(x))); $t1 = Div(Deref($t1), 2) }; Tuple() } - private fun shl_vec_wrapped_coin_old(x: vector>,index: u64) { + private fun shl_vec_wrapped_coin_old(x: vector>,index: u64) { { - let $t1: &mut u256 = Borrow(Mutable)(select test::Coin.0(select test::Wrapper.0>(vector::borrow_mut>(Borrow(Mutable)(x), index)))); + let $t1: &mut u256 = Borrow(Mutable)(select test::Coin.0(select test::Wrapper.0>(vector::borrow_mut>(Borrow(Mutable)(x), index)))); $t1 = Shl(Deref($t1), 1) }; Tuple() } private fun shr_coin_at(addr: address) - acquires test::Coin(*) + acquires 0x42::test::Coin(*) { { - let coin: &mut test::Coin = BorrowGlobal(Mutable)(addr); + let coin: &mut Coin = BorrowGlobal(Mutable)(addr); { - let $t1: &mut u256 = Borrow(Mutable)(select test::Coin.0<&mut test::Coin>(coin)); + let $t1: &mut u256 = Borrow(Mutable)(select test::Coin.0<&mut Coin>(coin)); $t1 = Shr(Deref($t1), 1) }; Tuple() @@ -67,28 +67,95 @@ module 0x42::test { }; Tuple() } - private fun xor_vec_wrapped_coin_new(x: vector>,index: u64) { + private fun xor_vec_wrapped_coin_new(x: vector>,index: u64) { { - let $t1: &mut u256 = Borrow(Mutable)(select test::Coin.0(select test::Wrapper.0>(vector::borrow_mut>(Borrow(Mutable)(x), index)))); + let $t1: &mut u256 = Borrow(Mutable)(select test::Coin.0(select test::Wrapper.0>(vector::borrow_mut>(Borrow(Mutable)(x), index)))); $t1 = Xor(Deref($t1), 1) }; Tuple() } } // end 0x42::test +// -- Sourcified model before bytecode pipeline +module 0x42::test { + struct Coin has drop, key { + 0: u256, + } + struct Wrapper has drop, key { + 0: T, + } + fun bitand_vec_coin_new(x: vector, index: u64) { + { + let $t1 = &mut 0x1::vector::borrow_mut(&mut x, index).0; + *$t1 = *$t1 & 42u256 + }; + } + fun bitor_vec_new(x: &mut vector, index: u64) { + { + let $t1 = 0x1::vector::borrow_mut(x, index); + *$t1 = *$t1 | 42u256 + }; + } + fun coin_double(self: &mut Coin) { + { + let $t1 = &mut self.0; + *$t1 = *$t1 * 2u256 + }; + } + fun coin_mod_2(self: &mut Coin) { + { + let $t1 = &mut self.0; + *$t1 = *$t1 % 2u256 + }; + } + fun half_wrapped_coin_new(x: &mut Wrapper) { + { + let $t1 = &mut x.0.0; + *$t1 = *$t1 / 2u256 + }; + } + fun shl_vec_wrapped_coin_old(x: vector>, index: u64) { + { + let $t1 = &mut 0x1::vector::borrow_mut>(&mut x, index).0.0; + *$t1 = *$t1 << 1u8 + }; + } + fun shr_coin_at(addr: address) + acquires Coin + { + let coin = borrow_global_mut(addr); + { + let $t1 = &mut coin.0; + *$t1 = *$t1 >> 1u8 + }; + } + fun sub1(x: &mut u256) { + { + let $t1 = x; + *$t1 = *$t1 - 1u256 + }; + } + fun xor_vec_wrapped_coin_new(x: vector>, index: u64) { + { + let $t1 = &mut 0x1::vector::borrow_mut>(&mut x, index).0.0; + *$t1 = *$t1 ^ 1u256 + }; + } +} + ============ initial bytecode ================ [variant baseline] -fun test::bitand_vec_coin_new($t0: vector, $t1: u64) { +fun test::bitand_vec_coin_new($t0: vector<0x42::test::Coin>, $t1: u64) { var $t2: &mut u256 - var $t3: &mut test::Coin - var $t4: &mut vector + var $t3: &mut 0x42::test::Coin + var $t4: &mut vector<0x42::test::Coin> var $t5: u256 var $t6: u256 var $t7: u256 0: $t4 := borrow_local($t0) - 1: $t3 := vector::borrow_mut($t4, $t1) - 2: $t2 := borrow_field.0($t3) + 1: $t3 := vector::borrow_mut<0x42::test::Coin>($t4, $t1) + 2: $t2 := borrow_field<0x42::test::Coin>.0($t3) 3: $t6 := read_ref($t2) 4: $t7 := 42 5: $t5 := &($t6, $t7) @@ -113,12 +180,12 @@ fun test::bitor_vec_new($t0: &mut vector, $t1: u64) { [variant baseline] -fun test::coin_double($t0: &mut test::Coin) { +fun test::coin_double($t0: &mut 0x42::test::Coin) { var $t1: &mut u256 var $t2: u256 var $t3: u256 var $t4: u256 - 0: $t1 := borrow_field.0($t0) + 0: $t1 := borrow_field<0x42::test::Coin>.0($t0) 1: $t3 := read_ref($t1) 2: $t4 := 2 3: $t2 := *($t3, $t4) @@ -128,12 +195,12 @@ fun test::coin_double($t0: &mut test::Coin) { [variant baseline] -fun test::coin_mod_2($t0: &mut test::Coin) { +fun test::coin_mod_2($t0: &mut 0x42::test::Coin) { var $t1: &mut u256 var $t2: u256 var $t3: u256 var $t4: u256 - 0: $t1 := borrow_field.0($t0) + 0: $t1 := borrow_field<0x42::test::Coin>.0($t0) 1: $t3 := read_ref($t1) 2: $t4 := 2 3: $t2 := %($t3, $t4) @@ -143,14 +210,14 @@ fun test::coin_mod_2($t0: &mut test::Coin) { [variant baseline] -fun test::half_wrapped_coin_new($t0: &mut test::Wrapper) { +fun test::half_wrapped_coin_new($t0: &mut 0x42::test::Wrapper<0x42::test::Coin>) { var $t1: &mut u256 - var $t2: &mut test::Coin + var $t2: &mut 0x42::test::Coin var $t3: u256 var $t4: u256 var $t5: u256 - 0: $t2 := borrow_field>.0($t0) - 1: $t1 := borrow_field.0($t2) + 0: $t2 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t0) + 1: $t1 := borrow_field<0x42::test::Coin>.0($t2) 2: $t4 := read_ref($t1) 3: $t5 := 2 4: $t3 := /($t4, $t5) @@ -160,18 +227,18 @@ fun test::half_wrapped_coin_new($t0: &mut test::Wrapper) { [variant baseline] -fun test::shl_vec_wrapped_coin_old($t0: vector>, $t1: u64) { +fun test::shl_vec_wrapped_coin_old($t0: vector<0x42::test::Wrapper<0x42::test::Coin>>, $t1: u64) { var $t2: &mut u256 - var $t3: &mut test::Coin - var $t4: &mut test::Wrapper - var $t5: &mut vector> + var $t3: &mut 0x42::test::Coin + var $t4: &mut 0x42::test::Wrapper<0x42::test::Coin> + var $t5: &mut vector<0x42::test::Wrapper<0x42::test::Coin>> var $t6: u256 var $t7: u256 var $t8: u8 0: $t5 := borrow_local($t0) - 1: $t4 := vector::borrow_mut>($t5, $t1) - 2: $t3 := borrow_field>.0($t4) - 3: $t2 := borrow_field.0($t3) + 1: $t4 := vector::borrow_mut<0x42::test::Wrapper<0x42::test::Coin>>($t5, $t1) + 2: $t3 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t4) + 3: $t2 := borrow_field<0x42::test::Coin>.0($t3) 4: $t7 := read_ref($t2) 5: $t8 := 1 6: $t6 := <<($t7, $t8) @@ -182,13 +249,13 @@ fun test::shl_vec_wrapped_coin_old($t0: vector>, $t1: [variant baseline] fun test::shr_coin_at($t0: address) { - var $t1: &mut test::Coin + var $t1: &mut 0x42::test::Coin var $t2: &mut u256 var $t3: u256 var $t4: u256 var $t5: u8 - 0: $t1 := borrow_global($t0) - 1: $t2 := borrow_field.0($t1) + 0: $t1 := borrow_global<0x42::test::Coin>($t0) + 1: $t2 := borrow_field<0x42::test::Coin>.0($t1) 2: $t4 := read_ref($t2) 3: $t5 := 1 4: $t3 := >>($t4, $t5) @@ -213,18 +280,18 @@ fun test::sub1($t0: &mut u256) { [variant baseline] -fun test::xor_vec_wrapped_coin_new($t0: vector>, $t1: u64) { +fun test::xor_vec_wrapped_coin_new($t0: vector<0x42::test::Wrapper<0x42::test::Coin>>, $t1: u64) { var $t2: &mut u256 - var $t3: &mut test::Coin - var $t4: &mut test::Wrapper - var $t5: &mut vector> + var $t3: &mut 0x42::test::Coin + var $t4: &mut 0x42::test::Wrapper<0x42::test::Coin> + var $t5: &mut vector<0x42::test::Wrapper<0x42::test::Coin>> var $t6: u256 var $t7: u256 var $t8: u256 0: $t5 := borrow_local($t0) - 1: $t4 := vector::borrow_mut>($t5, $t1) - 2: $t3 := borrow_field>.0($t4) - 3: $t2 := borrow_field.0($t3) + 1: $t4 := vector::borrow_mut<0x42::test::Wrapper<0x42::test::Coin>>($t5, $t1) + 2: $t3 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t4) + 3: $t2 := borrow_field<0x42::test::Coin>.0($t3) 4: $t7 := read_ref($t2) 5: $t8 := 1 6: $t6 := ^($t7, $t8) @@ -235,19 +302,19 @@ fun test::xor_vec_wrapped_coin_new($t0: vector>, $t1: ============ after LiveVarAnalysisProcessor: ================ [variant baseline] -fun test::bitand_vec_coin_new($t0: vector, $t1: u64) { +fun test::bitand_vec_coin_new($t0: vector<0x42::test::Coin>, $t1: u64) { var $t2: &mut u256 - var $t3: &mut test::Coin - var $t4: &mut vector + var $t3: &mut 0x42::test::Coin + var $t4: &mut vector<0x42::test::Coin> var $t5: u256 [unused] var $t6: u256 var $t7: u256 # live vars: $t0, $t1 0: $t4 := borrow_local($t0) # live vars: $t1, $t4 - 1: $t3 := vector::borrow_mut($t4, $t1) + 1: $t3 := vector::borrow_mut<0x42::test::Coin>($t4, $t1) # live vars: $t3 - 2: $t2 := borrow_field.0($t3) + 2: $t2 := borrow_field<0x42::test::Coin>.0($t3) # live vars: $t2 3: $t6 := read_ref($t2) # live vars: $t2, $t6 @@ -283,13 +350,13 @@ fun test::bitor_vec_new($t0: &mut vector, $t1: u64) { [variant baseline] -fun test::coin_double($t0: &mut test::Coin) { +fun test::coin_double($t0: &mut 0x42::test::Coin) { var $t1: &mut u256 var $t2: u256 [unused] var $t3: u256 var $t4: u256 # live vars: $t0 - 0: $t1 := borrow_field.0($t0) + 0: $t1 := borrow_field<0x42::test::Coin>.0($t0) # live vars: $t1 1: $t3 := read_ref($t1) # live vars: $t1, $t3 @@ -304,13 +371,13 @@ fun test::coin_double($t0: &mut test::Coin) { [variant baseline] -fun test::coin_mod_2($t0: &mut test::Coin) { +fun test::coin_mod_2($t0: &mut 0x42::test::Coin) { var $t1: &mut u256 var $t2: u256 [unused] var $t3: u256 var $t4: u256 # live vars: $t0 - 0: $t1 := borrow_field.0($t0) + 0: $t1 := borrow_field<0x42::test::Coin>.0($t0) # live vars: $t1 1: $t3 := read_ref($t1) # live vars: $t1, $t3 @@ -325,16 +392,16 @@ fun test::coin_mod_2($t0: &mut test::Coin) { [variant baseline] -fun test::half_wrapped_coin_new($t0: &mut test::Wrapper) { +fun test::half_wrapped_coin_new($t0: &mut 0x42::test::Wrapper<0x42::test::Coin>) { var $t1: &mut u256 - var $t2: &mut test::Coin + var $t2: &mut 0x42::test::Coin var $t3: u256 [unused] var $t4: u256 var $t5: u256 # live vars: $t0 - 0: $t2 := borrow_field>.0($t0) + 0: $t2 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t0) # live vars: $t2 - 1: $t1 := borrow_field.0($t2) + 1: $t1 := borrow_field<0x42::test::Coin>.0($t2) # live vars: $t1 2: $t4 := read_ref($t1) # live vars: $t1, $t4 @@ -349,22 +416,22 @@ fun test::half_wrapped_coin_new($t0: &mut test::Wrapper) { [variant baseline] -fun test::shl_vec_wrapped_coin_old($t0: vector>, $t1: u64) { +fun test::shl_vec_wrapped_coin_old($t0: vector<0x42::test::Wrapper<0x42::test::Coin>>, $t1: u64) { var $t2: &mut u256 - var $t3: &mut test::Coin - var $t4: &mut test::Wrapper - var $t5: &mut vector> + var $t3: &mut 0x42::test::Coin + var $t4: &mut 0x42::test::Wrapper<0x42::test::Coin> + var $t5: &mut vector<0x42::test::Wrapper<0x42::test::Coin>> var $t6: u256 [unused] var $t7: u256 var $t8: u8 # live vars: $t0, $t1 0: $t5 := borrow_local($t0) # live vars: $t1, $t5 - 1: $t4 := vector::borrow_mut>($t5, $t1) + 1: $t4 := vector::borrow_mut<0x42::test::Wrapper<0x42::test::Coin>>($t5, $t1) # live vars: $t4 - 2: $t3 := borrow_field>.0($t4) + 2: $t3 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t4) # live vars: $t3 - 3: $t2 := borrow_field.0($t3) + 3: $t2 := borrow_field<0x42::test::Coin>.0($t3) # live vars: $t2 4: $t7 := read_ref($t2) # live vars: $t2, $t7 @@ -380,15 +447,15 @@ fun test::shl_vec_wrapped_coin_old($t0: vector>, $t1: [variant baseline] fun test::shr_coin_at($t0: address) { - var $t1: &mut test::Coin + var $t1: &mut 0x42::test::Coin var $t2: &mut u256 var $t3: u256 [unused] var $t4: u256 var $t5: u8 # live vars: $t0 - 0: $t1 := borrow_global($t0) + 0: $t1 := borrow_global<0x42::test::Coin>($t0) # live vars: $t1 - 1: $t2 := borrow_field.0($t1) + 1: $t2 := borrow_field<0x42::test::Coin>.0($t1) # live vars: $t2 2: $t4 := read_ref($t2) # live vars: $t2, $t4 @@ -422,22 +489,22 @@ fun test::sub1($t0: &mut u256) { [variant baseline] -fun test::xor_vec_wrapped_coin_new($t0: vector>, $t1: u64) { +fun test::xor_vec_wrapped_coin_new($t0: vector<0x42::test::Wrapper<0x42::test::Coin>>, $t1: u64) { var $t2: &mut u256 - var $t3: &mut test::Coin - var $t4: &mut test::Wrapper - var $t5: &mut vector> + var $t3: &mut 0x42::test::Coin + var $t4: &mut 0x42::test::Wrapper<0x42::test::Coin> + var $t5: &mut vector<0x42::test::Wrapper<0x42::test::Coin>> var $t6: u256 [unused] var $t7: u256 var $t8: u256 # live vars: $t0, $t1 0: $t5 := borrow_local($t0) # live vars: $t1, $t5 - 1: $t4 := vector::borrow_mut>($t5, $t1) + 1: $t4 := vector::borrow_mut<0x42::test::Wrapper<0x42::test::Coin>>($t5, $t1) # live vars: $t4 - 2: $t3 := borrow_field>.0($t4) + 2: $t3 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t4) # live vars: $t3 - 3: $t2 := borrow_field.0($t3) + 3: $t2 := borrow_field<0x42::test::Coin>.0($t3) # live vars: $t2 4: $t7 := read_ref($t2) # live vars: $t2, $t7 diff --git a/third_party/move/move-compiler-v2/tests/op-equal/valid2.exp b/third_party/move/move-compiler-v2/tests/op-equal/valid2.exp index 772a9507ed263..e8c5f393627ac 100644 --- a/third_party/move/move-compiler-v2/tests/op-equal/valid2.exp +++ b/third_party/move/move-compiler-v2/tests/op-equal/valid2.exp @@ -3,38 +3,61 @@ module 0xc0ffee::m { struct S { x: u64, } - private fun foo(self: &mut m::S): u64 { + private fun foo(self: &mut S): u64 { { - let $t1: &mut u64 = Borrow(Mutable)(select m::S.x<&mut m::S>(self)); + let $t1: &mut u64 = Borrow(Mutable)(select m::S.x<&mut S>(self)); $t1 = Add(Deref($t1), 1) }; 1 } public fun test(): u64 { { - let s: m::S = pack m::S(0); + let s: S = pack m::S(0); { let $t2: u64 = m::foo(Borrow(Mutable)(s)); { - let $t1: &mut u64 = Borrow(Mutable)(select m::S.x(s)); + let $t1: &mut u64 = Borrow(Mutable)(select m::S.x(s)); $t1 = Add(Deref($t1), $t2) } }; - select m::S.x(s) + select m::S.x(s) } } } // end 0xc0ffee::m +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::m { + struct S has drop { + x: u64, + } + fun foo(self: &mut S): u64 { + { + let $t1 = &mut self.x; + *$t1 = *$t1 + 1 + }; + 1 + } + public fun test(): u64 { + let s = S{x: 0}; + { + let $t2 = foo(&mut s); + let $t1 = &mut s.x; + *$t1 = *$t1 + $t2 + }; + s.x + } +} + ============ initial bytecode ================ [variant baseline] -fun m::foo($t0: &mut m::S): u64 { +fun m::foo($t0: &mut 0xc0ffee::m::S): u64 { var $t1: u64 var $t2: &mut u64 var $t3: u64 var $t4: u64 var $t5: u64 - 0: $t2 := borrow_field.x($t0) + 0: $t2 := borrow_field<0xc0ffee::m::S>.x($t0) 1: $t4 := read_ref($t2) 2: $t5 := 1 3: $t3 := +($t4, $t5) @@ -47,27 +70,27 @@ fun m::foo($t0: &mut m::S): u64 { [variant baseline] public fun m::test(): u64 { var $t0: u64 - var $t1: m::S + var $t1: 0xc0ffee::m::S var $t2: u64 var $t3: u64 - var $t4: &mut m::S + var $t4: &mut 0xc0ffee::m::S var $t5: &mut u64 - var $t6: &mut m::S + var $t6: &mut 0xc0ffee::m::S var $t7: u64 var $t8: u64 - var $t9: &m::S + var $t9: &0xc0ffee::m::S var $t10: &u64 0: $t2 := 0 - 1: $t1 := pack m::S($t2) + 1: $t1 := pack 0xc0ffee::m::S($t2) 2: $t4 := borrow_local($t1) 3: $t3 := m::foo($t4) 4: $t6 := borrow_local($t1) - 5: $t5 := borrow_field.x($t6) + 5: $t5 := borrow_field<0xc0ffee::m::S>.x($t6) 6: $t8 := read_ref($t5) 7: $t7 := +($t8, $t3) 8: write_ref($t5, $t7) 9: $t9 := borrow_local($t1) - 10: $t10 := borrow_field.x($t9) + 10: $t10 := borrow_field<0xc0ffee::m::S>.x($t9) 11: $t0 := read_ref($t10) 12: return $t0 } @@ -75,14 +98,14 @@ public fun m::test(): u64 { ============ after LiveVarAnalysisProcessor: ================ [variant baseline] -fun m::foo($t0: &mut m::S): u64 { +fun m::foo($t0: &mut 0xc0ffee::m::S): u64 { var $t1: u64 [unused] var $t2: &mut u64 var $t3: u64 [unused] var $t4: u64 var $t5: u64 # live vars: $t0 - 0: $t2 := borrow_field.x($t0) + 0: $t2 := borrow_field<0xc0ffee::m::S>.x($t0) # live vars: $t2 1: $t4 := read_ref($t2) # live vars: $t2, $t4 @@ -101,20 +124,20 @@ fun m::foo($t0: &mut m::S): u64 { [variant baseline] public fun m::test(): u64 { var $t0: u64 [unused] - var $t1: m::S + var $t1: 0xc0ffee::m::S var $t2: u64 var $t3: u64 [unused] - var $t4: &mut m::S + var $t4: &mut 0xc0ffee::m::S var $t5: &mut u64 - var $t6: &mut m::S [unused] + var $t6: &mut 0xc0ffee::m::S [unused] var $t7: u64 [unused] var $t8: u64 - var $t9: &m::S + var $t9: &0xc0ffee::m::S var $t10: &u64 # live vars: 0: $t2 := 0 # live vars: $t2 - 1: $t1 := pack m::S($t2) + 1: $t1 := pack 0xc0ffee::m::S($t2) # live vars: $t1 2: $t4 := borrow_local($t1) # live vars: $t1, $t4 @@ -122,7 +145,7 @@ public fun m::test(): u64 { # live vars: $t1, $t2 4: $t4 := borrow_local($t1) # live vars: $t1, $t2, $t4 - 5: $t5 := borrow_field.x($t4) + 5: $t5 := borrow_field<0xc0ffee::m::S>.x($t4) # live vars: $t1, $t2, $t5 6: $t8 := read_ref($t5) # live vars: $t1, $t2, $t5, $t8 @@ -132,7 +155,7 @@ public fun m::test(): u64 { # live vars: $t1 9: $t9 := borrow_local($t1) # live vars: $t9 - 10: $t10 := borrow_field.x($t9) + 10: $t10 := borrow_field<0xc0ffee::m::S>.x($t9) # live vars: $t10 11: $t2 := read_ref($t10) # live vars: $t2 diff --git a/third_party/move/move-compiler-v2/tests/reference-safety/v1-borrow-tests/return_with_borrowed_loc_resource_invalid.exp b/third_party/move/move-compiler-v2/tests/reference-safety/v1-borrow-tests/return_with_borrowed_loc_resource_invalid.exp index 64d4f1e8ca18c..2845d31a0fb6f 100644 --- a/third_party/move/move-compiler-v2/tests/reference-safety/v1-borrow-tests/return_with_borrowed_loc_resource_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/reference-safety/v1-borrow-tests/return_with_borrowed_loc_resource_invalid.exp @@ -1,6 +1,6 @@ Diagnostics: -error: local `s` of type `M::X` does not have the `drop` ability +error: local `s` of type `X` does not have the `drop` ability ┌─ tests/reference-safety/v1-borrow-tests/return_with_borrowed_loc_resource_invalid.move:6:18 │ 6 │ let u = &s.u; diff --git a/third_party/move/move-compiler-v2/tests/reference-safety/v1-borrow-tests/return_with_borrowed_loc_resource_invalid.no-opt.exp b/third_party/move/move-compiler-v2/tests/reference-safety/v1-borrow-tests/return_with_borrowed_loc_resource_invalid.no-opt.exp index 64d4f1e8ca18c..2845d31a0fb6f 100644 --- a/third_party/move/move-compiler-v2/tests/reference-safety/v1-borrow-tests/return_with_borrowed_loc_resource_invalid.no-opt.exp +++ b/third_party/move/move-compiler-v2/tests/reference-safety/v1-borrow-tests/return_with_borrowed_loc_resource_invalid.no-opt.exp @@ -1,6 +1,6 @@ Diagnostics: -error: local `s` of type `M::X` does not have the `drop` ability +error: local `s` of type `X` does not have the `drop` ability ┌─ tests/reference-safety/v1-borrow-tests/return_with_borrowed_loc_resource_invalid.move:6:18 │ 6 │ let u = &s.u; diff --git a/third_party/move/move-compiler-v2/tests/reference-safety/v1-borrow-tests/return_with_borrowed_loc_resource_invalid.old.exp b/third_party/move/move-compiler-v2/tests/reference-safety/v1-borrow-tests/return_with_borrowed_loc_resource_invalid.old.exp index 64d4f1e8ca18c..2845d31a0fb6f 100644 --- a/third_party/move/move-compiler-v2/tests/reference-safety/v1-borrow-tests/return_with_borrowed_loc_resource_invalid.old.exp +++ b/third_party/move/move-compiler-v2/tests/reference-safety/v1-borrow-tests/return_with_borrowed_loc_resource_invalid.old.exp @@ -1,6 +1,6 @@ Diagnostics: -error: local `s` of type `M::X` does not have the `drop` ability +error: local `s` of type `X` does not have the `drop` ability ┌─ tests/reference-safety/v1-borrow-tests/return_with_borrowed_loc_resource_invalid.move:6:18 │ 6 │ let u = &s.u; diff --git a/third_party/move/move-compiler-v2/tests/simplifier-elimination/always_false_branch.exp b/third_party/move/move-compiler-v2/tests/simplifier-elimination/always_false_branch.exp index 1b0ab31f62f3e..51f43c5de7f9b 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier-elimination/always_false_branch.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier-elimination/always_false_branch.exp @@ -14,5 +14,17 @@ module 0xc0ffee::m { } } // end 0xc0ffee::m +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::m { + fun test(): u64 { + if (false) { + let i = 0; + i = i + 1; + return i + }; + 0 + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/simplifier-elimination/assign_unpack_references.exp b/third_party/move/move-compiler-v2/tests/simplifier-elimination/assign_unpack_references.exp index 338b267835624..ecbeecf5320d2 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier-elimination/assign_unpack_references.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier-elimination/assign_unpack_references.exp @@ -1,8 +1,8 @@ // -- Model dump before bytecode pipeline module 0x8675309::M { struct R { - s1: M::S, - s2: M::S, + s1: 0x8675309::M::S, + s2: 0x8675309::M::S, } struct S { f: u64, @@ -11,12 +11,12 @@ module 0x8675309::M { { let f: u64; { - let s2: M::S; + let s2: S; M::R{ s1: M::S{ f }, s2 } = pack M::R(pack M::S(0), pack M::S(1)); f; s2; f: u64 = 0; - s2: M::S = pack M::S(0); + s2: S = pack M::S(0); f; s2; Tuple() @@ -27,12 +27,12 @@ module 0x8675309::M { { let f: &u64; { - let s2: &M::S; + let s2: &S; M::R{ s1: M::S{ f }, s2 } = Borrow(Immutable)(pack M::R(pack M::S(0), pack M::S(1))); f; s2; f: &u64 = Borrow(Immutable)(0); - s2: &M::S = Borrow(Immutable)(pack M::S(0)); + s2: &S = Borrow(Immutable)(pack M::S(0)); f; s2; Tuple() @@ -43,12 +43,12 @@ module 0x8675309::M { { let f: &mut u64; { - let s2: &mut M::S; + let s2: &mut S; M::R{ s1: M::S{ f }, s2 } = Borrow(Mutable)(pack M::R(pack M::S(0), pack M::S(1))); f; s2; f: &mut u64 = Borrow(Mutable)(0); - s2: &mut M::S = Borrow(Mutable)(pack M::S(0)); + s2: &mut S = Borrow(Mutable)(pack M::S(0)); f; s2; Tuple() @@ -57,15 +57,59 @@ module 0x8675309::M { } } // end 0x8675309::M +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + s1: S, + s2: S, + } + struct S has drop { + f: u64, + } + fun t0() { + let f; + let s2; + R{s1: S{f: f},s2: s2} = R{s1: S{f: 0},s2: S{f: 1}}; + f; + s2; + f = 0; + s2 = S{f: 0}; + f; + s2; + } + fun t1() { + let f; + let s2; + R{s1: S{f: f},s2: s2} = &R{s1: S{f: 0},s2: S{f: 1}}; + f; + s2; + f = &0; + s2 = &S{f: 0}; + f; + s2; + } + fun t2() { + let f; + let s2; + R{s1: S{f: f},s2: s2} = &mut R{s1: S{f: 0},s2: S{f: 1}}; + f; + s2; + f = &mut 0; + s2 = &mut S{f: 0}; + f; + s2; + } +} + Diagnostics: -error: value of type `M::R` does not have the `drop` ability +error: value of type `R` does not have the `drop` ability ┌─ tests/simplifier-elimination/assign_unpack_references.move:17:33 │ 17 │ R { s1: S { f }, s2 } = &R { s1: S{f: 0}, s2: S{f: 1} }; f; s2; │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ still borrowed but will be implicitly dropped later since it is no longer used -error: value of type `M::R` does not have the `drop` ability +error: value of type `R` does not have the `drop` ability ┌─ tests/simplifier-elimination/assign_unpack_references.move:27:33 │ 27 │ R { s1: S { f }, s2 } = &mut R { s1: S{f: 0}, s2: S{f: 1} }; f; s2; diff --git a/third_party/move/move-compiler-v2/tests/simplifier-elimination/binary_add.exp b/third_party/move/move-compiler-v2/tests/simplifier-elimination/binary_add.exp index 2cf7745cb0aa4..bd4b2b38ac8da 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier-elimination/binary_add.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier-elimination/binary_add.exp @@ -53,10 +53,10 @@ module 0x8675309::M { struct R { f: u64, } - private fun t0(x: u64,r: M::R) { + private fun t0(x: u64,r: R) { Add(Copy(x), Move(x)); - Add(select M::R.f(r), select M::R.f(r)); - Add(Add(Add(1, select M::R.f(r)), select M::R.f(r)), 0); + Add(select M::R.f(r), select M::R.f(r)); + Add(Add(Add(1, select M::R.f(r)), select M::R.f(r)), 0); { let M::R{ f: _ } = r; Tuple() @@ -64,5 +64,18 @@ module 0x8675309::M { } } // end 0x8675309::M +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + f: u64, + } + fun t0(x: u64, r: R) { + (copy x) + (move x); + r.f + r.f; + 1 + r.f + r.f + 0; + let R{f: _} = r; + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/simplifier-elimination/bind_with_type_annot.exp b/third_party/move/move-compiler-v2/tests/simplifier-elimination/bind_with_type_annot.exp index 8568e22ecebc0..1f36cd2a23f36 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier-elimination/bind_with_type_annot.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier-elimination/bind_with_type_annot.exp @@ -31,12 +31,22 @@ module 0x8675309::M { } private fun t0() { { - let (x: u64, b: bool, M::R{ f }): (u64, bool, M::R) = Tuple(0, false, pack M::R(0)); + let (x: u64, b: bool, M::R{ f }): (u64, bool, R) = Tuple(0, false, pack M::R(0)); Tuple() } } } // end 0x8675309::M +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct R { + f: u64, + } + fun t0() { + let (x,b,R{f: f}) = (0, false, R{f: 0}); + } +} + Diagnostics: warning: Unused assignment to `f`. Consider removing or prefixing with an underscore: `_f` diff --git a/third_party/move/move-compiler-v2/tests/simplifier-elimination/constant_all_valid_types.exp b/third_party/move/move-compiler-v2/tests/simplifier-elimination/constant_all_valid_types.exp index a92a5c0f0eaca..ed3b1526f28c9 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier-elimination/constant_all_valid_types.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier-elimination/constant_all_valid_types.exp @@ -72,5 +72,34 @@ module _0 { } } // end _0 +// -- Sourcified model before bytecode pipeline +module 0x42::M { + fun t1(): u8 { + 0u8 + } + fun t2(): u64 { + 0 + } + fun t3(): u128 { + 0u128 + } + fun t4(): bool { + false + } + fun t5(): address { + 0x0 + } + fun t6(): vector { + vector[1u8, 35u8] + } + fun t7(): vector { + vector[97u8, 98u8, 99u8, 100u8] + } +} +script { + fun t() { + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/simplifier-elimination/double_nesting.exp b/third_party/move/move-compiler-v2/tests/simplifier-elimination/double_nesting.exp index 704e33333decc..013e348b7560a 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier-elimination/double_nesting.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier-elimination/double_nesting.exp @@ -22,5 +22,24 @@ module 0x42::test { } } // end 0x42::test +// -- Sourcified model before bytecode pipeline +module 0x42::mathtest2 { + public inline fun fun2(a: u64, b: u64, c: u64): u64 { + 7u128 * (a as u128) + 11u128 * (b as u128) + 13u128 * (c as u128) as u64 + } +} +module 0x42::mathtest { + public inline fun fun1(a: u64, b: u64, c: u64): u64 { + 2u128 * (a as u128) + 3u128 * (b as u128) + 5u128 * (c as u128) as u64 + } +} +module 0x42::test { + use 0x42::mathtest2; + use 0x42::mathtest; + fun test_nested_fun1() { + if (true) () else abort 0; + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/simplifier-elimination/else_assigns_if_doesnt.exp b/third_party/move/move-compiler-v2/tests/simplifier-elimination/else_assigns_if_doesnt.exp index 5341e02a3dceb..dc7f6f24d283d 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier-elimination/else_assigns_if_doesnt.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier-elimination/else_assigns_if_doesnt.exp @@ -24,6 +24,21 @@ module _0 { } } // end _0 +// -- Sourcified model before bytecode pipeline +script { + fun main() { + let x; + let y; + if (true) { + y = 0; + } else { + x = 42; + x; + }; + if (y == 0) () else abort 42; + } +} + Diagnostics: error: use of possibly unassigned local `y` diff --git a/third_party/move/move-compiler-v2/tests/simplifier-elimination/if_assigns_else_doesnt.exp b/third_party/move/move-compiler-v2/tests/simplifier-elimination/if_assigns_else_doesnt.exp index 60725545fcc86..5c7d031f7cbe2 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier-elimination/if_assigns_else_doesnt.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier-elimination/if_assigns_else_doesnt.exp @@ -24,6 +24,21 @@ module _0 { } } // end _0 +// -- Sourcified model before bytecode pipeline +script { + fun main() { + let x; + let y; + if (true) { + x = 42; + } else { + y = 0; + y; + }; + if (x == 42) () else abort 42; + } +} + Diagnostics: error: use of possibly unassigned local `x` diff --git a/third_party/move/move-compiler-v2/tests/simplifier-elimination/if_assigns_no_else.exp b/third_party/move/move-compiler-v2/tests/simplifier-elimination/if_assigns_no_else.exp index 73f3d514c0647..7d45092d77f72 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier-elimination/if_assigns_no_else.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier-elimination/if_assigns_no_else.exp @@ -25,5 +25,14 @@ module _0 { } } // end _0 +// -- Sourcified model before bytecode pipeline +script { + fun main() { + let x; + x = 42; + if (x == 42) () else abort 42; + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/simplifier-elimination/if_condition.exp b/third_party/move/move-compiler-v2/tests/simplifier-elimination/if_condition.exp index d78ee58957b72..564bc31ccabb0 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier-elimination/if_condition.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier-elimination/if_condition.exp @@ -54,5 +54,13 @@ module 0x8675309::M { } } // end 0x8675309::M +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + fun t0() { + } + fun t1() { + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/simplifier-elimination/moved_var_not_simplified.exp b/third_party/move/move-compiler-v2/tests/simplifier-elimination/moved_var_not_simplified.exp index 6541388dec1c1..5993472addce0 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier-elimination/moved_var_not_simplified.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier-elimination/moved_var_not_simplified.exp @@ -11,6 +11,15 @@ module 0xc0ffee::m { } } // end 0xc0ffee::m +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::m { + public fun test(): u8 { + let x = 40u8; + let y = move x; + x + y + } +} + Diagnostics: error: cannot move local `x` since it is still in use diff --git a/third_party/move/move-compiler-v2/tests/simplifier-elimination/moved_var_not_simplified2.exp b/third_party/move/move-compiler-v2/tests/simplifier-elimination/moved_var_not_simplified2.exp index e464e08c45a5e..d68aa02f51c4c 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier-elimination/moved_var_not_simplified2.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier-elimination/moved_var_not_simplified2.exp @@ -14,6 +14,16 @@ module 0xc0ffee::m { } } // end 0xc0ffee::m +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::m { + public fun test(): u8 { + let x = 40u8; + let y = move x; + let _z = x; + y + } +} + Diagnostics: error: cannot move local `x` since it is still in use diff --git a/third_party/move/move-compiler-v2/tests/simplifier-elimination/recursive_nesting.exp b/third_party/move/move-compiler-v2/tests/simplifier-elimination/recursive_nesting.exp index a7c00dc82c2a1..be3551312c2b4 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier-elimination/recursive_nesting.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier-elimination/recursive_nesting.exp @@ -39,5 +39,35 @@ module 0x42::test { } } // end 0x42::test +// -- Sourcified model before bytecode pipeline +module 0x42::mathtest { + public inline fun mul_div(a: u64, b: u64, c: u64): u64 { + (a as u128) * (b as u128) / (c as u128) as u64 + } +} +module 0x42::mathtest2 { + use 0x42::mathtest; + public inline fun mul_div2(a: u64, b: u64, c: u64): u64 { + let (a,b,c) = (b, a, c); + (a as u128) * (b as u128) / (c as u128) as u64 + } +} +module 0x42::mathtest3 { + use 0x42::mathtest2; + public inline fun mul_div3(a: u64, b: u64, c: u64): u64 { + let (a,b,c) = (b, a, c); + let (a,b,c) = (b, a, c); + (a as u128) * (b as u128) / (c as u128) as u64 + } +} +module 0x42::test { + use 0x42::mathtest; + use 0x42::mathtest2; + use 0x42::mathtest3; + fun test_nested_mul_div() { + if (true) () else abort 0; + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/simplifier-elimination/use_before_assign.exp b/third_party/move/move-compiler-v2/tests/simplifier-elimination/use_before_assign.exp index ac63e9d86f699..2cd3b3cdb5ccb 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier-elimination/use_before_assign.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier-elimination/use_before_assign.exp @@ -19,6 +19,14 @@ module _0 { } } // end _0 +// -- Sourcified model before bytecode pipeline +script { + fun main() { + let x; + let y = x; + } +} + Diagnostics: error: use of unassigned local `x` diff --git a/third_party/move/move-compiler-v2/tests/simplifier-elimination/use_before_assign_loop.exp b/third_party/move/move-compiler-v2/tests/simplifier-elimination/use_before_assign_loop.exp index 56337567699df..549cc95c615c2 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier-elimination/use_before_assign_loop.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier-elimination/use_before_assign_loop.exp @@ -64,6 +64,45 @@ module 0x8675309::M { } } // end 0x8675309::M +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + fun tborrow1() { + let x; + loop { + let y = &x; + _ = move y; + x = 0 + } + } + fun tborrow2(cond: bool) { + let x; + loop { + let y = &x; + _ = move y; + if (cond) x = 0; + break + }; + x; + } + fun tcopy(cond: bool) { + let x; + loop { + let y = x + 1; + if (cond) continue; + x = 0; + y; + } + } + fun tmove() { + let x; + loop { + let y = (move x) + 1; + x = 0; + y; + } + } +} + Diagnostics: error: use of possibly unassigned local `x` diff --git a/third_party/move/move-compiler-v2/tests/simplifier-elimination/use_before_assign_while.exp b/third_party/move/move-compiler-v2/tests/simplifier-elimination/use_before_assign_while.exp index 2152707901fdc..ee8a0531edccb 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier-elimination/use_before_assign_while.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier-elimination/use_before_assign_while.exp @@ -78,6 +78,44 @@ module 0x8675309::M { } } // end 0x8675309::M +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + fun tborrow1(cond: bool) { + let x; + while (cond) { + let y = &x; + _ = move y; + x = 0 + } + } + fun tborrow2(cond: bool) { + let x; + while (cond) { + let y = &x; + _ = move y; + if (cond) x = 0; + break + } + } + fun tcopy(cond: bool) { + let x; + while (cond) { + let y = (move x) + 1; + if (cond) continue; + x = 0; + y; + } + } + fun tmove(cond: bool) { + let x; + while (cond) { + let y = (move x) + 1; + x = 0; + y; + } + } +} + Diagnostics: error: use of possibly unassigned local `x` diff --git a/third_party/move/move-compiler-v2/tests/simplifier/bug_11112.exp b/third_party/move/move-compiler-v2/tests/simplifier/bug_11112.exp index 2d26e677fd493..fb79d81744afa 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier/bug_11112.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier/bug_11112.exp @@ -35,5 +35,26 @@ module 0xcafe::vectors { } } // end 0xcafe::vectors +// -- Sourcified model before bytecode pipeline +module 0xcafe::vectors { + fun test_for_each_mut() { + let v = vector[1, 2, 3]; + let s = 2; + { + let (v) = (&mut v); + let i = 0; + while (i < 0x1::vector::length(/*freeze*/v)) { + { + let (e) = (0x1::vector::borrow_mut(v, i)); + *e = s; + s = s + 1 + }; + i = i + 1 + } + }; + if (v == vector[2, 3, 4]) () else abort 0; + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/simplifier/conditional_borrow.exp b/third_party/move/move-compiler-v2/tests/simplifier/conditional_borrow.exp index fe3356ff35068..eb1d17caa267e 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier/conditional_borrow.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier/conditional_borrow.exp @@ -47,39 +47,39 @@ module 0x8675::M { } } } - private fun test1b(r: M::S): u64 { + private fun test1b(r: S): u64 { { - let x: M::S = pack M::S(3); + let x: S = pack M::S(3); { - let tref: &mut M::S = Borrow(Mutable)(if Lt(select M::S.f(r), 4) { + let tref: &mut S = Borrow(Mutable)(if Lt(select M::S.f(r), 4) { r } else { x }); - select M::S.f(Deref(tref)) = 10; + select M::S.f(Deref(tref)) = 10; { - let y: M::S = r; + let y: S = r; { - let tref2: &mut M::S = Borrow(Mutable)(y); - select M::S.f(Deref(tref2)) = Add(select M::S.f(Deref(tref2)), 1); + let tref2: &mut S = Borrow(Mutable)(y); + select M::S.f(Deref(tref2)) = Add(select M::S.f(Deref(tref2)), 1); { - let z: M::S = y; + let z: S = y; { - let tref3: &mut u64 = Borrow(Mutable)(select M::S.f(z)); + let tref3: &mut u64 = Borrow(Mutable)(select M::S.f(z)); tref3 = Add(Deref(tref3), 1); { - let a: M::S = z; + let a: S = z; { - let tref4: &mut u64 = Borrow(Mutable)(select M::S.f(a)); + let tref4: &mut u64 = Borrow(Mutable)(select M::S.f(a)); tref4 = Add(Deref(tref4), 1); { - let tref5: &mut u64 = Borrow(Mutable)(select M::S.f(a)); + let tref5: &mut u64 = Borrow(Mutable)(select M::S.f(a)); tref5 = Add(Deref(tref5), 8); { let tref6: &mut u64 = Borrow(Mutable)(3; - select M::S.f(a)); + select M::S.f(a)); tref6 = Add(Deref(tref6), 16); - select M::S.f(a) + select M::S.f(a) } } } @@ -96,5 +96,61 @@ module 0x8675::M { } } // end 0x8675::M +// -- Sourcified model before bytecode pipeline +module 0x8675::M { + struct S has copy, drop { + f: u64, + } + public fun test(): u64 { + test1(7) + test1(2) + } + fun test1(r: u64): u64 { + let tref = &mut (if (r < 4) r else 3); + *tref = 10; + let y = r; + let tref2 = &mut y; + *tref2 = *tref2 + 1; + let z = y; + let tref3 = &mut (z + 0); + *tref3 = *tref3 + 2; + let a = z; + let tref4 = &mut a; + *tref4 = *tref4 + 4; + let tref5 = &mut a; + *tref5 = *tref5 + 8; + let tref6 = &mut { + 3; + a + }; + *tref6 = *tref6 + 16; + a + } + fun test1b(r: S): u64 { + let x = S{f: 3}; + let tref = &mut (if (r.f < 4) r else x); + (*tref).f = 10; + let y = r; + let tref2 = &mut y; + (*tref2).f = (*tref2).f + 1; + let z = y; + let tref3 = &mut z.f; + *tref3 = *tref3 + 1; + let a = z; + let tref4 = &mut a.f; + *tref4 = *tref4 + 1; + let tref5 = &mut a.f; + *tref5 = *tref5 + 8; + let tref6 = &mut { + 3; + a.f + }; + *tref6 = *tref6 + 16; + a.f + } + public fun testb(): u64 { + test1b(S{f: 7}) + test1b(S{f: 2}) + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/simplifier/constant_folding_addresses.exp b/third_party/move/move-compiler-v2/tests/simplifier/constant_folding_addresses.exp index 4d021dd51d00d..e8ce9561931f2 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier/constant_folding_addresses.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier/constant_folding_addresses.exp @@ -11,5 +11,12 @@ module 0xcafe::Addresses { } } // end 0xcafe::Addresses +// -- Sourcified model before bytecode pipeline +module 0xcafe::Addresses { + public fun test() { + if (0x1::vector::length
(&vector[0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234, 0x1234]) == 1845) () else abort 1; + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/simplifier/constant_folding_ristretto.exp b/third_party/move/move-compiler-v2/tests/simplifier/constant_folding_ristretto.exp index bf7ddb3eda7a4..dfe310b087e21 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier/constant_folding_ristretto.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier/constant_folding_ristretto.exp @@ -10,5 +10,12 @@ module 0xcafe::Ristretto { } } // end 0xcafe::Ristretto +// -- Sourcified model before bytecode pipeline +module 0xcafe::Ristretto { + public fun test() { + if (true) () else abort 1; + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/simplifier/deep_exp.exp b/third_party/move/move-compiler-v2/tests/simplifier/deep_exp.exp index 5651a5e32c294..9d4e0ede67812 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier/deep_exp.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier/deep_exp.exp @@ -2930,5 +2930,2549 @@ module 0x42::Test { } } // end 0x42::Test +// -- Sourcified model before bytecode pipeline +module 0x42::Test { + inline fun f1(x: u64): u64 { + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + } + inline fun f2(x: u64): u64 { + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + } + inline fun f3(x: u64): u64 { + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + } + inline fun f4(x: u64): u64 { + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = ({ + let (x) = (x); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + }); + x + 1 + } + inline fun f5(x: u64): u64 { + x + 1 + } + public fun test(): u64 { + 625 + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/simplifier/moved_var_not_simplified.exp b/third_party/move/move-compiler-v2/tests/simplifier/moved_var_not_simplified.exp index 4e64252a12e5a..bba70e2914393 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier/moved_var_not_simplified.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier/moved_var_not_simplified.exp @@ -11,6 +11,15 @@ module 0xc0ffee::m { } } // end 0xc0ffee::m +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::m { + public fun test(): u8 { + let x = 40u8; + let y = move x; + x + y + } +} + Diagnostics: error: cannot move local `x` since it is still in use diff --git a/third_party/move/move-compiler-v2/tests/simplifier/moved_var_not_simplified2.exp b/third_party/move/move-compiler-v2/tests/simplifier/moved_var_not_simplified2.exp index 25ab7c17592e2..5e4a6305ef61b 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier/moved_var_not_simplified2.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier/moved_var_not_simplified2.exp @@ -14,6 +14,16 @@ module 0xc0ffee::m { } } // end 0xc0ffee::m +// -- Sourcified model before bytecode pipeline +module 0xc0ffee::m { + public fun test(): u8 { + let x = 40u8; + let y = move x; + let _z = x; + y + } +} + Diagnostics: error: cannot move local `x` since it is still in use diff --git a/third_party/move/move-compiler-v2/tests/simplifier/random.exp b/third_party/move/move-compiler-v2/tests/simplifier/random.exp index 89901686f6d2a..a5c62ea1ca5a5 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier/random.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier/random.exp @@ -12,10 +12,10 @@ module 0x8675::M { f: u64, g: u64, } - private fun id(r: �): � { + private fun id(r: &T): &T { r } - private fun id_mut(r: &mut #0): &mut #0 { + private fun id_mut(r: &mut T): &mut T { r } private inline fun iterloop(x: u64,y: &u64): u64 { @@ -143,6 +143,83 @@ module 0x8675::M { } } // end 0x8675::M +// -- Sourcified model before bytecode pipeline +module 0x8675::M { + struct S { + f: u64, + g: u64, + } + fun id(r: &T): &T { + r + } + fun id_mut(r: &mut T): &mut T { + r + } + inline fun iterloop(x: u64, y: &u64): u64 { + let r = x + 3; + while (x > 0) { + x = x - *y; + }; + r + x + } + fun t0() { + let v = 0; + let x = &mut v; + let y = &mut v; + *x; + *y; + if (v == 0) { + v = 3; + } else { + v = 2; + }; + let q = v; + let x = id_mut(&mut v); + let y = &mut v; + *x; + *y; + let x = &v; + let y = &mut v; + *y; + *x; + *y; + let x = &v; + let y = &v; + *x; + *y; + *x; + let x = id(&v); + let y = &v; + *x; + *y; + *x; + } + fun test1(r: u64): u64 { + let t = r; + let t2 = 0; + while (r > 0) { + let x = r; + r = r - 1; + t2 = t2 + x; + }; + let t3 = r + t + t2; + t3 + } + fun test1a(x: u64, r: &u64): u64 { + let t = *r; + let t3 = { + let (x,y) = (x, r); + let r = x + 3; + while (x > 0) { + x = x - *y; + }; + r + x + }; + let t2 = *r + t; + t2 + t3 + t + } +} + Diagnostics: warning: Unused assignment to `q`. Consider removing or prefixing with an underscore: `_q` diff --git a/third_party/move/move-compiler-v2/tests/simplifier/simplifier_test1.exp b/third_party/move/move-compiler-v2/tests/simplifier/simplifier_test1.exp index 17267d722a3a2..1b31a2726a83f 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier/simplifier_test1.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier/simplifier_test1.exp @@ -29,5 +29,23 @@ module 0x8675::M { } } // end 0x8675::M +// -- Sourcified model before bytecode pipeline +module 0x8675::M { + public fun test(): u64 { + test1(10) + } + fun test1(r: u64): u64 { + let t = r; + let t2 = 0; + while (r > 0) { + let x = r; + r = r - 1; + t2 = t2 + x; + }; + let t3 = r + t + t2; + t3 + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/simplifier/simplifier_test2.exp b/third_party/move/move-compiler-v2/tests/simplifier/simplifier_test2.exp index 761a7351a5fde..78ce707a0ac1e 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier/simplifier_test2.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier/simplifier_test2.exp @@ -53,5 +53,32 @@ module 0x8675::M { } } // end 0x8675::M +// -- Sourcified model before bytecode pipeline +module 0x8675::M { + public fun test(): u64 { + let (r) = (10); + let t = r; + let t2 = 0; + while (r > 0) { + let x = r; + r = r - 1; + t2 = t2 + x; + }; + let t3 = r + t + t2; + t3 + } + inline fun test1(r: u64): u64 { + let t = r; + let t2 = 0; + while (r > 0) { + let x = r; + r = r - 1; + t2 = t2 + x; + }; + let t3 = r + t + t2; + t3 + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/simplifier/simplifier_test3.exp b/third_party/move/move-compiler-v2/tests/simplifier/simplifier_test3.exp index be956d2fdd85f..8e06a6591f039 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier/simplifier_test3.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier/simplifier_test3.exp @@ -29,5 +29,24 @@ module 0x8675::M { } } // end 0x8675::M +// -- Sourcified model before bytecode pipeline +module 0x8675::M { + public fun test(): u64 { + test1(10) + } + fun test1(r: u64): u64 { + let t = r; + let t2 = 0; + while ({ + let x = r; + r = r - 1; + t2 = t2 + x; + r > 0 + }) (); + let t3 = r + t + t2; + t3 + } +} + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/simplifier/simplifier_test4.exp b/third_party/move/move-compiler-v2/tests/simplifier/simplifier_test4.exp index 66b1864dd5f27..8c31feee56126 100644 --- a/third_party/move/move-compiler-v2/tests/simplifier/simplifier_test4.exp +++ b/third_party/move/move-compiler-v2/tests/simplifier/simplifier_test4.exp @@ -6,20 +6,20 @@ module 0x8675309::M { private fun bar(_s: &mut u64,_u: u64) { Tuple() } - private fun foo(_s: &M::S,_u: u64) { + private fun foo(_s: &S,_u: u64) { Tuple() } - private fun t0(s: &mut M::S) { + private fun t0(s: &mut S) { { let x: u64 = 0; { let f: &mut u64 = x: u64 = Add(x, 1); - Borrow(Mutable)(select M::S.f<&mut M::S>(x: u64 = Add(x, 1); + Borrow(Mutable)(select M::S.f<&mut S>(x: u64 = Add(x, 1); 1; s)); if true { x: u64 = Add(x, 1); - M::foo(Freeze(true)(s), x: u64 = Add(x, 1); + M::foo(Freeze(true)(s), x: u64 = Add(x, 1); f = 0; 1) } else { @@ -34,12 +34,51 @@ module 0x8675309::M { } } } - private fun t1(s: &mut M::S) { - M::bar(Borrow(Mutable)(select M::S.f<&mut M::S>(s)), select M::S.f<&mut M::S>(s) = 0; + private fun t1(s: &mut S) { + M::bar(Borrow(Mutable)(select M::S.f<&mut S>(s)), select M::S.f<&mut S>(s) = 0; 1) } } // end 0x8675309::M +// -- Sourcified model before bytecode pipeline +module 0x8675309::M { + struct S { + f: u64, + } + fun bar(_s: &mut u64, _u: u64) { + } + fun foo(_s: &S, _u: u64) { + } + fun t0(s: &mut S) { + let x = 0; + let f = { + x = x + 1; + &mut { + x = x + 1; + 1; + s + }.f + }; + if (true) { + x = x + 1; + foo(/*freeze*/s, { + *{ + x = x + 1; + f + } = 0; + 1 + }) + } else x = x + 1; + if (x == 4) () else abort 0; + } + fun t1(s: &mut S) { + bar(&mut s.f, { + s.f = 0; + 1 + }) + } +} + Diagnostics: error: cannot freeze value which is still mutably borrowed diff --git a/third_party/move/move-compiler-v2/tests/testsuite.rs b/third_party/move/move-compiler-v2/tests/testsuite.rs index bbc988185007a..ba34279b86a38 100644 --- a/third_party/move/move-compiler-v2/tests/testsuite.rs +++ b/third_party/move/move-compiler-v2/tests/testsuite.rs @@ -11,7 +11,7 @@ use move_compiler_v2::{ logging, pipeline, plan_builder, run_bytecode_verifier, run_file_format_gen, Experiment, Options, }; -use move_model::{metadata::LanguageVersion, model::GlobalEnv}; +use move_model::{metadata::LanguageVersion, model::GlobalEnv, sourcifier::Sourcifier}; use move_prover_test_utils::{baseline_test, extract_test_directives}; use move_stackless_bytecode::function_target_pipeline::FunctionTargetPipeline; use once_cell::unsync::Lazy; @@ -799,6 +799,16 @@ fn run_test(path: &Path, config: TestConfig) -> datatest_stable::Result<()> { "// -- Model dump before bytecode pipeline\n{}\n", env.dump_env() )); + let sourcifier = Sourcifier::new(&env); + for module in env.get_modules() { + if module.is_primary_target() { + sourcifier.print_module(module.get_id()) + } + } + test_output.borrow_mut().push_str(&format!( + "// -- Sourcified model before bytecode pipeline\n{}\n", + sourcifier.result() + )); } } } diff --git a/third_party/move/move-compiler-v2/tests/uninit-use-checker/struct_use_before_assign.exp b/third_party/move/move-compiler-v2/tests/uninit-use-checker/struct_use_before_assign.exp index f343d5441ac03..a133044ef3459 100644 --- a/third_party/move/move-compiler-v2/tests/uninit-use-checker/struct_use_before_assign.exp +++ b/third_party/move/move-compiler-v2/tests/uninit-use-checker/struct_use_before_assign.exp @@ -53,15 +53,15 @@ warning: Unused local variable `q`. Consider removing or prefixing with an under [variant baseline] fun M::main() { var $t0: u64 - var $t1: M::R + var $t1: 0x876543::M::R var $t2: u64 var $t3: u64 var $t4: u64 var $t5: u64 var $t6: u64 0: $t2 := 3 - 1: $t1 := pack M::R($t2, $t0) - 2: ($t3, $t4) := unpack M::R($t1) + 1: $t1 := pack 0x876543::M::R($t2, $t0) + 2: ($t3, $t4) := unpack 0x876543::M::R($t1) 3: $t5 := infer($t4) 4: $t6 := infer($t3) 5: return () @@ -71,15 +71,15 @@ fun M::main() { [variant baseline] fun M::main2() { var $t0: u64 - var $t1: M::R + var $t1: 0x876543::M::R var $t2: u64 var $t3: u64 var $t4: u64 var $t5: u64 var $t6: u64 0: $t2 := 0 - 1: $t1 := pack M::R($t2, $t0) - 2: ($t3, $t4) := unpack M::R($t1) + 1: $t1 := pack 0x876543::M::R($t2, $t0) + 2: ($t3, $t4) := unpack 0x876543::M::R($t1) 3: $t5 := infer($t4) 4: $t6 := infer($t3) 5: return () @@ -88,12 +88,12 @@ fun M::main2() { [variant baseline] fun M::main3() { - var $t0: M::R + var $t0: 0x876543::M::R var $t1: u64 var $t2: u64 var $t3: u64 var $t4: u64 - 0: ($t1, $t2) := unpack M::R($t0) + 0: ($t1, $t2) := unpack 0x876543::M::R($t0) 1: $t3 := infer($t2) 2: $t4 := infer($t1) 3: return () @@ -148,7 +148,7 @@ error: use of unassigned local `x` [variant baseline] fun M::main() { var $t0: u64 - var $t1: M::R + var $t1: 0x876543::M::R var $t2: u64 var $t3: u64 var $t4: u64 @@ -157,9 +157,9 @@ fun M::main() { # before: { no: $t0, $t1, $t2, $t3, $t4, $t5, $t6 }, after: { no: $t0, $t1, $t3, $t4, $t5, $t6 } 0: $t2 := 3 # before: { no: $t0, $t1, $t3, $t4, $t5, $t6 }, after: { no: $t0, $t3, $t4, $t5, $t6 } - 1: $t1 := pack M::R($t2, $t0) + 1: $t1 := pack 0x876543::M::R($t2, $t0) # before: { no: $t0, $t3, $t4, $t5, $t6 }, after: { no: $t0, $t5, $t6 } - 2: ($t3, $t4) := unpack M::R($t1) + 2: ($t3, $t4) := unpack 0x876543::M::R($t1) # before: { no: $t0, $t5, $t6 }, after: { no: $t0, $t6 } 3: $t5 := infer($t4) # before: { no: $t0, $t6 }, after: { no: $t0 } @@ -172,7 +172,7 @@ fun M::main() { [variant baseline] fun M::main2() { var $t0: u64 - var $t1: M::R + var $t1: 0x876543::M::R var $t2: u64 var $t3: u64 var $t4: u64 @@ -181,9 +181,9 @@ fun M::main2() { # before: { no: $t0, $t1, $t2, $t3, $t4, $t5, $t6 }, after: { no: $t0, $t1, $t3, $t4, $t5, $t6 } 0: $t2 := 0 # before: { no: $t0, $t1, $t3, $t4, $t5, $t6 }, after: { no: $t0, $t3, $t4, $t5, $t6 } - 1: $t1 := pack M::R($t2, $t0) + 1: $t1 := pack 0x876543::M::R($t2, $t0) # before: { no: $t0, $t3, $t4, $t5, $t6 }, after: { no: $t0, $t5, $t6 } - 2: ($t3, $t4) := unpack M::R($t1) + 2: ($t3, $t4) := unpack 0x876543::M::R($t1) # before: { no: $t0, $t5, $t6 }, after: { no: $t0, $t6 } 3: $t5 := infer($t4) # before: { no: $t0, $t6 }, after: { no: $t0 } @@ -195,13 +195,13 @@ fun M::main2() { [variant baseline] fun M::main3() { - var $t0: M::R + var $t0: 0x876543::M::R var $t1: u64 var $t2: u64 var $t3: u64 var $t4: u64 # before: { no: $t0, $t1, $t2, $t3, $t4 }, after: { no: $t0, $t3, $t4 } - 0: ($t1, $t2) := unpack M::R($t0) + 0: ($t1, $t2) := unpack 0x876543::M::R($t0) # before: { no: $t0, $t3, $t4 }, after: { no: $t0, $t4 } 1: $t3 := infer($t2) # before: { no: $t0, $t4 }, after: { no: $t0 } diff --git a/third_party/move/move-compiler-v2/tests/uninit-use-checker/unused_reference.exp b/third_party/move/move-compiler-v2/tests/uninit-use-checker/unused_reference.exp index 1749474d122c6..0157525a3a232 100644 --- a/third_party/move/move-compiler-v2/tests/uninit-use-checker/unused_reference.exp +++ b/third_party/move/move-compiler-v2/tests/uninit-use-checker/unused_reference.exp @@ -2,8 +2,8 @@ [variant baseline] public fun Module0::function0() { - var $t0: &Module0::S - var $t1: Module0::S + var $t0: &0xcafe::Module0::S + var $t1: 0xcafe::Module0::S 0: $t1 := read_ref($t0) 1: return () } @@ -20,8 +20,8 @@ error: use of unassigned local `y` [variant baseline] public fun Module0::function0() { - var $t0: &Module0::S - var $t1: Module0::S + var $t0: &0xcafe::Module0::S + var $t1: 0xcafe::Module0::S # before: { no: $t0, $t1 }, after: { no: $t0 } 0: $t1 := read_ref($t0) # before: { no: $t0 }, after: { no: $t0 } diff --git a/third_party/move/move-compiler-v2/tests/uninit-use-checker/v1-locals/use_before_assign_simple.exp b/third_party/move/move-compiler-v2/tests/uninit-use-checker/v1-locals/use_before_assign_simple.exp index 89b580d92ae0c..46ecf613deaa7 100644 --- a/third_party/move/move-compiler-v2/tests/uninit-use-checker/v1-locals/use_before_assign_simple.exp +++ b/third_party/move/move-compiler-v2/tests/uninit-use-checker/v1-locals/use_before_assign_simple.exp @@ -5,8 +5,8 @@ fun M::tborrow() { var $t0: u64 var $t1: &u64 var $t2: &u64 - var $t3: M::S - var $t4: &M::S + var $t3: 0x8675309::M::S + var $t4: &0x8675309::M::S 0: $t1 := borrow_local($t0) 1: $t2 := infer($t1) 2: $t4 := borrow_local($t3) @@ -20,8 +20,8 @@ fun M::tcopy() { var $t1: u64 var $t2: u64 var $t3: u64 - var $t4: M::S - var $t5: M::S + var $t4: 0x8675309::M::S + var $t5: 0x8675309::M::S 0: $t2 := 1 1: $t1 := +($t0, $t2) 2: $t3 := infer($t1) @@ -37,8 +37,8 @@ fun M::tmove() { var $t2: u64 var $t3: u64 var $t4: u64 - var $t5: M::S - var $t6: M::S + var $t5: 0x8675309::M::S + var $t6: 0x8675309::M::S 0: $t2 := move($t0) 1: $t3 := 1 2: $t1 := +($t2, $t3) @@ -92,8 +92,8 @@ fun M::tborrow() { var $t0: u64 var $t1: &u64 var $t2: &u64 - var $t3: M::S - var $t4: &M::S + var $t3: 0x8675309::M::S + var $t4: &0x8675309::M::S # before: { no: $t0, $t1, $t2, $t3, $t4 }, after: { no: $t0, $t2, $t3, $t4 } 0: $t1 := borrow_local($t0) # before: { no: $t0, $t2, $t3, $t4 }, after: { no: $t0, $t3, $t4 } @@ -111,8 +111,8 @@ fun M::tcopy() { var $t1: u64 var $t2: u64 var $t3: u64 - var $t4: M::S - var $t5: M::S + var $t4: 0x8675309::M::S + var $t5: 0x8675309::M::S # before: { no: $t0, $t1, $t2, $t3, $t4, $t5 }, after: { no: $t0, $t1, $t3, $t4, $t5 } 0: $t2 := 1 # before: { no: $t0, $t1, $t3, $t4, $t5 }, after: { no: $t0, $t3, $t4, $t5 } @@ -133,8 +133,8 @@ fun M::tmove() { var $t2: u64 var $t3: u64 var $t4: u64 - var $t5: M::S - var $t6: M::S + var $t5: 0x8675309::M::S + var $t6: 0x8675309::M::S # before: { no: $t0, $t1, $t2, $t3, $t4, $t5, $t6 }, after: { no: $t0, $t1, $t3, $t4, $t5, $t6 } 0: $t2 := move($t0) # before: { no: $t0, $t1, $t3, $t4, $t5, $t6 }, after: { no: $t0, $t1, $t4, $t5, $t6 } diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_1.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_1.exp index 2f685d7e7352d..74ef544575ec3 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_1.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_1.exp @@ -7,7 +7,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -33,8 +33,8 @@ public fun m::test2($t0: u64) { [variant baseline] -public fun m::test3($t0: m::W) { - var $t1: m::W +public fun m::test3($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := infer($t0) 1: m::consume_($t0) 2: m::consume_($t1) @@ -43,8 +43,8 @@ public fun m::test3($t0: m::W) { [variant baseline] -public fun m::test4($t0: m::W) { - var $t1: m::W +public fun m::test4($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := infer($t0) 1: m::consume_($t1) 2: m::consume_($t0) @@ -60,7 +60,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -86,8 +86,8 @@ public fun m::test2($t0: u64) { [variant baseline] -public fun m::test3($t0: m::W) { - var $t1: m::W +public fun m::test3($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := copy($t0) 1: m::consume_($t0) 2: m::consume_($t1) @@ -96,8 +96,8 @@ public fun m::test3($t0: m::W) { [variant baseline] -public fun m::test4($t0: m::W) { - var $t1: m::W +public fun m::test4($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) @@ -115,7 +115,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { # live vars: $t0 # events: b:$t0, e:$t0 0: return () @@ -157,8 +157,8 @@ public fun m::test2($t0: u64) { [variant baseline] -public fun m::test3($t0: m::W) { - var $t1: m::W +public fun m::test3($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W # live vars: $t0 # events: b:$t0, b:$t1 0: $t1 := copy($t0) @@ -174,8 +174,8 @@ public fun m::test3($t0: m::W) { [variant baseline] -public fun m::test4($t0: m::W) { - var $t1: m::W +public fun m::test4($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W # live vars: $t0 # events: b:$t0, b:$t1 0: $t1 := copy($t0) @@ -198,7 +198,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -224,8 +224,8 @@ public fun m::test2($t0: u64) { [variant baseline] -public fun m::test3($t0: m::W) { - var $t1: m::W +public fun m::test3($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := copy($t0) 1: m::consume_($t0) 2: m::consume_($t1) @@ -234,8 +234,8 @@ public fun m::test3($t0: m::W) { [variant baseline] -public fun m::test4($t0: m::W) { - var $t1: m::W +public fun m::test4($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) @@ -251,7 +251,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -277,8 +277,8 @@ public fun m::test2($t0: u64) { [variant baseline] -public fun m::test3($t0: m::W) { - var $t1: m::W +public fun m::test3($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := copy($t0) 1: m::consume_($t0) 2: m::consume_($t1) @@ -287,8 +287,8 @@ public fun m::test3($t0: m::W) { [variant baseline] -public fun m::test4($t0: m::W) { - var $t1: m::W +public fun m::test4($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_1.opt.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_1.opt.exp index 2f685d7e7352d..74ef544575ec3 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_1.opt.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_1.opt.exp @@ -7,7 +7,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -33,8 +33,8 @@ public fun m::test2($t0: u64) { [variant baseline] -public fun m::test3($t0: m::W) { - var $t1: m::W +public fun m::test3($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := infer($t0) 1: m::consume_($t0) 2: m::consume_($t1) @@ -43,8 +43,8 @@ public fun m::test3($t0: m::W) { [variant baseline] -public fun m::test4($t0: m::W) { - var $t1: m::W +public fun m::test4($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := infer($t0) 1: m::consume_($t1) 2: m::consume_($t0) @@ -60,7 +60,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -86,8 +86,8 @@ public fun m::test2($t0: u64) { [variant baseline] -public fun m::test3($t0: m::W) { - var $t1: m::W +public fun m::test3($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := copy($t0) 1: m::consume_($t0) 2: m::consume_($t1) @@ -96,8 +96,8 @@ public fun m::test3($t0: m::W) { [variant baseline] -public fun m::test4($t0: m::W) { - var $t1: m::W +public fun m::test4($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) @@ -115,7 +115,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { # live vars: $t0 # events: b:$t0, e:$t0 0: return () @@ -157,8 +157,8 @@ public fun m::test2($t0: u64) { [variant baseline] -public fun m::test3($t0: m::W) { - var $t1: m::W +public fun m::test3($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W # live vars: $t0 # events: b:$t0, b:$t1 0: $t1 := copy($t0) @@ -174,8 +174,8 @@ public fun m::test3($t0: m::W) { [variant baseline] -public fun m::test4($t0: m::W) { - var $t1: m::W +public fun m::test4($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W # live vars: $t0 # events: b:$t0, b:$t1 0: $t1 := copy($t0) @@ -198,7 +198,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -224,8 +224,8 @@ public fun m::test2($t0: u64) { [variant baseline] -public fun m::test3($t0: m::W) { - var $t1: m::W +public fun m::test3($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := copy($t0) 1: m::consume_($t0) 2: m::consume_($t1) @@ -234,8 +234,8 @@ public fun m::test3($t0: m::W) { [variant baseline] -public fun m::test4($t0: m::W) { - var $t1: m::W +public fun m::test4($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) @@ -251,7 +251,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -277,8 +277,8 @@ public fun m::test2($t0: u64) { [variant baseline] -public fun m::test3($t0: m::W) { - var $t1: m::W +public fun m::test3($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := copy($t0) 1: m::consume_($t0) 2: m::consume_($t1) @@ -287,8 +287,8 @@ public fun m::test3($t0: m::W) { [variant baseline] -public fun m::test4($t0: m::W) { - var $t1: m::W +public fun m::test4($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_2.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_2.exp index d80d47d848cef..9467564dc9e2c 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_2.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_2.exp @@ -7,7 +7,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -23,8 +23,8 @@ public fun m::test1($t0: u64) { [variant baseline] -public fun m::test2($t0: m::W) { - var $t1: m::W +public fun m::test2($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := move($t0) 1: m::consume_($t1) 2: m::consume_($t1) @@ -40,7 +40,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -56,8 +56,8 @@ public fun m::test1($t0: u64) { [variant baseline] -public fun m::test2($t0: m::W) { - var $t1: m::W +public fun m::test2($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := move($t0) 1: m::consume_($t1) 2: m::consume_($t1) @@ -75,7 +75,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { # live vars: $t0 # events: b:$t0, e:$t0 0: return () @@ -99,8 +99,8 @@ public fun m::test1($t0: u64) { [variant baseline] -public fun m::test2($t0: m::W) { - var $t1: m::W +public fun m::test2($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W # live vars: $t0 # events: b:$t0, e:$t0, b:$t1 0: $t1 := move($t0) @@ -122,7 +122,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -138,8 +138,8 @@ public fun m::test1($t0: u64) { [variant baseline] -public fun m::test2($t0: m::W) { - var $t1: m::W [unused] +public fun m::test2($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W [unused] 0: $t0 := move($t0) 1: m::consume_($t0) 2: m::consume_($t0) @@ -155,7 +155,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -170,8 +170,8 @@ public fun m::test1($t0: u64) { [variant baseline] -public fun m::test2($t0: m::W) { - var $t1: m::W [unused] +public fun m::test2($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W [unused] 0: m::consume_($t0) 1: m::consume_($t0) 2: return () diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_2.opt.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_2.opt.exp index d80d47d848cef..9467564dc9e2c 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_2.opt.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_2.opt.exp @@ -7,7 +7,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -23,8 +23,8 @@ public fun m::test1($t0: u64) { [variant baseline] -public fun m::test2($t0: m::W) { - var $t1: m::W +public fun m::test2($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := move($t0) 1: m::consume_($t1) 2: m::consume_($t1) @@ -40,7 +40,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -56,8 +56,8 @@ public fun m::test1($t0: u64) { [variant baseline] -public fun m::test2($t0: m::W) { - var $t1: m::W +public fun m::test2($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := move($t0) 1: m::consume_($t1) 2: m::consume_($t1) @@ -75,7 +75,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { # live vars: $t0 # events: b:$t0, e:$t0 0: return () @@ -99,8 +99,8 @@ public fun m::test1($t0: u64) { [variant baseline] -public fun m::test2($t0: m::W) { - var $t1: m::W +public fun m::test2($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W # live vars: $t0 # events: b:$t0, e:$t0, b:$t1 0: $t1 := move($t0) @@ -122,7 +122,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -138,8 +138,8 @@ public fun m::test1($t0: u64) { [variant baseline] -public fun m::test2($t0: m::W) { - var $t1: m::W [unused] +public fun m::test2($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W [unused] 0: $t0 := move($t0) 1: m::consume_($t0) 2: m::consume_($t0) @@ -155,7 +155,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -170,8 +170,8 @@ public fun m::test1($t0: u64) { [variant baseline] -public fun m::test2($t0: m::W) { - var $t1: m::W [unused] +public fun m::test2($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W [unused] 0: m::consume_($t0) 1: m::consume_($t0) 2: return () diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_3.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_3.exp index 606dd277acd0c..7ecc0e6a884b1 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_3.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_3.exp @@ -7,7 +7,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -23,8 +23,8 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_($t0: m::W) { - var $t1: m::W +public fun m::test_($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) @@ -40,7 +40,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -56,8 +56,8 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_($t0: m::W) { - var $t1: m::W +public fun m::test_($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) @@ -75,7 +75,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { # live vars: $t0 # events: b:$t0, e:$t0 0: return () @@ -100,8 +100,8 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_($t0: m::W) { - var $t1: m::W +public fun m::test_($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W # live vars: $t0 # events: b:$t0, b:$t1 0: $t1 := copy($t0) @@ -124,7 +124,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -140,8 +140,8 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_($t0: m::W) { - var $t1: m::W +public fun m::test_($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) @@ -157,7 +157,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -173,8 +173,8 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_($t0: m::W) { - var $t1: m::W +public fun m::test_($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_3.opt.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_3.opt.exp index 606dd277acd0c..7ecc0e6a884b1 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_3.opt.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_3.opt.exp @@ -7,7 +7,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -23,8 +23,8 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_($t0: m::W) { - var $t1: m::W +public fun m::test_($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) @@ -40,7 +40,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -56,8 +56,8 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_($t0: m::W) { - var $t1: m::W +public fun m::test_($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) @@ -75,7 +75,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { # live vars: $t0 # events: b:$t0, e:$t0 0: return () @@ -100,8 +100,8 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_($t0: m::W) { - var $t1: m::W +public fun m::test_($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W # live vars: $t0 # events: b:$t0, b:$t1 0: $t1 := copy($t0) @@ -124,7 +124,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -140,8 +140,8 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_($t0: m::W) { - var $t1: m::W +public fun m::test_($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) @@ -157,7 +157,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -173,8 +173,8 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_($t0: m::W) { - var $t1: m::W +public fun m::test_($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_4.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_4.exp index 0c6d1f781f678..f2b1a0c6caaf7 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_4.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_4.exp @@ -7,7 +7,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -25,9 +25,9 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_struct($t0: m::W) { - var $t1: m::W - var $t2: m::W +public fun m::test_struct($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W + var $t2: 0xc0ffee::m::W 0: $t1 := copy($t0) 1: $t2 := move($t1) 2: m::consume_($t2) @@ -44,7 +44,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -62,9 +62,9 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_struct($t0: m::W) { - var $t1: m::W - var $t2: m::W +public fun m::test_struct($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W + var $t2: 0xc0ffee::m::W 0: $t1 := copy($t0) 1: $t2 := move($t1) 2: m::consume_($t2) @@ -83,7 +83,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { # live vars: $t0 # events: b:$t0, e:$t0 0: return () @@ -112,9 +112,9 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_struct($t0: m::W) { - var $t1: m::W - var $t2: m::W +public fun m::test_struct($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W + var $t2: 0xc0ffee::m::W # live vars: $t0 # events: b:$t0, b:$t1 0: $t1 := copy($t0) @@ -140,7 +140,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -158,9 +158,9 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_struct($t0: m::W) { - var $t1: m::W - var $t2: m::W [unused] +public fun m::test_struct($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W + var $t2: 0xc0ffee::m::W [unused] 0: $t1 := copy($t0) 1: $t1 := move($t1) 2: m::consume_($t1) @@ -177,7 +177,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -194,9 +194,9 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_struct($t0: m::W) { - var $t1: m::W - var $t2: m::W [unused] +public fun m::test_struct($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W + var $t2: 0xc0ffee::m::W [unused] 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_4.opt.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_4.opt.exp index 0c6d1f781f678..f2b1a0c6caaf7 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_4.opt.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_4.opt.exp @@ -7,7 +7,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -25,9 +25,9 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_struct($t0: m::W) { - var $t1: m::W - var $t2: m::W +public fun m::test_struct($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W + var $t2: 0xc0ffee::m::W 0: $t1 := copy($t0) 1: $t2 := move($t1) 2: m::consume_($t2) @@ -44,7 +44,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -62,9 +62,9 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_struct($t0: m::W) { - var $t1: m::W - var $t2: m::W +public fun m::test_struct($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W + var $t2: 0xc0ffee::m::W 0: $t1 := copy($t0) 1: $t2 := move($t1) 2: m::consume_($t2) @@ -83,7 +83,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { # live vars: $t0 # events: b:$t0, e:$t0 0: return () @@ -112,9 +112,9 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_struct($t0: m::W) { - var $t1: m::W - var $t2: m::W +public fun m::test_struct($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W + var $t2: 0xc0ffee::m::W # live vars: $t0 # events: b:$t0, b:$t1 0: $t1 := copy($t0) @@ -140,7 +140,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -158,9 +158,9 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_struct($t0: m::W) { - var $t1: m::W - var $t2: m::W [unused] +public fun m::test_struct($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W + var $t2: 0xc0ffee::m::W [unused] 0: $t1 := copy($t0) 1: $t1 := move($t1) 2: m::consume_($t1) @@ -177,7 +177,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -194,9 +194,9 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_struct($t0: m::W) { - var $t1: m::W - var $t2: m::W [unused] +public fun m::test_struct($t0: 0xc0ffee::m::W) { + var $t1: 0xc0ffee::m::W + var $t2: 0xc0ffee::m::W [unused] 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_5.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_5.exp index 77bfd28f9ff4c..1c5c097d9e7c9 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_5.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_5.exp @@ -7,7 +7,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -37,8 +37,8 @@ public fun m::test($t0: bool, $t1: u32) { [variant baseline] -public fun m::test_struct($t0: bool, $t1: m::W) { - var $t2: m::W +public fun m::test_struct($t0: bool, $t1: 0xc0ffee::m::W) { + var $t2: 0xc0ffee::m::W var $t3: bool 0: $t2 := copy($t1) 1: if ($t0) goto 2 else goto 5 @@ -68,7 +68,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -98,8 +98,8 @@ public fun m::test($t0: bool, $t1: u32) { [variant baseline] -public fun m::test_struct($t0: bool, $t1: m::W) { - var $t2: m::W +public fun m::test_struct($t0: bool, $t1: 0xc0ffee::m::W) { + var $t2: 0xc0ffee::m::W var $t3: bool 0: $t2 := copy($t1) 1: if ($t0) goto 2 else goto 14 @@ -131,7 +131,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { # live vars: $t0 # events: b:$t0, e:$t0 0: return () @@ -184,8 +184,8 @@ public fun m::test($t0: bool, $t1: u32) { [variant baseline] -public fun m::test_struct($t0: bool, $t1: m::W) { - var $t2: m::W +public fun m::test_struct($t0: bool, $t1: 0xc0ffee::m::W) { + var $t2: 0xc0ffee::m::W var $t3: bool # live vars: $t0, $t1 # events: b:$t0, b:$t1, b:$t2 @@ -236,7 +236,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -266,8 +266,8 @@ public fun m::test($t0: bool, $t1: u32) { [variant baseline] -public fun m::test_struct($t0: bool, $t1: m::W) { - var $t2: m::W +public fun m::test_struct($t0: bool, $t1: 0xc0ffee::m::W) { + var $t2: 0xc0ffee::m::W var $t3: bool 0: $t2 := copy($t1) 1: if ($t0) goto 2 else goto 14 @@ -297,7 +297,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -327,8 +327,8 @@ public fun m::test($t0: bool, $t1: u32) { [variant baseline] -public fun m::test_struct($t0: bool, $t1: m::W) { - var $t2: m::W +public fun m::test_struct($t0: bool, $t1: 0xc0ffee::m::W) { + var $t2: 0xc0ffee::m::W var $t3: bool 0: $t2 := copy($t1) 1: if ($t0) goto 2 else goto 14 diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_5.opt.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_5.opt.exp index 77bfd28f9ff4c..1c5c097d9e7c9 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_5.opt.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_5.opt.exp @@ -7,7 +7,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -37,8 +37,8 @@ public fun m::test($t0: bool, $t1: u32) { [variant baseline] -public fun m::test_struct($t0: bool, $t1: m::W) { - var $t2: m::W +public fun m::test_struct($t0: bool, $t1: 0xc0ffee::m::W) { + var $t2: 0xc0ffee::m::W var $t3: bool 0: $t2 := copy($t1) 1: if ($t0) goto 2 else goto 5 @@ -68,7 +68,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -98,8 +98,8 @@ public fun m::test($t0: bool, $t1: u32) { [variant baseline] -public fun m::test_struct($t0: bool, $t1: m::W) { - var $t2: m::W +public fun m::test_struct($t0: bool, $t1: 0xc0ffee::m::W) { + var $t2: 0xc0ffee::m::W var $t3: bool 0: $t2 := copy($t1) 1: if ($t0) goto 2 else goto 14 @@ -131,7 +131,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { # live vars: $t0 # events: b:$t0, e:$t0 0: return () @@ -184,8 +184,8 @@ public fun m::test($t0: bool, $t1: u32) { [variant baseline] -public fun m::test_struct($t0: bool, $t1: m::W) { - var $t2: m::W +public fun m::test_struct($t0: bool, $t1: 0xc0ffee::m::W) { + var $t2: 0xc0ffee::m::W var $t3: bool # live vars: $t0, $t1 # events: b:$t0, b:$t1, b:$t2 @@ -236,7 +236,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -266,8 +266,8 @@ public fun m::test($t0: bool, $t1: u32) { [variant baseline] -public fun m::test_struct($t0: bool, $t1: m::W) { - var $t2: m::W +public fun m::test_struct($t0: bool, $t1: 0xc0ffee::m::W) { + var $t2: 0xc0ffee::m::W var $t3: bool 0: $t2 := copy($t1) 1: if ($t0) goto 2 else goto 14 @@ -297,7 +297,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: m::W) { +fun m::consume_($t0: 0xc0ffee::m::W) { 0: return () } @@ -327,8 +327,8 @@ public fun m::test($t0: bool, $t1: u32) { [variant baseline] -public fun m::test_struct($t0: bool, $t1: m::W) { - var $t2: m::W +public fun m::test_struct($t0: bool, $t1: 0xc0ffee::m::W) { + var $t2: 0xc0ffee::m::W var $t3: bool 0: $t2 := copy($t1) 1: if ($t0) goto 2 else goto 14 diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/mut_refs_2.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/mut_refs_2.exp index 1a59b3c7f2a73..1b05ff1d6aaec 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/mut_refs_2.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/mut_refs_2.exp @@ -1,23 +1,23 @@ ============ initial bytecode ================ [variant baseline] -fun m::test($t0: m::S): u64 { +fun m::test($t0: 0xc0ffee::m::S): u64 { var $t1: u64 - var $t2: m::S - var $t3: m::S + var $t2: 0xc0ffee::m::S + var $t3: 0xc0ffee::m::S var $t4: &mut u64 - var $t5: &mut m::S + var $t5: &mut 0xc0ffee::m::S var $t6: u64 - var $t7: &m::S + var $t7: &0xc0ffee::m::S var $t8: &u64 0: $t2 := infer($t0) 1: $t3 := infer($t2) 2: $t5 := borrow_local($t2) - 3: $t4 := borrow_field.a($t5) + 3: $t4 := borrow_field<0xc0ffee::m::S>.a($t5) 4: $t6 := 0 5: write_ref($t4, $t6) 6: $t7 := borrow_local($t3) - 7: $t8 := borrow_field.a($t7) + 7: $t8 := borrow_field<0xc0ffee::m::S>.a($t7) 8: $t1 := read_ref($t8) 9: return $t1 } @@ -25,23 +25,23 @@ fun m::test($t0: m::S): u64 { ============ after DeadStoreElimination: ================ [variant baseline] -fun m::test($t0: m::S): u64 { +fun m::test($t0: 0xc0ffee::m::S): u64 { var $t1: u64 - var $t2: m::S - var $t3: m::S + var $t2: 0xc0ffee::m::S + var $t3: 0xc0ffee::m::S var $t4: &mut u64 - var $t5: &mut m::S + var $t5: &mut 0xc0ffee::m::S var $t6: u64 - var $t7: &m::S + var $t7: &0xc0ffee::m::S var $t8: &u64 0: $t2 := move($t0) 1: $t3 := copy($t2) 2: $t5 := borrow_local($t2) - 3: $t4 := borrow_field.a($t5) + 3: $t4 := borrow_field<0xc0ffee::m::S>.a($t5) 4: $t6 := 0 5: write_ref($t4, $t6) 6: $t7 := borrow_local($t3) - 7: $t8 := borrow_field.a($t7) + 7: $t8 := borrow_field<0xc0ffee::m::S>.a($t7) 8: $t1 := read_ref($t8) 9: return $t1 } @@ -49,14 +49,14 @@ fun m::test($t0: m::S): u64 { ============ after VariableCoalescingAnnotator: ================ [variant baseline] -fun m::test($t0: m::S): u64 { +fun m::test($t0: 0xc0ffee::m::S): u64 { var $t1: u64 - var $t2: m::S - var $t3: m::S + var $t2: 0xc0ffee::m::S + var $t3: 0xc0ffee::m::S var $t4: &mut u64 - var $t5: &mut m::S + var $t5: &mut 0xc0ffee::m::S var $t6: u64 - var $t7: &m::S + var $t7: &0xc0ffee::m::S var $t8: &u64 # live vars: $t0 # events: b:$t0, e:$t0 @@ -68,7 +68,7 @@ fun m::test($t0: m::S): u64 { 2: $t5 := borrow_local($t2) # live vars: $t3, $t5 # events: e:$t5, b:$t4 - 3: $t4 := borrow_field.a($t5) + 3: $t4 := borrow_field<0xc0ffee::m::S>.a($t5) # live vars: $t3, $t4 # events: b:$t6 4: $t6 := 0 @@ -80,7 +80,7 @@ fun m::test($t0: m::S): u64 { 6: $t7 := borrow_local($t3) # live vars: $t7 # events: e:$t7, b:$t8 - 7: $t8 := borrow_field.a($t7) + 7: $t8 := borrow_field<0xc0ffee::m::S>.a($t7) # live vars: $t8 # events: e:$t8, b:$t1 8: $t1 := read_ref($t8) @@ -92,23 +92,23 @@ fun m::test($t0: m::S): u64 { ============ after VariableCoalescingTransformer: ================ [variant baseline] -fun m::test($t0: m::S): u64 { +fun m::test($t0: 0xc0ffee::m::S): u64 { var $t1: u64 [unused] - var $t2: m::S - var $t3: m::S + var $t2: 0xc0ffee::m::S + var $t3: 0xc0ffee::m::S var $t4: &mut u64 - var $t5: &mut m::S + var $t5: &mut 0xc0ffee::m::S var $t6: u64 - var $t7: &m::S + var $t7: &0xc0ffee::m::S var $t8: &u64 0: $t2 := move($t0) 1: $t3 := copy($t2) 2: $t5 := borrow_local($t2) - 3: $t4 := borrow_field.a($t5) + 3: $t4 := borrow_field<0xc0ffee::m::S>.a($t5) 4: $t6 := 0 5: write_ref($t4, $t6) 6: $t7 := borrow_local($t3) - 7: $t8 := borrow_field.a($t7) + 7: $t8 := borrow_field<0xc0ffee::m::S>.a($t7) 8: $t6 := read_ref($t8) 9: return $t6 } @@ -116,23 +116,23 @@ fun m::test($t0: m::S): u64 { ============ after DeadStoreElimination: ================ [variant baseline] -fun m::test($t0: m::S): u64 { +fun m::test($t0: 0xc0ffee::m::S): u64 { var $t1: u64 [unused] - var $t2: m::S - var $t3: m::S + var $t2: 0xc0ffee::m::S + var $t3: 0xc0ffee::m::S var $t4: &mut u64 - var $t5: &mut m::S + var $t5: &mut 0xc0ffee::m::S var $t6: u64 - var $t7: &m::S + var $t7: &0xc0ffee::m::S var $t8: &u64 0: $t2 := move($t0) 1: $t3 := copy($t2) 2: $t5 := borrow_local($t2) - 3: $t4 := borrow_field.a($t5) + 3: $t4 := borrow_field<0xc0ffee::m::S>.a($t5) 4: $t6 := 0 5: write_ref($t4, $t6) 6: $t7 := borrow_local($t3) - 7: $t8 := borrow_field.a($t7) + 7: $t8 := borrow_field<0xc0ffee::m::S>.a($t7) 8: $t6 := read_ref($t8) 9: return $t6 } diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/mut_refs_2.opt.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/mut_refs_2.opt.exp index 1a59b3c7f2a73..1b05ff1d6aaec 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/mut_refs_2.opt.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/mut_refs_2.opt.exp @@ -1,23 +1,23 @@ ============ initial bytecode ================ [variant baseline] -fun m::test($t0: m::S): u64 { +fun m::test($t0: 0xc0ffee::m::S): u64 { var $t1: u64 - var $t2: m::S - var $t3: m::S + var $t2: 0xc0ffee::m::S + var $t3: 0xc0ffee::m::S var $t4: &mut u64 - var $t5: &mut m::S + var $t5: &mut 0xc0ffee::m::S var $t6: u64 - var $t7: &m::S + var $t7: &0xc0ffee::m::S var $t8: &u64 0: $t2 := infer($t0) 1: $t3 := infer($t2) 2: $t5 := borrow_local($t2) - 3: $t4 := borrow_field.a($t5) + 3: $t4 := borrow_field<0xc0ffee::m::S>.a($t5) 4: $t6 := 0 5: write_ref($t4, $t6) 6: $t7 := borrow_local($t3) - 7: $t8 := borrow_field.a($t7) + 7: $t8 := borrow_field<0xc0ffee::m::S>.a($t7) 8: $t1 := read_ref($t8) 9: return $t1 } @@ -25,23 +25,23 @@ fun m::test($t0: m::S): u64 { ============ after DeadStoreElimination: ================ [variant baseline] -fun m::test($t0: m::S): u64 { +fun m::test($t0: 0xc0ffee::m::S): u64 { var $t1: u64 - var $t2: m::S - var $t3: m::S + var $t2: 0xc0ffee::m::S + var $t3: 0xc0ffee::m::S var $t4: &mut u64 - var $t5: &mut m::S + var $t5: &mut 0xc0ffee::m::S var $t6: u64 - var $t7: &m::S + var $t7: &0xc0ffee::m::S var $t8: &u64 0: $t2 := move($t0) 1: $t3 := copy($t2) 2: $t5 := borrow_local($t2) - 3: $t4 := borrow_field.a($t5) + 3: $t4 := borrow_field<0xc0ffee::m::S>.a($t5) 4: $t6 := 0 5: write_ref($t4, $t6) 6: $t7 := borrow_local($t3) - 7: $t8 := borrow_field.a($t7) + 7: $t8 := borrow_field<0xc0ffee::m::S>.a($t7) 8: $t1 := read_ref($t8) 9: return $t1 } @@ -49,14 +49,14 @@ fun m::test($t0: m::S): u64 { ============ after VariableCoalescingAnnotator: ================ [variant baseline] -fun m::test($t0: m::S): u64 { +fun m::test($t0: 0xc0ffee::m::S): u64 { var $t1: u64 - var $t2: m::S - var $t3: m::S + var $t2: 0xc0ffee::m::S + var $t3: 0xc0ffee::m::S var $t4: &mut u64 - var $t5: &mut m::S + var $t5: &mut 0xc0ffee::m::S var $t6: u64 - var $t7: &m::S + var $t7: &0xc0ffee::m::S var $t8: &u64 # live vars: $t0 # events: b:$t0, e:$t0 @@ -68,7 +68,7 @@ fun m::test($t0: m::S): u64 { 2: $t5 := borrow_local($t2) # live vars: $t3, $t5 # events: e:$t5, b:$t4 - 3: $t4 := borrow_field.a($t5) + 3: $t4 := borrow_field<0xc0ffee::m::S>.a($t5) # live vars: $t3, $t4 # events: b:$t6 4: $t6 := 0 @@ -80,7 +80,7 @@ fun m::test($t0: m::S): u64 { 6: $t7 := borrow_local($t3) # live vars: $t7 # events: e:$t7, b:$t8 - 7: $t8 := borrow_field.a($t7) + 7: $t8 := borrow_field<0xc0ffee::m::S>.a($t7) # live vars: $t8 # events: e:$t8, b:$t1 8: $t1 := read_ref($t8) @@ -92,23 +92,23 @@ fun m::test($t0: m::S): u64 { ============ after VariableCoalescingTransformer: ================ [variant baseline] -fun m::test($t0: m::S): u64 { +fun m::test($t0: 0xc0ffee::m::S): u64 { var $t1: u64 [unused] - var $t2: m::S - var $t3: m::S + var $t2: 0xc0ffee::m::S + var $t3: 0xc0ffee::m::S var $t4: &mut u64 - var $t5: &mut m::S + var $t5: &mut 0xc0ffee::m::S var $t6: u64 - var $t7: &m::S + var $t7: &0xc0ffee::m::S var $t8: &u64 0: $t2 := move($t0) 1: $t3 := copy($t2) 2: $t5 := borrow_local($t2) - 3: $t4 := borrow_field.a($t5) + 3: $t4 := borrow_field<0xc0ffee::m::S>.a($t5) 4: $t6 := 0 5: write_ref($t4, $t6) 6: $t7 := borrow_local($t3) - 7: $t8 := borrow_field.a($t7) + 7: $t8 := borrow_field<0xc0ffee::m::S>.a($t7) 8: $t6 := read_ref($t8) 9: return $t6 } @@ -116,23 +116,23 @@ fun m::test($t0: m::S): u64 { ============ after DeadStoreElimination: ================ [variant baseline] -fun m::test($t0: m::S): u64 { +fun m::test($t0: 0xc0ffee::m::S): u64 { var $t1: u64 [unused] - var $t2: m::S - var $t3: m::S + var $t2: 0xc0ffee::m::S + var $t3: 0xc0ffee::m::S var $t4: &mut u64 - var $t5: &mut m::S + var $t5: &mut 0xc0ffee::m::S var $t6: u64 - var $t7: &m::S + var $t7: &0xc0ffee::m::S var $t8: &u64 0: $t2 := move($t0) 1: $t3 := copy($t2) 2: $t5 := borrow_local($t2) - 3: $t4 := borrow_field.a($t5) + 3: $t4 := borrow_field<0xc0ffee::m::S>.a($t5) 4: $t6 := 0 5: write_ref($t4, $t6) 6: $t7 := borrow_local($t3) - 7: $t8 := borrow_field.a($t7) + 7: $t8 := borrow_field<0xc0ffee::m::S>.a($t7) 8: $t6 := read_ref($t8) 9: return $t6 } diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/sequential_assign_struct.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/sequential_assign_struct.exp index ef5799020a8ac..d07e8b35bdcd3 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/sequential_assign_struct.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/sequential_assign_struct.exp @@ -1,13 +1,13 @@ ============ initial bytecode ================ [variant baseline] -fun m::sequential($t0: m::Foo): m::Foo { - var $t1: m::Foo - var $t2: m::Foo - var $t3: m::Foo - var $t4: m::Foo - var $t5: m::Foo - var $t6: m::Foo +fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { + var $t1: 0xc0ffee::m::Foo + var $t2: 0xc0ffee::m::Foo + var $t3: 0xc0ffee::m::Foo + var $t4: 0xc0ffee::m::Foo + var $t5: 0xc0ffee::m::Foo + var $t6: 0xc0ffee::m::Foo 0: $t2 := infer($t0) 1: $t3 := infer($t2) 2: $t4 := infer($t3) @@ -20,13 +20,13 @@ fun m::sequential($t0: m::Foo): m::Foo { ============ after DeadStoreElimination: ================ [variant baseline] -fun m::sequential($t0: m::Foo): m::Foo { - var $t1: m::Foo - var $t2: m::Foo - var $t3: m::Foo - var $t4: m::Foo - var $t5: m::Foo - var $t6: m::Foo +fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { + var $t1: 0xc0ffee::m::Foo + var $t2: 0xc0ffee::m::Foo + var $t3: 0xc0ffee::m::Foo + var $t4: 0xc0ffee::m::Foo + var $t5: 0xc0ffee::m::Foo + var $t6: 0xc0ffee::m::Foo 0: $t2 := move($t0) 1: $t3 := move($t2) 2: $t4 := move($t3) @@ -39,13 +39,13 @@ fun m::sequential($t0: m::Foo): m::Foo { ============ after VariableCoalescingAnnotator: ================ [variant baseline] -fun m::sequential($t0: m::Foo): m::Foo { - var $t1: m::Foo - var $t2: m::Foo - var $t3: m::Foo - var $t4: m::Foo - var $t5: m::Foo - var $t6: m::Foo +fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { + var $t1: 0xc0ffee::m::Foo + var $t2: 0xc0ffee::m::Foo + var $t3: 0xc0ffee::m::Foo + var $t4: 0xc0ffee::m::Foo + var $t5: 0xc0ffee::m::Foo + var $t6: 0xc0ffee::m::Foo # live vars: $t0 # events: b:$t0, e:$t0, b:$t2 0: $t2 := move($t0) @@ -72,13 +72,13 @@ fun m::sequential($t0: m::Foo): m::Foo { ============ after VariableCoalescingTransformer: ================ [variant baseline] -fun m::sequential($t0: m::Foo): m::Foo { - var $t1: m::Foo [unused] - var $t2: m::Foo [unused] - var $t3: m::Foo [unused] - var $t4: m::Foo [unused] - var $t5: m::Foo [unused] - var $t6: m::Foo [unused] +fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { + var $t1: 0xc0ffee::m::Foo [unused] + var $t2: 0xc0ffee::m::Foo [unused] + var $t3: 0xc0ffee::m::Foo [unused] + var $t4: 0xc0ffee::m::Foo [unused] + var $t5: 0xc0ffee::m::Foo [unused] + var $t6: 0xc0ffee::m::Foo [unused] 0: $t0 := move($t0) 1: $t0 := move($t0) 2: $t0 := move($t0) @@ -91,13 +91,13 @@ fun m::sequential($t0: m::Foo): m::Foo { ============ after DeadStoreElimination: ================ [variant baseline] -fun m::sequential($t0: m::Foo): m::Foo { - var $t1: m::Foo [unused] - var $t2: m::Foo [unused] - var $t3: m::Foo [unused] - var $t4: m::Foo [unused] - var $t5: m::Foo [unused] - var $t6: m::Foo [unused] +fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { + var $t1: 0xc0ffee::m::Foo [unused] + var $t2: 0xc0ffee::m::Foo [unused] + var $t3: 0xc0ffee::m::Foo [unused] + var $t4: 0xc0ffee::m::Foo [unused] + var $t5: 0xc0ffee::m::Foo [unused] + var $t6: 0xc0ffee::m::Foo [unused] 0: return $t0 } diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/sequential_assign_struct.opt.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/sequential_assign_struct.opt.exp index ef5799020a8ac..d07e8b35bdcd3 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/sequential_assign_struct.opt.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/sequential_assign_struct.opt.exp @@ -1,13 +1,13 @@ ============ initial bytecode ================ [variant baseline] -fun m::sequential($t0: m::Foo): m::Foo { - var $t1: m::Foo - var $t2: m::Foo - var $t3: m::Foo - var $t4: m::Foo - var $t5: m::Foo - var $t6: m::Foo +fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { + var $t1: 0xc0ffee::m::Foo + var $t2: 0xc0ffee::m::Foo + var $t3: 0xc0ffee::m::Foo + var $t4: 0xc0ffee::m::Foo + var $t5: 0xc0ffee::m::Foo + var $t6: 0xc0ffee::m::Foo 0: $t2 := infer($t0) 1: $t3 := infer($t2) 2: $t4 := infer($t3) @@ -20,13 +20,13 @@ fun m::sequential($t0: m::Foo): m::Foo { ============ after DeadStoreElimination: ================ [variant baseline] -fun m::sequential($t0: m::Foo): m::Foo { - var $t1: m::Foo - var $t2: m::Foo - var $t3: m::Foo - var $t4: m::Foo - var $t5: m::Foo - var $t6: m::Foo +fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { + var $t1: 0xc0ffee::m::Foo + var $t2: 0xc0ffee::m::Foo + var $t3: 0xc0ffee::m::Foo + var $t4: 0xc0ffee::m::Foo + var $t5: 0xc0ffee::m::Foo + var $t6: 0xc0ffee::m::Foo 0: $t2 := move($t0) 1: $t3 := move($t2) 2: $t4 := move($t3) @@ -39,13 +39,13 @@ fun m::sequential($t0: m::Foo): m::Foo { ============ after VariableCoalescingAnnotator: ================ [variant baseline] -fun m::sequential($t0: m::Foo): m::Foo { - var $t1: m::Foo - var $t2: m::Foo - var $t3: m::Foo - var $t4: m::Foo - var $t5: m::Foo - var $t6: m::Foo +fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { + var $t1: 0xc0ffee::m::Foo + var $t2: 0xc0ffee::m::Foo + var $t3: 0xc0ffee::m::Foo + var $t4: 0xc0ffee::m::Foo + var $t5: 0xc0ffee::m::Foo + var $t6: 0xc0ffee::m::Foo # live vars: $t0 # events: b:$t0, e:$t0, b:$t2 0: $t2 := move($t0) @@ -72,13 +72,13 @@ fun m::sequential($t0: m::Foo): m::Foo { ============ after VariableCoalescingTransformer: ================ [variant baseline] -fun m::sequential($t0: m::Foo): m::Foo { - var $t1: m::Foo [unused] - var $t2: m::Foo [unused] - var $t3: m::Foo [unused] - var $t4: m::Foo [unused] - var $t5: m::Foo [unused] - var $t6: m::Foo [unused] +fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { + var $t1: 0xc0ffee::m::Foo [unused] + var $t2: 0xc0ffee::m::Foo [unused] + var $t3: 0xc0ffee::m::Foo [unused] + var $t4: 0xc0ffee::m::Foo [unused] + var $t5: 0xc0ffee::m::Foo [unused] + var $t6: 0xc0ffee::m::Foo [unused] 0: $t0 := move($t0) 1: $t0 := move($t0) 2: $t0 := move($t0) @@ -91,13 +91,13 @@ fun m::sequential($t0: m::Foo): m::Foo { ============ after DeadStoreElimination: ================ [variant baseline] -fun m::sequential($t0: m::Foo): m::Foo { - var $t1: m::Foo [unused] - var $t2: m::Foo [unused] - var $t3: m::Foo [unused] - var $t4: m::Foo [unused] - var $t5: m::Foo [unused] - var $t6: m::Foo [unused] +fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { + var $t1: 0xc0ffee::m::Foo [unused] + var $t2: 0xc0ffee::m::Foo [unused] + var $t3: 0xc0ffee::m::Foo [unused] + var $t4: 0xc0ffee::m::Foo [unused] + var $t5: 0xc0ffee::m::Foo [unused] + var $t6: 0xc0ffee::m::Foo [unused] 0: return $t0 } diff --git a/third_party/move/move-compiler-v2/tests/visibility-checker/mix_friend_package_visibility_valid.exp b/third_party/move/move-compiler-v2/tests/visibility-checker/mix_friend_package_visibility_valid.exp index cd4161e3b9462..45287e306b344 100644 --- a/third_party/move/move-compiler-v2/tests/visibility-checker/mix_friend_package_visibility_valid.exp +++ b/third_party/move/move-compiler-v2/tests/visibility-checker/mix_friend_package_visibility_valid.exp @@ -10,3 +10,15 @@ module 0x42::A { Tuple() } } // end 0x42::A + +// -- Sourcified model before bytecode pipeline +module 0x42::B { + friend 0x42::A; + friend fun foo() { + } +} +module 0x42::A { + friend fun foo() { + 0x42::B::foo(); + } +} diff --git a/third_party/move/move-compiler-v2/tests/visibility-checker/package_visibility.exp b/third_party/move/move-compiler-v2/tests/visibility-checker/package_visibility.exp index 1423e7fb8a51c..f06c111924612 100644 --- a/third_party/move/move-compiler-v2/tests/visibility-checker/package_visibility.exp +++ b/third_party/move/move-compiler-v2/tests/visibility-checker/package_visibility.exp @@ -31,3 +31,37 @@ module 0x42::C { B::foo() } } // end 0x42::C + +// -- Sourcified model before bytecode pipeline +module 0x42::A { + friend 0x42::B; + friend fun bar() { + } + fun foo() { + } +} +module 0x42::B { + use 0x42::A; + friend 0x42::C; + public fun bar() { + A::bar() + } + friend fun foo() { + A::bar() + } + fun baz() { + A::bar() + } +} +module 0x42::C { + use 0x42::B; + public fun bar() { + B::foo() + } + friend fun foo() { + B::foo() + } + fun baz() { + B::foo() + } +} diff --git a/third_party/move/move-compiler-v2/tests/visibility-checker/v1-typing/module_call_visibility_friend.exp b/third_party/move/move-compiler-v2/tests/visibility-checker/v1-typing/module_call_visibility_friend.exp index f3424d16dd504..46adaacca8b01 100644 --- a/third_party/move/move-compiler-v2/tests/visibility-checker/v1-typing/module_call_visibility_friend.exp +++ b/third_party/move/move-compiler-v2/tests/visibility-checker/v1-typing/module_call_visibility_friend.exp @@ -49,3 +49,51 @@ module 0x2::M { M::f_friend() } } // end 0x2::M + +// -- Sourcified model before bytecode pipeline +module 0x2::Y { + friend 0x2::M; + friend fun f_friend() { + } +} +module 0x2::X { + public fun f_public() { + } +} +module 0x2::M { + use 0x2::Y; + use 0x2::X; + friend fun f_friend() { + } + public fun f_public() { + } + friend fun f_friend_call_friend() { + Y::f_friend() + } + friend fun f_friend_call_public() { + X::f_public() + } + friend fun f_friend_call_self_friend() { + f_friend() + } + friend fun f_friend_call_self_private() { + f_private() + } + friend fun f_friend_call_self_public() { + f_public() + } + fun f_private() { + } + fun f_private_call_friend() { + Y::f_friend() + } + fun f_private_call_self_friend() { + f_friend() + } + public fun f_public_call_friend() { + Y::f_friend() + } + public fun f_public_call_self_friend() { + f_friend() + } +} diff --git a/third_party/move/move-compiler-v2/tests/visibility-checker/visibility_complex.exp b/third_party/move/move-compiler-v2/tests/visibility-checker/visibility_complex.exp index 6cf8b10e577f7..1196b8a46fbea 100644 --- a/third_party/move/move-compiler-v2/tests/visibility-checker/visibility_complex.exp +++ b/third_party/move/move-compiler-v2/tests/visibility-checker/visibility_complex.exp @@ -23,3 +23,29 @@ module 0x42::D { Tuple() } } // end 0x42::D + +// -- Sourcified model before bytecode pipeline +module 0x42::B { + friend 0x42::C; + friend 0x42::D; + friend fun foo() { + } +} +module 0x42::A { + friend 0x42::C; + friend fun foo() { + } +} +module 0x42::C { + friend 0x42::D; + friend fun foo() { + 0x42::A::foo(); + 0x42::B::foo(); + } +} +module 0x42::D { + friend fun bar() { + 0x42::B::foo(); + 0x42::C::foo(); + } +} diff --git a/third_party/move/move-model/bytecode/Cargo.toml b/third_party/move/move-model/bytecode/Cargo.toml index 43e0ed1ef7a07..ae85ec999da93 100644 --- a/third_party/move/move-model/bytecode/Cargo.toml +++ b/third_party/move/move-model/bytecode/Cargo.toml @@ -24,6 +24,7 @@ log = { workspace = true } num = { workspace = true } paste = { workspace = true } petgraph = { workspace = true } +topological-sort = { workspace = true } [dev-dependencies] anyhow = { workspace = true } diff --git a/third_party/move/move-model/bytecode/ast-generator-tests/Cargo.toml b/third_party/move/move-model/bytecode/ast-generator-tests/Cargo.toml new file mode 100644 index 0000000000000..984877d3123a5 --- /dev/null +++ b/third_party/move/move-model/bytecode/ast-generator-tests/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "move-ast-generator-tests" +version = "0.1.0" +edition = "2021" +license = { workspace = true } + +[dev-dependencies] +anyhow = { workspace = true } +codespan-reporting = { workspace = true, features = ["serde", "serialization"] } +datatest-stable = { workspace = true } +move-compiler-v2 = { workspace = true } +move-model = { workspace = true } +move-prover-test-utils = { workspace = true } +move-stackless-bytecode = { workspace = true } + +[[test]] +name = "testsuite" +harness = false + +[lib] +doctest = false diff --git a/third_party/move/move-model/bytecode/ast-generator-tests/src/lib.rs b/third_party/move/move-model/bytecode/ast-generator-tests/src/lib.rs new file mode 100644 index 0000000000000..dd271f8c0ff7b --- /dev/null +++ b/third_party/move/move-model/bytecode/ast-generator-tests/src/lib.rs @@ -0,0 +1,5 @@ +// Copyright © Aptos Foundation +// Parts of the project are originally copyright © Meta Platforms, Inc. +// SPDX-License-Identifier: Apache-2.0 + +//! Intentionally empty diff --git a/third_party/move/move-model/bytecode/ast-generator-tests/tests/conditionals.exp b/third_party/move/move-model/bytecode/ast-generator-tests/tests/conditionals.exp new file mode 100644 index 0000000000000..faa1807d0cec8 --- /dev/null +++ b/third_party/move/move-model/bytecode/ast-generator-tests/tests/conditionals.exp @@ -0,0 +1,469 @@ + +=== Processing m::if_1 ===================================================== +--- Source +fun if_1(c: bool): u8 { + let result = 0; + if (c) { + result = 1; + }; + result + } + +--- Stackless Bytecode +fun m::if_1($t0|c: bool): u8 { + var $t1|result: u8 + var $t2: u8 + var $t3: bool + var $t4: u8 + var $t5: u8 + 0: $t2 := 0 + 1: $t1 := $t2 + 2: $t3 := move($t0) + 3: if ($t3) goto 4 else goto 8 + 4: label L1 + 5: $t4 := 1 + 6: $t1 := $t4 + 7: goto 8 + 8: label L0 + 9: $t5 := move($t1) + 10: return $t5 +} + +--- Raw Generated AST +_t2: u8 = 0; +_t1: u8 = _t2; +_t3: bool = c; +loop { + if (Not(_t3)) break; + _t4: u8 = 1; + _t1: u8 = _t4; + break +}; +_t5: u8 = _t1; +return _t5 + +--- If-Transformed Generated AST +_t2: u8 = 0; +_t1: u8 = _t2; +_t3: bool = c; +if _t3 { + _t4: u8 = 1; + _t1: u8 = _t4 +}; +_t5: u8 = _t1; +return _t5 + +--- Assign-Transformed Generated AST +{ + let _t1: u8 = 0; + if c { + _t1: u8 = 1 + }; + return _t1 +} + + +=== Processing m::if_else_1 ===================================================== +--- Source +fun if_else_1(c: bool): u8 { + if (c) 1 else 2 + } + +--- Stackless Bytecode +fun m::if_else_1($t0|c: bool): u8 { + var $t1|return: u8 + var $t2: bool + var $t3: u8 + var $t4: u8 + var $t5: u8 + 0: $t2 := move($t0) + 1: if ($t2) goto 2 else goto 6 + 2: label L1 + 3: $t3 := 1 + 4: $t1 := $t3 + 5: goto 10 + 6: label L0 + 7: $t4 := 2 + 8: $t1 := $t4 + 9: goto 10 + 10: label L2 + 11: $t5 := move($t1) + 12: return $t5 +} + +--- Raw Generated AST +_t2: bool = c; +loop { + loop { + if (Not(_t2)) break; + _t3: u8 = 1; + _t1: u8 = _t3; + break[1] + }; + _t4: u8 = 2; + _t1: u8 = _t4; + break +}; +_t5: u8 = _t1; +return _t5 + +--- If-Transformed Generated AST +_t2: bool = c; +if _t2 { + _t3: u8 = 1; + _t1: u8 = _t3 +} else { + _t4: u8 = 2; + _t1: u8 = _t4 +}; +_t5: u8 = _t1; +return _t5 + +--- Assign-Transformed Generated AST +{ + let _t1: u8; + if c { + _t1: u8 = 1 + } else { + _t1: u8 = 2 + }; + return _t1 +} + + +=== Processing m::if_else_2 ===================================================== +--- Source +fun if_else_2(c: bool, d: bool): u8 { + if (c) { + if (d) { + 1 + } else { + 2 + } + } else { + 3 + } + } + +--- Stackless Bytecode +fun m::if_else_2($t0|c: bool, $t1|d: bool): u8 { + var $t2|return: u8 + var $t3: bool + var $t4: bool + var $t5: u8 + var $t6: u8 + var $t7: u8 + var $t8: u8 + 0: $t3 := move($t0) + 1: if ($t3) goto 2 else goto 15 + 2: label L1 + 3: $t4 := move($t1) + 4: if ($t4) goto 5 else goto 9 + 5: label L3 + 6: $t5 := 1 + 7: $t2 := $t5 + 8: goto 13 + 9: label L2 + 10: $t6 := 2 + 11: $t2 := $t6 + 12: goto 13 + 13: label L4 + 14: goto 19 + 15: label L0 + 16: $t7 := 3 + 17: $t2 := $t7 + 18: goto 19 + 19: label L5 + 20: $t8 := move($t2) + 21: return $t8 +} + +--- Raw Generated AST +_t3: bool = c; +loop { + loop { + if (_t3) break; + _t7: u8 = 3; + _t2: u8 = _t7; + break[1] + }; + _t4: bool = d; + loop { + loop { + if (Not(_t4)) break; + _t5: u8 = 1; + _t2: u8 = _t5; + break[1] + }; + _t6: u8 = 2; + _t2: u8 = _t6; + break + }; + break +}; +_t8: u8 = _t2; +return _t8 + +--- If-Transformed Generated AST +_t3: bool = c; +if _t3 { + _t4: bool = d; + if _t4 { + _t5: u8 = 1; + _t2: u8 = _t5 + } else { + _t6: u8 = 2; + _t2: u8 = _t6 + } +} else { + _t7: u8 = 3; + _t2: u8 = _t7 +}; +_t8: u8 = _t2; +return _t8 + +--- Assign-Transformed Generated AST +{ + let _t2: u8; + if c { + if d { + _t2: u8 = 1 + } else { + _t2: u8 = 2 + } + } else { + _t2: u8 = 3 + }; + return _t2 +} + + +=== Processing m::if_else_3 ===================================================== +--- Source +fun if_else_3(c: bool): u64 { + let r = if (c) 1 else 2; + r + } + +--- Stackless Bytecode +fun m::if_else_3($t0|c: bool): u64 { + var $t1|r: u64 + var $t2: bool + var $t3: u64 + var $t4: u64 + var $t5: u64 + 0: $t2 := move($t0) + 1: if ($t2) goto 2 else goto 6 + 2: label L1 + 3: $t3 := 1 + 4: $t1 := $t3 + 5: goto 10 + 6: label L0 + 7: $t4 := 2 + 8: $t1 := $t4 + 9: goto 10 + 10: label L2 + 11: $t5 := move($t1) + 12: return $t5 +} + +--- Raw Generated AST +_t2: bool = c; +loop { + loop { + if (Not(_t2)) break; + _t3: u64 = 1; + _t1: u64 = _t3; + break[1] + }; + _t4: u64 = 2; + _t1: u64 = _t4; + break +}; +_t5: u64 = _t1; +return _t5 + +--- If-Transformed Generated AST +_t2: bool = c; +if _t2 { + _t3: u64 = 1; + _t1: u64 = _t3 +} else { + _t4: u64 = 2; + _t1: u64 = _t4 +}; +_t5: u64 = _t1; +return _t5 + +--- Assign-Transformed Generated AST +{ + let _t1: u64; + if c { + _t1: u64 = 1 + } else { + _t1: u64 = 2 + }; + return _t1 +} + + +=== Processing m::if_else_with_shard_exp ===================================================== +--- Source +fun if_else_with_shard_exp(x: u64): u64 { + let y = x + x; + let z = y * y; + if (z > 0) z + 1 else z - 1 + } + +--- Stackless Bytecode +fun m::if_else_with_shard_exp($t0|x: u64): u64 { + var $t1|$t5: u64 + var $t2|$t7: u64 [unused] + var $t3: u64 + var $t4: u64 + var $t5: u64 + var $t6: u64 + var $t7: u64 + var $t8: u64 + var $t9: u64 + var $t10: u64 + var $t11: bool + var $t12: u64 + var $t13: u64 + var $t14: u64 + var $t15: u64 + var $t16: u64 + var $t17: u64 + var $t18: u64 + 0: $t3 := copy($t0) + 1: $t4 := move($t0) + 2: $t5 := +($t3, $t4) + 3: $t0 := $t5 + 4: $t6 := copy($t0) + 5: $t7 := move($t0) + 6: $t8 := *($t6, $t7) + 7: $t0 := $t8 + 8: $t9 := copy($t0) + 9: $t10 := 0 + 10: $t11 := >($t9, $t10) + 11: if ($t11) goto 12 else goto 18 + 12: label L1 + 13: $t12 := move($t0) + 14: $t13 := 1 + 15: $t14 := +($t12, $t13) + 16: $t1 := $t14 + 17: goto 24 + 18: label L0 + 19: $t15 := move($t0) + 20: $t16 := 1 + 21: $t17 := -($t15, $t16) + 22: $t1 := $t17 + 23: goto 24 + 24: label L2 + 25: $t18 := move($t1) + 26: return $t18 +} + +--- Raw Generated AST +_t3: u64 = x; +_t4: u64 = x; +_t5: u64 = Add(_t3, _t4); +x: u64 = _t5; +_t6: u64 = x; +_t7: u64 = x; +_t8: u64 = Mul(_t6, _t7); +x: u64 = _t8; +_t9: u64 = x; +_t10: u64 = 0; +_t11: bool = Gt(_t9, _t10); +loop { + loop { + if (Not(_t11)) break; + _t12: u64 = x; + _t13: u64 = 1; + _t14: u64 = Add(_t12, _t13); + _t1: u64 = _t14; + break[1] + }; + _t15: u64 = x; + _t16: u64 = 1; + _t17: u64 = Sub(_t15, _t16); + _t1: u64 = _t17; + break +}; +_t18: u64 = _t1; +return _t18 + +--- If-Transformed Generated AST +_t3: u64 = x; +_t4: u64 = x; +_t5: u64 = Add(_t3, _t4); +x: u64 = _t5; +_t6: u64 = x; +_t7: u64 = x; +_t8: u64 = Mul(_t6, _t7); +x: u64 = _t8; +_t9: u64 = x; +_t10: u64 = 0; +_t11: bool = Gt(_t9, _t10); +if _t11 { + _t12: u64 = x; + _t13: u64 = 1; + _t14: u64 = Add(_t12, _t13); + _t1: u64 = _t14 +} else { + _t15: u64 = x; + _t16: u64 = 1; + _t17: u64 = Sub(_t15, _t16); + _t1: u64 = _t17 +}; +_t18: u64 = _t1; +return _t18 + +--- Assign-Transformed Generated AST +{ + let _t1: u64; + { + let x: u64 = Add(x, x); + { + let x: u64 = Mul(x, x); + if Gt(x, 0) { + _t1: u64 = Add(x, 1) + } else { + _t1: u64 = Sub(x, 1) + }; + return _t1 + } + } +} + +=== Sourcified Output ============================================ +module 0x815::m { + fun if_1(c: bool): u8 { + let _t1 = 0u8; + if (c) _t1 = 1u8; + _t1 + } + fun if_else_1(c: bool): u8 { + let _t1; + if (c) _t1 = 1u8 else _t1 = 2u8; + _t1 + } + fun if_else_2(c: bool, d: bool): u8 { + let _t2; + if (c) if (d) _t2 = 1u8 else _t2 = 2u8 else _t2 = 3u8; + _t2 + } + fun if_else_3(c: bool): u64 { + let _t1; + if (c) _t1 = 1 else _t1 = 2; + _t1 + } + fun if_else_with_shard_exp(x: u64): u64 { + let _t1; + let x = x + x; + let x = x * x; + if (x > 0) _t1 = x + 1 else _t1 = x - 1; + _t1 + } +} diff --git a/third_party/move/move-model/bytecode/ast-generator-tests/tests/conditionals.move b/third_party/move/move-model/bytecode/ast-generator-tests/tests/conditionals.move new file mode 100644 index 0000000000000..f7b1261d66cb7 --- /dev/null +++ b/third_party/move/move-model/bytecode/ast-generator-tests/tests/conditionals.move @@ -0,0 +1,38 @@ +module 0x815::m { + + fun if_else_1(c: bool): u8 { + if (c) 1 else 2 + } + + fun if_else_2(c: bool, d: bool): u8 { + if (c) { + if (d) { + 1 + } else { + 2 + } + } else { + 3 + } + } + + + fun if_1(c: bool): u8 { + let result = 0; + if (c) { + result = 1; + }; + result + } + + fun if_else_3(c: bool): u64 { + let r = if (c) 1 else 2; + r + } + + fun if_else_with_shard_exp(x: u64): u64 { + let y = x + x; + let z = y * y; + if (z > 0) z + 1 else z - 1 + } +} diff --git a/third_party/move/move-model/bytecode/ast-generator-tests/tests/loops.exp b/third_party/move/move-model/bytecode/ast-generator-tests/tests/loops.exp new file mode 100644 index 0000000000000..1d788d950ed56 --- /dev/null +++ b/third_party/move/move-model/bytecode/ast-generator-tests/tests/loops.exp @@ -0,0 +1,499 @@ + +=== Processing m::loop_1 ===================================================== +--- Source +fun loop_1(c: u64): u64 { + loop { + c = c + 1; + if (c % 2 == 0) continue; + c = c + 3; + if (c % 2 == 1) break; + }; + c + } + +--- Stackless Bytecode +fun m::loop_1($t0|c: u64): u64 { + var $t1|$t3: u64 [unused] + var $t2: u64 + var $t3: u64 + var $t4: u64 + var $t5: u64 + var $t6: u64 + var $t7: u64 + var $t8: u64 + var $t9: bool + var $t10: u64 + var $t11: u64 + var $t12: u64 + var $t13: u64 + var $t14: u64 + var $t15: u64 + var $t16: u64 + var $t17: bool + var $t18: u64 + 0: label L2 + 1: $t2 := move($t0) + 2: $t3 := 1 + 3: $t4 := +($t2, $t3) + 4: $t0 := $t4 + 5: $t5 := copy($t0) + 6: $t6 := 2 + 7: $t7 := %($t5, $t6) + 8: $t8 := 0 + 9: $t9 := ==($t7, $t8) + 10: if ($t9) goto 11 else goto 13 + 11: label L1 + 12: goto 0 + 13: label L0 + 14: $t10 := move($t0) + 15: $t11 := 3 + 16: $t12 := +($t10, $t11) + 17: $t0 := $t12 + 18: $t13 := copy($t0) + 19: $t14 := 2 + 20: $t15 := %($t13, $t14) + 21: $t16 := 1 + 22: $t17 := ==($t15, $t16) + 23: if ($t17) goto 24 else goto 26 + 24: label L4 + 25: goto 28 + 26: label L3 + 27: goto 0 + 28: label L5 + 29: $t18 := move($t0) + 30: return $t18 +} + +--- Raw Generated AST +loop { + _t2: u64 = c; + _t3: u64 = 1; + _t4: u64 = Add(_t2, _t3); + c: u64 = _t4; + _t5: u64 = c; + _t6: u64 = 2; + _t7: u64 = Mod(_t5, _t6); + _t8: u64 = 0; + _t9: bool = Eq(_t7, _t8); + if (_t9) continue; + _t10: u64 = c; + _t11: u64 = 3; + _t12: u64 = Add(_t10, _t11); + c: u64 = _t12; + _t13: u64 = c; + _t14: u64 = 2; + _t15: u64 = Mod(_t13, _t14); + _t16: u64 = 1; + _t17: bool = Eq(_t15, _t16); + if (Not(_t17)) continue; + break +}; +_t18: u64 = c; +return _t18 + +--- If-Transformed Generated AST +loop { + _t2: u64 = c; + _t3: u64 = 1; + _t4: u64 = Add(_t2, _t3); + c: u64 = _t4; + _t5: u64 = c; + _t6: u64 = 2; + _t7: u64 = Mod(_t5, _t6); + _t8: u64 = 0; + _t9: bool = Eq(_t7, _t8); + if (_t9) continue; + _t10: u64 = c; + _t11: u64 = 3; + _t12: u64 = Add(_t10, _t11); + c: u64 = _t12; + _t13: u64 = c; + _t14: u64 = 2; + _t15: u64 = Mod(_t13, _t14); + _t16: u64 = 1; + _t17: bool = Eq(_t15, _t16); + if (Not(_t17)) continue; + break +}; +_t18: u64 = c; +return _t18 + +--- Assign-Transformed Generated AST +loop { + c: u64 = Add(c, 1); + if (Eq(Mod(c, 2), 0)) continue; + c: u64 = Add(c, 3); + if (Not(Eq(Mod(c, 2), 1))) continue; + break +}; +return c + + +=== Processing m::while_1 ===================================================== +--- Source +fun while_1(c: u64) { + while (c > 0) c = c - 1 + } + +--- Stackless Bytecode +fun m::while_1($t0|c: u64) { + var $t1|$t2: u64 [unused] + var $t2: u64 + var $t3: u64 + var $t4: bool + var $t5: u64 + var $t6: u64 + var $t7: u64 + 0: label L4 + 1: $t2 := copy($t0) + 2: $t3 := 0 + 3: $t4 := >($t2, $t3) + 4: if ($t4) goto 5 else goto 11 + 5: label L1 + 6: $t5 := move($t0) + 7: $t6 := 1 + 8: $t7 := -($t5, $t6) + 9: $t0 := $t7 + 10: goto 13 + 11: label L0 + 12: goto 15 + 13: label L2 + 14: goto 0 + 15: label L3 + 16: return () +} + +--- Raw Generated AST +loop { + _t2: u64 = c; + _t3: u64 = 0; + _t4: bool = Gt(_t2, _t3); + loop { + if (Not(_t4)) break; + _t5: u64 = c; + _t6: u64 = 1; + _t7: u64 = Sub(_t5, _t6); + c: u64 = _t7; + continue[1] + }; + break +}; +return Tuple() + +--- If-Transformed Generated AST +loop { + _t2: u64 = c; + _t3: u64 = 0; + _t4: bool = Gt(_t2, _t3); + if _t4 { + _t5: u64 = c; + _t6: u64 = 1; + _t7: u64 = Sub(_t5, _t6); + c: u64 = _t7; + continue + }; + break +}; +return Tuple() + +--- Assign-Transformed Generated AST +loop { + if Gt(c, 0) { + { + let c: u64 = Sub(c, 1); + continue + } + }; + break +}; +return Tuple() + + +=== Processing m::while_2 ===================================================== +--- Source +fun while_2(c: u64): u64 { + while (c > 0) { + if (c >= 10) { + c = c - 10 + } + }; + c = c + 1; + c + } + +--- Stackless Bytecode +fun m::while_2($t0|c: u64): u64 { + var $t1|$t3: u64 [unused] + var $t2: u64 + var $t3: u64 + var $t4: bool + var $t5: u64 + var $t6: u64 + var $t7: bool + var $t8: u64 + var $t9: u64 + var $t10: u64 + var $t11: u64 + var $t12: u64 + var $t13: u64 + 0: label L6 + 1: $t2 := copy($t0) + 2: $t3 := 0 + 3: $t4 := >($t2, $t3) + 4: if ($t4) goto 5 else goto 18 + 5: label L1 + 6: $t5 := copy($t0) + 7: $t6 := 10 + 8: $t7 := >=($t5, $t6) + 9: if ($t7) goto 10 else goto 16 + 10: label L3 + 11: $t8 := move($t0) + 12: $t9 := 10 + 13: $t10 := -($t8, $t9) + 14: $t0 := $t10 + 15: goto 16 + 16: label L2 + 17: goto 20 + 18: label L0 + 19: goto 22 + 20: label L4 + 21: goto 0 + 22: label L5 + 23: $t11 := move($t0) + 24: $t12 := 1 + 25: $t13 := +($t11, $t12) + 26: return $t13 +} + +--- Raw Generated AST +loop { + _t2: u64 = c; + _t3: u64 = 0; + _t4: bool = Gt(_t2, _t3); + loop { + if (Not(_t4)) break; + _t5: u64 = c; + _t6: u64 = 10; + _t7: bool = Ge(_t5, _t6); + if (Not(_t7)) continue[1]; + _t8: u64 = c; + _t9: u64 = 10; + _t10: u64 = Sub(_t8, _t9); + c: u64 = _t10; + continue[1] + }; + break +}; +_t11: u64 = c; +_t12: u64 = 1; +_t13: u64 = Add(_t11, _t12); +return _t13 + +--- If-Transformed Generated AST +loop { + _t2: u64 = c; + _t3: u64 = 0; + _t4: bool = Gt(_t2, _t3); + if _t4 { + _t5: u64 = c; + _t6: u64 = 10; + _t7: bool = Ge(_t5, _t6); + if (Not(_t7)) continue; + _t8: u64 = c; + _t9: u64 = 10; + _t10: u64 = Sub(_t8, _t9); + c: u64 = _t10; + continue + }; + break +}; +_t11: u64 = c; +_t12: u64 = 1; +_t13: u64 = Add(_t11, _t12); +return _t13 + +--- Assign-Transformed Generated AST +loop { + if Gt(c, 0) { + if (Not(Ge(c, 10))) continue; + c: u64 = Sub(c, 10); + continue + }; + break +}; +return Add(c, 1) + + +=== Processing m::while_3 ===================================================== +--- Source +fun while_3(c: u64): u64 { + while (c > 0) { + while (c > 10) c = c - 10; + c = c - 1; + }; + c + } + +--- Stackless Bytecode +fun m::while_3($t0|c: u64): u64 { + var $t1|$t3: u64 [unused] + var $t2: u64 + var $t3: u64 + var $t4: bool + var $t5: u64 + var $t6: u64 + var $t7: bool + var $t8: u64 + var $t9: u64 + var $t10: u64 + var $t11: u64 + var $t12: u64 + var $t13: u64 + var $t14: u64 + 0: label L8 + 1: $t2 := copy($t0) + 2: $t3 := 0 + 3: $t4 := >($t2, $t3) + 4: if ($t4) goto 5 else goto 26 + 5: label L1 + 6: $t5 := copy($t0) + 7: $t6 := 10 + 8: $t7 := >($t5, $t6) + 9: if ($t7) goto 10 else goto 16 + 10: label L3 + 11: $t8 := move($t0) + 12: $t9 := 10 + 13: $t10 := -($t8, $t9) + 14: $t0 := $t10 + 15: goto 18 + 16: label L2 + 17: goto 20 + 18: label L4 + 19: goto 5 + 20: label L5 + 21: $t11 := move($t0) + 22: $t12 := 1 + 23: $t13 := -($t11, $t12) + 24: $t0 := $t13 + 25: goto 28 + 26: label L0 + 27: goto 30 + 28: label L6 + 29: goto 0 + 30: label L7 + 31: $t14 := move($t0) + 32: return $t14 +} + +--- Raw Generated AST +loop { + _t2: u64 = c; + _t3: u64 = 0; + _t4: bool = Gt(_t2, _t3); + loop { + if (Not(_t4)) break; + loop { + _t5: u64 = c; + _t6: u64 = 10; + _t7: bool = Gt(_t5, _t6); + loop { + if (Not(_t7)) break; + _t8: u64 = c; + _t9: u64 = 10; + _t10: u64 = Sub(_t8, _t9); + c: u64 = _t10; + continue[1] + }; + break + }; + _t11: u64 = c; + _t12: u64 = 1; + _t13: u64 = Sub(_t11, _t12); + c: u64 = _t13; + continue[1] + }; + break +}; +_t14: u64 = c; +return _t14 + +--- If-Transformed Generated AST +loop { + _t2: u64 = c; + _t3: u64 = 0; + _t4: bool = Gt(_t2, _t3); + if _t4 { + loop { + _t5: u64 = c; + _t6: u64 = 10; + _t7: bool = Gt(_t5, _t6); + if _t7 { + _t8: u64 = c; + _t9: u64 = 10; + _t10: u64 = Sub(_t8, _t9); + c: u64 = _t10; + continue + }; + break + }; + _t11: u64 = c; + _t12: u64 = 1; + _t13: u64 = Sub(_t11, _t12); + c: u64 = _t13; + continue + }; + break +}; +_t14: u64 = c; +return _t14 + +--- Assign-Transformed Generated AST +loop { + if Gt(c, 0) { + loop { + if Gt(c, 10) { + c: u64 = Sub(c, 10); + continue + }; + break + }; + c: u64 = Sub(c, 1); + continue + }; + break +}; +return c + +=== Sourcified Output ============================================ +module 0x815::m { + fun loop_1(c: u64): u64 { + loop { + c = c + 1; + if (c % 2 == 0) continue; + c = c + 3; + if (!(c % 2 == 1)) continue; + break + }; + c + } + fun while_1(c: u64) { + while (c > 0) { + let c = c - 1; + continue + }; + } + fun while_2(c: u64): u64 { + while (c > 0) { + if (!(c >= 10)) continue; + c = c - 10 + }; + c + 1 + } + fun while_3(c: u64): u64 { + while (c > 0) { + while (c > 10) c = c - 10; + c = c - 1 + }; + c + } +} diff --git a/third_party/move/move-model/bytecode/ast-generator-tests/tests/loops.move b/third_party/move/move-model/bytecode/ast-generator-tests/tests/loops.move new file mode 100644 index 0000000000000..95a671341c962 --- /dev/null +++ b/third_party/move/move-model/bytecode/ast-generator-tests/tests/loops.move @@ -0,0 +1,34 @@ +module 0x815::m { + + fun while_1(c: u64) { + while (c > 0) c = c - 1 + } + + fun while_2(c: u64): u64 { + while (c > 0) { + if (c >= 10) { + c = c - 10 + } + }; + c = c + 1; + c + } + + fun while_3(c: u64): u64 { + while (c > 0) { + while (c > 10) c = c - 10; + c = c - 1; + }; + c + } + + fun loop_1(c: u64): u64 { + loop { + c = c + 1; + if (c % 2 == 0) continue; + c = c + 3; + if (c % 2 == 1) break; + }; + c + } +} diff --git a/third_party/move/move-model/bytecode/ast-generator-tests/tests/match.exp b/third_party/move/move-model/bytecode/ast-generator-tests/tests/match.exp new file mode 100644 index 0000000000000..35705886bb3e5 --- /dev/null +++ b/third_party/move/move-model/bytecode/ast-generator-tests/tests/match.exp @@ -0,0 +1,335 @@ + +=== Processing m::id ===================================================== +--- Source +fun id(self: &Entity): u64 { + match (self) { + Person{id} => *id, + Institution{id, ..} => *id + } + } + +--- Stackless Bytecode +fun m::id($t0|self: &0x815::m::Entity): u64 { + var $t1|return: u64 + var $t2: &0x815::m::Entity + var $t3: bool + var $t4: &0x815::m::Entity + var $t5: &u64 + var $t6: u64 + var $t7: &0x815::m::Entity + var $t8: bool + var $t9: &0x815::m::Entity + var $t10: &u64 + var $t11: u64 + var $t12: &0x815::m::Entity + var $t13: u64 + var $t14: u64 + 0: $t2 := copy($t0) + 1: $t3 := test_variant 0x815::m::Entity::Person($t2) + 2: if ($t3) goto 3 else goto 9 + 3: label L1 + 4: $t4 := move($t0) + 5: $t5 := borrow_variant_field<0x815::m::Entity::Person>.id($t4) + 6: $t6 := read_ref($t5) + 7: $t1 := $t6 + 8: goto 24 + 9: label L0 + 10: $t7 := copy($t0) + 11: $t8 := test_variant 0x815::m::Entity::Institution($t7) + 12: if ($t8) goto 13 else goto 19 + 13: label L4 + 14: $t9 := move($t0) + 15: $t10 := borrow_variant_field<0x815::m::Entity::Institution>.id($t9) + 16: $t11 := read_ref($t10) + 17: $t1 := $t11 + 18: goto 24 + 19: label L3 + 20: $t12 := move($t0) + 21: drop($t12) + 22: $t13 := 14566554180833181697 + 23: abort($t13) + 24: label L2 + 25: $t14 := move($t1) + 26: return $t14 +} + +--- Raw Generated AST +_t2: &Entity = self; +_t3: bool = test_variants m::Entity::Person(_t2); +loop { + loop { + if (Not(_t3)) break; + _t4: &Entity = self; + _t5: &u64 = select_variants m::Entity.id(_t4); + _t6: u64 = Deref(_t5); + _t1: u64 = _t6; + break[1] + }; + _t7: &Entity = self; + _t8: bool = test_variants m::Entity::Institution(_t7); + loop { + loop { + if (Not(_t8)) break; + _t9: &Entity = self; + _t10: &u64 = select_variants m::Entity.id(_t9); + _t11: u64 = Deref(_t10); + _t1: u64 = _t11; + break[1] + }; + _t12: &Entity = self; + _t13: u64 = 14566554180833181697; + Abort(_t13) + }; + break +}; +_t14: u64 = _t1; +return _t14 + +--- If-Transformed Generated AST +_t2: &Entity = self; +_t3: bool = test_variants m::Entity::Person(_t2); +if _t3 { + _t4: &Entity = self; + _t5: &u64 = select_variants m::Entity.id(_t4); + _t6: u64 = Deref(_t5); + _t1: u64 = _t6 +} else { + _t7: &Entity = self; + _t8: bool = test_variants m::Entity::Institution(_t7); + if _t8 { + _t9: &Entity = self; + _t10: &u64 = select_variants m::Entity.id(_t9); + _t11: u64 = Deref(_t10); + _t1: u64 = _t11 + } else { + _t12: &Entity = self; + _t13: u64 = 14566554180833181697; + Abort(_t13) + } +}; +_t14: u64 = _t1; +return _t14 + +--- Assign-Transformed Generated AST +{ + let _t1: u64; + if test_variants m::Entity::Person(self) { + _t1: u64 = Deref(select_variants m::Entity.id(self)) + } else { + if test_variants m::Entity::Institution(self) { + _t1: u64 = Deref(select_variants m::Entity.id(self)) + } else { + Abort(14566554180833181697) + } + }; + return _t1 +} + + +=== Processing m::id2 ===================================================== +--- Source +fun id2(self: Entity): u64 { + match (self) { + Person{id} if id > 0 => id, + Institution{id, ..} => id, + _ => 0 + } + } + +--- Stackless Bytecode +fun m::id2($t0|self: 0x815::m::Entity): u64 { + var $t1|$t2: &0x815::m::Entity + var $t2|$t5: u64 + var $t3: &0x815::m::Entity + var $t4: &0x815::m::Entity + var $t5: bool + var $t6: &0x815::m::Entity + var $t7: &u64 + var $t8: u64 + var $t9: u64 + var $t10: bool + var $t11: &0x815::m::Entity + var $t12: 0x815::m::Entity + var $t13: u64 + var $t14: &0x815::m::Entity + var $t15: bool + var $t16: 0x815::m::Entity + var $t17: u64 + var $t18: u64 + var $t19: u64 + var $t20: u64 + 0: $t3 := borrow_local($t0) + 1: $t1 := $t3 + 2: $t4 := copy($t1) + 3: $t5 := test_variant 0x815::m::Entity::Person($t4) + 4: if ($t5) goto 5 else goto 19 + 5: label L1 + 6: $t6 := copy($t1) + 7: $t7 := borrow_variant_field<0x815::m::Entity::Person>.id($t6) + 8: $t8 := read_ref($t7) + 9: $t9 := 0 + 10: $t10 := >($t8, $t9) + 11: if ($t10) goto 12 else goto 19 + 12: label L2 + 13: $t11 := move($t1) + 14: drop($t11) + 15: $t12 := move($t0) + 16: $t13 := unpack_variant 0x815::m::Entity::Person($t12) + 17: $t2 := $t13 + 18: goto 33 + 19: label L0 + 20: $t14 := move($t1) + 21: $t15 := test_variant 0x815::m::Entity::Institution($t14) + 22: if ($t15) goto 23 else goto 29 + 23: label L5 + 24: $t16 := move($t0) + 25: ($t17, $t18) := unpack_variant 0x815::m::Entity::Institution($t16) + 26: drop($t18) + 27: $t2 := $t17 + 28: goto 33 + 29: label L4 + 30: $t19 := 0 + 31: $t2 := $t19 + 32: goto 33 + 33: label L3 + 34: $t20 := move($t2) + 35: return $t20 +} + +--- Raw Generated AST +_t3: &Entity = Borrow(Immutable)(self); +_t1: &Entity = _t3; +_t4: &Entity = _t1; +_t5: bool = test_variants m::Entity::Person(_t4); +loop { + loop { + if (Not(_t5)) break; + _t6: &Entity = _t1; + _t7: &u64 = select_variants m::Entity.id(_t6); + _t8: u64 = Deref(_t7); + _t9: u64 = 0; + _t10: bool = Gt(_t8, _t9); + if (Not(_t10)) break; + _t11: &Entity = _t1; + _t12: Entity = self; + m::Entity::Person{ id: _t13 } = _t12; + _t2: u64 = _t13; + break[1] + }; + _t14: &Entity = _t1; + _t15: bool = test_variants m::Entity::Institution(_t14); + loop { + loop { + if (Not(_t15)) break; + _t16: Entity = self; + m::Entity::Institution{ id: _t17, admin: _t18 } = _t16; + _t2: u64 = _t17; + break[1] + }; + _t19: u64 = 0; + _t2: u64 = _t19; + break + }; + break +}; +_t20: u64 = _t2; +return _t20 + +--- If-Transformed Generated AST +_t3: &Entity = Borrow(Immutable)(self); +_t1: &Entity = _t3; +_t4: &Entity = _t1; +_t5: bool = test_variants m::Entity::Person(_t4); +loop { + loop { + if (Not(_t5)) break; + _t6: &Entity = _t1; + _t7: &u64 = select_variants m::Entity.id(_t6); + _t8: u64 = Deref(_t7); + _t9: u64 = 0; + _t10: bool = Gt(_t8, _t9); + if (Not(_t10)) break; + _t11: &Entity = _t1; + _t12: Entity = self; + m::Entity::Person{ id: _t13 } = _t12; + _t2: u64 = _t13; + break[1] + }; + _t14: &Entity = _t1; + _t15: bool = test_variants m::Entity::Institution(_t14); + if _t15 { + _t16: Entity = self; + m::Entity::Institution{ id: _t17, admin: _t18 } = _t16; + _t2: u64 = _t17 + } else { + _t19: u64 = 0; + _t2: u64 = _t19 + }; + break +}; +_t20: u64 = _t2; +return _t20 + +--- Assign-Transformed Generated AST +{ + let _t2: u64; + { + let _t1: &Entity = Borrow(Immutable)(self); + loop { + loop { + if (Not(test_variants m::Entity::Person(_t1))) break; + if (Not(Gt(Deref(select_variants m::Entity.id(_t1)), 0))) break; + { + let m::Entity::Person{ id: _t13 } = self; + break[1] + } + }; + if test_variants m::Entity::Institution(_t1) { + { + let m::Entity::Institution{ id: _t17, admin: _t18 } = self; + _t2: u64 = _t17 + } + } else { + _t2: u64 = 0 + }; + break + }; + return _t2 + } +} + +=== Sourcified Output ============================================ +module 0x815::m { + enum Entity has drop { + Person { + id: u64, + } + Institution { + id: u64, + admin: u64, + } + } + fun id(self: &Entity): u64 { + let _t1; + if (self is Person) _t1 = *self.id else if (self is Institution) _t1 = *self.id else abort 14566554180833181697; + _t1 + } + fun id2(self: Entity): u64 { + let _t2; + let _t1 = &self; + 'l0: loop { + loop { + if (!(_t1 is Person)) break; + if (!(*_t1.id > 0)) break; + let Entity::Person{id: _t13} = self; + break 'l0 + }; + if (_t1 is Institution) { + let Entity::Institution{id: _t17,admin: _t18} = self; + _t2 = _t17 + } else _t2 = 0; + break + }; + _t2 + } +} diff --git a/third_party/move/move-model/bytecode/ast-generator-tests/tests/match.move b/third_party/move/move-model/bytecode/ast-generator-tests/tests/match.move new file mode 100644 index 0000000000000..451429e02f126 --- /dev/null +++ b/third_party/move/move-model/bytecode/ast-generator-tests/tests/match.move @@ -0,0 +1,21 @@ +module 0x815::m { + enum Entity has drop { + Person { id: u64 }, + Institution { id: u64, admin: u64 } + } + + fun id(self: &Entity): u64 { + match (self) { + Person{id} => *id, + Institution{id, ..} => *id + } + } + + fun id2(self: Entity): u64 { + match (self) { + Person{id} if id > 0 => id, + Institution{id, ..} => id, + _ => 0 + } + } +} diff --git a/third_party/move/move-model/bytecode/ast-generator-tests/tests/testsuite.rs b/third_party/move/move-model/bytecode/ast-generator-tests/tests/testsuite.rs new file mode 100644 index 0000000000000..067f8f3a8b0b7 --- /dev/null +++ b/third_party/move/move-model/bytecode/ast-generator-tests/tests/testsuite.rs @@ -0,0 +1,133 @@ +// Copyright © Aptos Foundation +// Parts of the project are originally copyright © Meta Platforms, Inc. +// SPDX-License-Identifier: Apache-2.0 + +use codespan_reporting::term::termcolor::Buffer; +use move_compiler_v2::{logging, run_move_compiler_for_analysis, Options}; +use move_model::{ast::Exp, metadata::LanguageVersion, model::GlobalEnv, sourcifier::Sourcifier}; +use move_prover_test_utils::{baseline_test, extract_test_directives}; +use move_stackless_bytecode::{ + astifier, + function_target::FunctionTarget, + function_target_pipeline::{FunctionTargetsHolder, FunctionVariant}, +}; +use std::{ + collections::BTreeSet, + path::{Path, PathBuf}, +}; + +/// Extension for expected output files +pub const EXP_EXT: &str = "exp"; + +datatest_stable::harness!(test_runner, "tests", r".*\.move$"); + +fn test_runner(path: &Path) -> datatest_stable::Result<()> { + logging::setup_logging_for_testing(); + let path_str = path.display().to_string(); + let mut options = Options { + sources_deps: extract_test_directives(path, "// dep:")?, + sources: vec![path_str.clone()], + dependencies: if extract_test_directives(path, "// no-stdlib")?.is_empty() { + vec![path_from_crate_root("../../../move-stdlib/sources")] + } else { + vec![] + }, + named_address_mapping: vec!["std=0x1".to_string()], + ..Options::default() + }; + options = options.set_language_version(LanguageVersion::V2_1); + let mut test_output = String::new(); + let mut error_writer = Buffer::no_color(); + match run_move_compiler_for_analysis(&mut error_writer, options) { + Err(_) => { + test_output.push_str(&format!( + "--- Aborting with compilation errors:\n{}\n", + String::from_utf8_lossy(&error_writer.into_inner()) + )); + }, + Ok(mut env) => { + let targets = create_targets(&env); + let mut modules = BTreeSet::new(); + for fun_id in targets.get_funs() { + let fun_env = env.get_function(fun_id); + modules.insert(fun_env.module_env.get_id()); + let def = generate_output( + &targets.get_target(&env.get_function(fun_id), &FunctionVariant::Baseline), + &mut test_output, + ); + if let Some(def) = def { + env.set_function_def(fun_id, def); + } + } + let sourcifier = Sourcifier::new(&env); + for mid in modules { + sourcifier.print_module(mid) + } + test_output += &format!( + "=== Sourcified Output ============================================\n{}", + sourcifier.result() + ) + }, + } + // Generate/check baseline. + let baseline_path = path.with_extension(EXP_EXT); + baseline_test::verify_or_update_baseline(baseline_path.as_path(), &test_output)?; + Ok(()) +} + +fn generate_output(target: &FunctionTarget, test_output: &mut String) -> Option { + *test_output += &format!( + "\n=== Processing {} =====================================================\n", + target.func_env.get_full_name_str() + ); + *test_output += &format!( + "--- Source\n{}\n", + target + .global_env() + .get_source(&target.get_loc()) + .unwrap_or("UNKNOWN") + ); + + *test_output += &format!("\n--- Stackless Bytecode\n{}\n", target); + + let Some(exp) = astifier::generate_ast_raw(target) else { + *test_output += "--- Raw Generated AST\nFAILED\n"; + return None; + }; + *test_output += &format!( + "--- Raw Generated AST\n{}\n\n", + exp.display_for_fun(target.func_env.clone()) + ); + let exp = astifier::transform_conditionals(target, exp); + *test_output += &format!( + "--- If-Transformed Generated AST\n{}\n\n", + exp.display_for_fun(target.func_env.clone()) + ); + let exp = astifier::transform_assigns(target, exp); + *test_output += &format!( + "--- Assign-Transformed Generated AST\n{}\n\n", + exp.display_for_fun(target.func_env.clone()) + ); + Some(exp) +} + +/// Create function targets with stackless bytecode for modules which are target. +/// This decompiles Move binary format into stackless bytecode. +fn create_targets(env: &GlobalEnv) -> FunctionTargetsHolder { + let mut targets = FunctionTargetsHolder::default(); + for module_env in env.get_modules() { + if module_env.is_primary_target() { + for func_env in module_env.get_functions() { + targets.add_target(&func_env) + } + } + } + targets +} + +/// Returns a path relative to the crate root. +fn path_from_crate_root(path: &str) -> String { + let mut buf = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + buf.push(path); + buf.to_string_lossy().to_string() +} diff --git a/third_party/move/move-model/bytecode/src/astifier.rs b/third_party/move/move-model/bytecode/src/astifier.rs new file mode 100644 index 0000000000000..1f76329dea2e6 --- /dev/null +++ b/third_party/move/move-model/bytecode/src/astifier.rs @@ -0,0 +1,1990 @@ +// Copyright © Aptos Foundation +// Parts of the project are originally copyright © Meta Platforms, Inc. +// SPDX-License-Identifier: Apache-2.0 + +//! Converts stackless bytecode into Model AST. +//! +//! See [this article](https://medium.com/leaningtech/solving-the-structured-control-flow-problem-once-and-for-all-5123117b1ee2) +//! for an introduction into how this code works. This is an excellent high-level overview of +//! the decompilation problem and the solution which is adapted here. The article is a relative +//! light read and hence leaves many details open, which an implementation has to determine. +//! +//! In a nutshell, the decompilation from stackless bytecode into the Model AST here +//! works in the steps outlined below +//! +//! # 1. Cleanup +//! +//! The code is cleaned up such that there are no jump proxies of the form `label L; goto L1`. +//! Also, adjacent sequential blocks are merged, and fallthroughs extended by explicit jumps. +//! It is important for the algorithm to work that all those intermediate blocks are removed +//! and all remaining blocks represent a true branching structure. +//! +//! # 2. Loop Analysis +//! +//! Compute loop information using the `fat_loop` module. This allows to distinguish +//! backward jumps from forward jumps. The fat_loop bails out if the control graph is +//! not reducible. +//! +//! # 3. Topological Sorting +//! +//! Topological sort the blocks using forward edges only. For those blocks which are not related +//! in the partial order, prioritize that for a branch `if c goto L1 else goto L2`, target +//! blocks follow after the branch. Moreover, for any blocks belonging to a loop, ensure that +//! they all appear before any blocks which are part of the loop. +//! +//! # 4. Raw AST Generation +//! +//! The article linked above describes well how blocks can be used to synthesize structured +//! code. However, it leaves open when to open blocks and when to close them. +//! +//! First, in Move, we express blocks (whether they have back jumps and are proper loops or not) +//! by `loop { ..; break }`. Now, in the presence of nested `break[n]` and `continue[n]`, any +//! forward (via break) and backward (via continue) jump can be modelled. +//! +//! ## 4.1 Opening Loops +//! +//! Loops are opened when we either encounter a loop header or a branch. We know what block +//! a loop header is and what are the back edges from (2) above. In the case of +//! branches we need two loops. Consider bytecode for an if-then-else +//! +//! ```ignore +//! if c goto L1 else goto L2 +//! label L1 +//! .. then .. +//! goto L3 +//! label L2 +//! .. else .. +//! goto L3 +//! label L3 +//! .. end .. +//! ``` +//! +//! This is translated to: +//! +//! ```ignore +//! loop { +//! loop { +//! if !c break; +//! .. then .. +//! break[1] +//! } // L2 jumps here +//! .. else .. +//! break +//! } // L3 jumps here +//! ``` +//! +//! Notice at the point when those two loops are opened (on encountering +//! `if c goto L1 else goto L2`), the label `L3` is not known. It appears +//! somewhere later in the sequence of blocks, with an arbitrary number +//! of other blocks in between resulting from nested control flows. +//! The algorithm continues to process the blocks in topological +//! order, opening sub-blocks as needed, until it encounters a jump +//! to a label which is not yet associated with any loop, which is then +//! associated with the unbound loop label. In the above bytecode example, this +//! would be the first `jump L3` in sequence. This is sound +//! because of the way how the blocks were sorted in (3): there are no +//! "interleaving" control flows (as also mentioned in the linked article), +//! and at the moment `L3` is encountered, no other sub-graphs of the control flow +//! have still open blocks. +//! +//! ## 4.2 Closing Loops +//! +//! Loops are closed when their exit label is reached. For the above +//! example, the inner loop is closed on bytecode `label L2` and the +//! outer on `label 3`. Some loops which have been opened may never +//! be associated with a label (for example, in an +//! `if goto L1 else goto L2` where one of the targets is a back jump +//! in a loop). Those are closed when an enclosing loop's label +//! is reached. +//! +//! # 5. AST Transformations +//! +//! Once the raw AST has been generated as described above, it is +//! run through a few transformation steps: +//! +//! 1. *Conditional Transformation* discovers if-then-else +//! expressions from the nested loops as generated by the core +//! algorithm. This is based on pattern matching against the AST. +//! It is possible that the rules used here need to be extended +//! over time, as it is kind of heuristic. +//! 2. *Assignment Transformation* removes obsoletes assignments +//! by propagating reaching definitions. It also introduces +//! `let` declarations for temporaries scoped to a block. +//! +//! A number of tools are defined in this module to perform AST +//! transformations, including a data flow analysis +//! framework for ASTs in the form as generated by the core +//! algorithms. They are kept local here but can be pulled +//! out of this module if more general use cases arise. + +use crate::{ + dataflow_domains::{AbstractDomain, JoinResult, MapDomain, SetDomain}, + fat_loop::{build_loop_info, FatLoopFunctionInfo}, + function_target::FunctionTarget, + stackless_bytecode::{AttrId, Bytecode, Label, Operation as BytecodeOperation}, + stackless_control_flow_graph::{BlockId, StacklessControlFlowGraph}, +}; +use abstract_domain_derive::AbstractDomain; +use itertools::Itertools; +use log::{debug, log_enabled, Level}; +use move_binary_format::file_format::CodeOffset; +use move_model::{ + ast::{Exp, ExpData, Operation, Pattern, TempIndex}, + exp_builder::ExpBuilder, + exp_rewriter::ExpRewriterFunctions, + model::{GlobalEnv, Loc, NodeId, QualifiedInstId, StructId}, + symbol::Symbol, + ty::{ReferenceKind, Type}, +}; +use std::collections::{BTreeMap, BTreeSet}; +use topological_sort::TopologicalSort; + +const DEBUG: bool = false; + +// =========================================================================================== +// Ast Generator + +/// Main entry point for generating AST for a given function target with associated stackless +/// bytecode. +pub fn generate_ast(target: &FunctionTarget) -> Option { + let exp = generate_ast_raw(target)?; + Some(transform_assigns( + target, + transform_conditionals(target, exp), + )) +} + +/// Entry point for raw generation, without prettifying the AST. +pub fn generate_ast_raw(target: &FunctionTarget) -> Option { + // First cleanup the code. In order to make the algorithm work, unnecessary blocks need to + // be eliminated. + let cleanup_context = Context::new(target); + let cleaned_code = cleanup_context.clean_bytecode(); + let mut new_data = target.data.clone(); + new_data.code = cleaned_code; + let target = FunctionTarget::new(target.func_env, &new_data); + + // Now create a new context for working with the cleaned code. + let mut ctx = Context::new(&target); + + let unreached_labels = ctx + // All labels with corresponding blocks in code. + .forward_cfg + .blocks() + .iter() + .filter_map(|blk_id| ctx.label_of_block(*blk_id)) + .collect(); + + let fat_loop_info = match build_loop_info(&target) { + // Compute the fat loops of this code. A fat loop is a loop with multiple back-edges all + // sharing the same loop header. + Ok(loop_info) => loop_info, + Err(err) => { + // This happens if the cfg is not reducible. + // TODO: we may want to have a fallback strategy for this case. We can generate + // a big outer loop with a case for each block and a variable holding the current + // block number. + target.global_env().error( + &target.get_loc(), + &format!("cannot decompile function: {}", err), + ); + return None; + }, + }; + ctx.compute_loop_info(&fat_loop_info); + + // Create the generator and run it. + let mut gen = Generator { + block_stack: vec![], + unreached_labels, + used_labels: BTreeSet::new(), + current_attr: None, + }; + Some(gen.gen(&ctx)) +} + +// ------------------------------------------------------------------------------------------- +// Data Types + +/// Immutable context used for generation. +struct Context<'a> { + /// The function target. + target: &'a FunctionTarget<'a>, + /// Forward control flow graph of the given code. + forward_cfg: StacklessControlFlowGraph, + /// Expression builder. + builder: ExpBuilder<'a>, + /// Mapping from labels to the code offset they are associated with. + label_offsets: BTreeMap, + /// Loop headers. These are the labels of the blocks which dominate all other blocks + /// in a loop. + loop_headers: BTreeSet