Skip to content

Commit b0c141e

Browse files
committed
Merge branch 'master' of github.com:FuelLabs/sway into vaivaswatha/alloc_intrinsic
2 parents ae93018 + 0682209 commit b0c141e

File tree

67 files changed

+1960
-1919
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+1960
-1919
lines changed

docs/reference/src/documentation/operations/asset/mint/contract.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Mint to Contract
22

3-
We can [`mint`](mint.md) and [`transfer`](../transfer/index.md) the asset to an [`Contract`](../../namespace/contract-id.md).
3+
We can [`mint`](mint.md) and [`transfer`](../transfer/index.md) the asset to a [`Contract`](../../namespace/contract-id.md).
44

55
To use the function we must import it.
66

docs/reference/src/documentation/operations/namespace/contract-id.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The `ContractId` type is a struct containing a value of a `b256` type.
88
{{#include ../../../code/operations/namespace/src/lib.sw:contract_id}}
99
```
1010

11-
Casting between an `ContractId` and `b256` can be done in the following way:
11+
Casting between a `ContractId` and `b256` can be done in the following way:
1212

1313
```sway
1414
{{#include ../../../code/operations/namespace/src/lib.sw:contract_id_cast}}

docs/reference/src/documentation/operations/storage/libraries/storage-vec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ In this example we look at how we can retrieve a single value `balance` and how
3030

3131
Writing to storage is similar to [reading](#reading-from-storage). The difference is that we use a different method `.push(value)` and we use the `read` keyword because the implementation reads the length of the vector to determine where to store the value.
3232

33-
In this example we insert a [tuple](../../../language/built-ins/tuples.md) containing an the [`Identity`](../../namespace/identity.md) of the caller and some `id` into the vector.
33+
In this example we insert a [tuple](../../../language/built-ins/tuples.md) containing the [`Identity`](../../namespace/identity.md) of the caller and some `id` into the vector.
3434

3535
```sway
3636
{{#include ../../../../code/operations/storage/storage_vec/src/main.sw:writing_to_storage}}

sway-ir/src/optimize/constants.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ mod tests {
366366
use crate::{optimize::tests::*, CONST_FOLDING_NAME};
367367

368368
fn assert_operator(t: &str, opcode: &str, l: &str, r: Option<&str>, result: Option<&str>) {
369-
let expected = result.map(|result| format!("v0 = const {t} {result}"));
369+
let expected = result.map(|result| format!("const {t} {result}"));
370370
let expected = expected.as_ref().map(|x| vec![x.as_str()]);
371371
let body = format!(
372372
"
@@ -495,9 +495,9 @@ mod tests {
495495
ret u64 result6, !0
496496
}",
497497
Some([
498-
"v0 = get_local __ptr u64, LOCAL",
499-
"v1 = load v0",
500-
"ret u64 v1",
498+
"v3v1 = get_local __ptr u64, LOCAL",
499+
"v4v1 = load v3v1",
500+
"ret u64 v4v1",
501501
]),
502502
);
503503
}

sway-ir/src/printer.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
77
use std::collections::{BTreeMap, HashMap};
88

9+
use slotmap::Key;
910
use sway_types::SourceEngine;
1011

1112
use crate::{
@@ -1411,7 +1412,7 @@ impl Namer {
14111412

14121413
fn default_name(&mut self, value: &Value) -> String {
14131414
self.names.get(value).cloned().unwrap_or_else(|| {
1414-
let new_name = format!("v{}", self.next_value_idx);
1415+
let new_name = format!("v{:?}", value.0.data());
14151416
self.next_value_idx += 1;
14161417
self.names.insert(*value, new_name.clone());
14171418
new_name
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
// regex: ID=[[:alpha:]_0-9]+
2+
13
script {
24
fn main() -> bool {
35
entry():
46
v0 = const u256 0x0000000000000000000000000000000000000000000000000000000000000000
57
v1 = const u256 0x0000000000000000000000000000000000000000000000000000000000000001
68

79
v10 = cmp eq v0 v0
8-
//check: v0 = const bool true
10+
//check: $ID = const bool true
911
ret bool v10
1012
}
1113
}

sway-ir/tests/constants/u256_ops.ir

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// regex: ID=[[:alpha:]_0-9]+
2+
13
script {
24
fn main() -> u256 {
35
entry():
@@ -22,7 +24,10 @@ script {
2224
v18 = not v17
2325
v19 = not v18
2426
v20 = xor v19, v6
25-
//check: v0 = const u256 0x0000000000000000000000000000000000000000000000000000000000000002
27+
// check: entry
28+
// nextln: $ID = const u256 0x0000000000000000000000000000000000000000000000000000000000000002
29+
// check-not: const
30+
// check: ret
2631
ret u256 v20
2732
}
2833
}

sway-ir/tests/cse/cse1.ir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// regex: ID=[[:alpha:]0-9]+
2-
// regex: VAR=v\d+
2+
// regex: VAR=v\d+v\d+
33

44
script {
55
fn main() -> bool {

sway-ir/tests/cse/cse2.ir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// regex: ID=[[:alpha:]0-9]+
2-
// regex: VAR=v\d+
2+
// regex: VAR=v\d+v\d+
33

44
script {
55
fn main() -> bool {

sway-ir/tests/cse/cse3.ir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// regex: ID=[[:alpha:]0-9]+
2-
// regex: VAR=v\d+
2+
// regex: VAR=v\d+v\d+
33

44
script {
55
entry fn main(a: u64, b: u64) -> () {

0 commit comments

Comments
 (0)