-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure contract pure fns can be called via
ContractName::fn_name()
- Loading branch information
Showing
12 changed files
with
116 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
contract Example { | ||
|
||
pub fn run_test(self) { | ||
assert self.bar(42, 26) == 68 | ||
assert self.bar2(42, 26) == 68 | ||
} | ||
|
||
pub fn bar(self, _ x: u256, _ y: u256) -> u256 { | ||
return pure_bar(x, y) | ||
} | ||
|
||
pub fn bar2(self, _ x: u256, _ y: u256) -> u256 { | ||
return Example::pure_bar(x, y) | ||
} | ||
|
||
fn pure_bar(x: u256, y: u256) -> u256 { | ||
return x + y | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
crates/tests/src/snapshots/fe_compiler_tests__features__case_158.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
source: crates/tests/src/features.rs | ||
expression: "format!(\"{}\", harness.gas_reporter)" | ||
|
||
--- | ||
bar([]) used 102 gas | ||
|
7 changes: 7 additions & 0 deletions
7
crates/tests/src/snapshots/fe_compiler_tests__features__case_159_map_tuple.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
source: crates/tests/src/features.rs | ||
expression: "format!(\"{}\", harness.gas_reporter)" | ||
|
||
--- | ||
bar([Uint(1234)]) used 45055 gas | ||
|
7 changes: 7 additions & 0 deletions
7
crates/tests/src/snapshots/fe_compiler_tests__features__case_160_int_literal_coercion.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
source: crates/tests/src/features.rs | ||
expression: "format!(\"{}\", harness.gas_reporter)" | ||
|
||
--- | ||
bar([]) used 311 gas | ||
|
7 changes: 7 additions & 0 deletions
7
crates/tests/src/snapshots/fe_compiler_tests__features__case_161_associated_fns.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
source: crates/tests/src/features.rs | ||
expression: "format!(\"{}\", harness.gas_reporter)" | ||
|
||
--- | ||
bar([Uint(12)]) used 22698 gas | ||
|
7 changes: 7 additions & 0 deletions
7
crates/tests/src/snapshots/fe_compiler_tests__features__case_162_struct_fns.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
source: crates/tests/src/features.rs | ||
expression: "format!(\"{}\", harness.gas_reporter)" | ||
|
||
--- | ||
bar([Uint(10), Uint(20)]) used 2082 gas | ||
|
7 changes: 7 additions & 0 deletions
7
crates/tests/src/snapshots/fe_compiler_tests__features__case_163_cast_address_to_u256.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
source: crates/tests/src/features.rs | ||
expression: "format!(\"{}\", harness.gas_reporter)" | ||
|
||
--- | ||
bar([Address(0x2012301230123012301230123012301230123002)]) used 192 gas | ||
|
7 changes: 7 additions & 0 deletions
7
crates/tests/src/snapshots/fe_compiler_tests__features__case_164.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
source: crates/tests/src/features.rs | ||
expression: "format!(\"{}\", harness.gas_reporter)" | ||
|
||
--- | ||
bar([Uint(42), Uint(26)]) used 202 gas | ||
|
7 changes: 7 additions & 0 deletions
7
crates/tests/src/snapshots/fe_compiler_tests__features__case_4_contract_pure_fns.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
source: crates/tests/src/features.rs | ||
expression: "format!(\"{}\", harness.gas_reporter)" | ||
|
||
--- | ||
run_test([]) used 35 gas | ||
|