Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eof: Update yulSyntaxTests tests for EOF #15660

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions test/libyul/yulSyntaxTests/builtin_function_literal.yul
cameel marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
datasize(x,1)
}
// ====
// bytecodeFormat: legacy
// ----
// TypeError 7000: (4-12): Function "datasize" expects 1 arguments but got 2.
// TypeError 9114: (4-12): Function expects direct literals as arguments.
Expand Down
2 changes: 2 additions & 0 deletions test/libyul/yulSyntaxTests/datacopy_shadowing.yul
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
function datacopy(a, b, c) {}
}
// ====
// bytecodeFormat: legacy
// ----
// ParserError 5568: (15-23): Cannot use builtin function name "datacopy" as identifier name.
2 changes: 2 additions & 0 deletions test/libyul/yulSyntaxTests/dataoffset_shadowing.yul
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
function dataoffset(a) -> b {}
}
// ====
// bytecodeFormat: legacy
// ----
// ParserError 5568: (15-25): Cannot use builtin function name "dataoffset" as identifier name.
2 changes: 2 additions & 0 deletions test/libyul/yulSyntaxTests/datasize_shadowing.yul
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
function datasize(a) -> b {}
}
// ====
// bytecodeFormat: legacy
// ----
// ParserError 5568: (15-23): Cannot use builtin function name "datasize" as identifier name.
9 changes: 9 additions & 0 deletions test/libyul/yulSyntaxTests/eof/builtin_function_literal.yul
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
auxdataloadn(x,1)
}
// ====
// bytecodeFormat: >=EOFv1
// ----
// TypeError 7000: (6-18): Function "auxdataloadn" expects 1 arguments but got 2.
// TypeError 9114: (6-18): Function expects direct literals as arguments.
// DeclarationError 8198: (19-20): Identifier "x" not found.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
auxdataloadn(auxdataloadn(0))
}
// ====
// bytecodeFormat: >=EOFv1
// dialect: evm
// ----
// TypeError 9114: (6-18): Function expects direct literals as arguments.
3 changes: 1 addition & 2 deletions test/libyul/yulSyntaxTests/hex_switch_case.yul
cameel marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
switch codesize()
switch calldataload(0)
case hex"00" {}
case hex"1122" {}
}
// ----
4 changes: 2 additions & 2 deletions test/libyul/yulSyntaxTests/hex_switch_case_long.yul
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
switch codesize()
switch calldataload(0)
case hex"00" {}
case hex"112233445566778899001122334455667788990011223344556677889900112233445566778899001122334455667788990011223344556677889900" {}
}
// ----
// TypeError 3069: (53-178): String literal too long (60 > 32)
// TypeError 3069: (58-183): String literal too long (60 > 32)
2 changes: 2 additions & 0 deletions test/libyul/yulSyntaxTests/invalid/pc_disallowed.yul
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
pop(pc())
}
// ====
// bytecodeFormat: legacy
// ----
// SyntaxError 2450: (10-12): PC instruction is a low-level EVM feature. Because of that PC is disallowed in strict assembly.
1 change: 1 addition & 0 deletions test/libyul/yulSyntaxTests/loadimmutable.yul
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
}
// ====
// dialect: evm
// bytecodeFormat: legacy
// ----
1 change: 1 addition & 0 deletions test/libyul/yulSyntaxTests/loadimmutable_bad_literal.yul
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
}
// ====
// dialect: evm
// bytecodeFormat: legacy
// ----
// TypeError 5859: (24-25): Function expects string literal.
// TypeError 5859: (50-54): Function expects string literal.
Expand Down
1 change: 1 addition & 0 deletions test/libyul/yulSyntaxTests/loadimmutable_shadowing.yul
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
}
// ====
// dialect: evm
// bytecodeFormat: legacy
// ----
// ParserError 5568: (15-28): Cannot use builtin function name "loadimmutable" as identifier name.
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ object "C" {
}
}
}
// ====
// bytecodeFormat: legacy
// ----
// CodeGenerationError 1284: Some immutables were read from but never assigned, possibly because of optimization.
2 changes: 2 additions & 0 deletions test/libyul/yulSyntaxTests/metadata_access.yul
cameel marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ object "A" {
data ".metadata" "Hello, World!"
data ".other" "Hello, World2!"
}
// ====
// bytecodeFormat: legacy
// ----
// TypeError 3517: (41-49): Unknown data object ".other".
// TypeError 3517: (69-77): Unknown data object ".other".
Expand Down
2 changes: 2 additions & 0 deletions test/libyul/yulSyntaxTests/metadata_access_2.yul
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ object "A" {
data "1" "XYZ"
data ".mightbereservedinthefuture" "TRS"
}
// ====
// bytecodeFormat: legacy
// ----
// TypeError 3517: (90-119): Unknown data object ".mightbereservedinthefuture".
2 changes: 2 additions & 0 deletions test/libyul/yulSyntaxTests/metadata_access_subobject.yul
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ object "A" {
data "x" "ABC"
}
}
// ====
// bytecodeFormat: legacy
// ----
// TypeError 3517: (41-54): Unknown data object ".metadata.x".
2 changes: 2 additions & 0 deletions test/libyul/yulSyntaxTests/objects/data.yul
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ object "A" {
data "2" hex"0011"
data "3" "hello world this is longer than 32 bytes and should still work"
}
// ====
// bytecodeFormat: legacy
// ----
2 changes: 2 additions & 0 deletions test/libyul/yulSyntaxTests/objects/data_access.yul
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ object "A" {

data "B" hex"00"
}
// ====
// bytecodeFormat: legacy
// ----
2 changes: 2 additions & 0 deletions test/libyul/yulSyntaxTests/objects/datacopy.yul
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@
let s := ""
datacopy(x, "11", s)
}
// ====
// bytecodeFormat: legacy
// ----
2 changes: 2 additions & 0 deletions test/libyul/yulSyntaxTests/objects/dataoffset_nonliteral.yul
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ object "A" {

data "B" hex"00"
}
// ====
// bytecodeFormat: legacy
// ----
// TypeError 9114: (47-57): Function expects direct literals as arguments.
2 changes: 2 additions & 0 deletions test/libyul/yulSyntaxTests/objects/dataoffset_nonstring.yul
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ object "A" {
pop(dataoffset(0))
}
}
// ====
// bytecodeFormat: legacy
// ----
// TypeError 5859: (41-42): Function expects string literal.
2 changes: 2 additions & 0 deletions test/libyul/yulSyntaxTests/objects/dataoffset_notfound.yul
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ object "A" {
}
data "B" ""
}
// ====
// bytecodeFormat: legacy
// ----
// TypeError 3517: (41-44): Unknown data object "C".
2 changes: 2 additions & 0 deletions test/libyul/yulSyntaxTests/objects/datasize_nonliteral.yul
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ object "A" {

data "B" hex"00"
}
// ====
// bytecodeFormat: legacy
// ----
// TypeError 9114: (47-55): Function expects direct literals as arguments.
2 changes: 2 additions & 0 deletions test/libyul/yulSyntaxTests/objects/datasize_nonstring.yul
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ object "A" {
pop(datasize(0))
}
}
// ====
// bytecodeFormat: legacy
// ----
// TypeError 5859: (39-40): Function expects string literal.
2 changes: 2 additions & 0 deletions test/libyul/yulSyntaxTests/objects/datasize_notfound.yul
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ object "A" {
}
data "B" ""
}
// ====
// bytecodeFormat: legacy
// ----
// TypeError 3517: (39-42): Unknown data object "C".
2 changes: 2 additions & 0 deletions test/libyul/yulSyntaxTests/objects/subobject_access.yul
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ object "A" {
code {}
}
}
// ====
// bytecodeFormat: legacy
// ----
4 changes: 2 additions & 2 deletions test/libyul/yulSyntaxTests/opcode_for_function_args_1.yul
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
function f(gas) {}
function f(mload) {}
}
// ----
// ParserError 5568: (14-17): Cannot use builtin function name "gas" as identifier name.
// ParserError 5568: (14-19): Cannot use builtin function name "mload" as identifier name.
4 changes: 2 additions & 2 deletions test/libyul/yulSyntaxTests/opcode_for_function_args_2.yul
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
function f() -> gas {}
function f() -> mload {}
}
// ----
// ParserError 5568: (19-22): Cannot use builtin function name "gas" as identifier name.
// ParserError 5568: (19-24): Cannot use builtin function name "mload" as identifier name.
4 changes: 2 additions & 2 deletions test/libyul/yulSyntaxTests/opcode_for_functions.yul
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
function gas() {}
function mload() {}
}
// ----
// ParserError 5568: (12-15): Cannot use builtin function name "gas" as identifier name.
// ParserError 5568: (12-17): Cannot use builtin function name "mload" as identifier name.
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
}
// ====
// dialect: evm
// bytecodeFormat: legacy
// ----
// TypeError 9114: (6-18): Function expects direct literals as arguments.
2 changes: 2 additions & 0 deletions test/libyul/yulSyntaxTests/selfdestruct.yul
cameel marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
selfdestruct(0x02)
}
// ====
// bytecodeFormat: legacy
// ----
// Warning 1699: (3-15): "selfdestruct" has been deprecated. Note that, starting from the Cancun hard fork, the underlying opcode no longer deletes the code and data associated with an account and only transfers its Ether to the beneficiary, unless executed in the same transaction in which the contract was created (see EIP-6780). Any use in newly deployed contracts is strongly discouraged even if the new behavior is taken into account. Future changes to the EVM might further reduce the functionality of the opcode.
1 change: 1 addition & 0 deletions test/libyul/yulSyntaxTests/setimmutable.yul
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
}
// ====
// dialect: evm
// bytecodeFormat: legacy
// ----
1 change: 1 addition & 0 deletions test/libyul/yulSyntaxTests/setimmutable_bad_literal.yul
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
}
// ====
// dialect: evm
// bytecodeFormat: legacy
// ----
// TypeError 5859: (22-23): Function expects string literal.
// TypeError 5859: (89-93): Function expects string literal.
Expand Down
1 change: 1 addition & 0 deletions test/libyul/yulSyntaxTests/setimmutable_shadowing.yul
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
}
// ====
// dialect: evm
// bytecodeFormat: legacy
// ----
// ParserError 5568: (15-27): Cannot use builtin function name "setimmutable" as identifier name.
1 change: 1 addition & 0 deletions test/libyul/yulSyntaxTests/simple_functions.yul
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

msize() does not seem crucial in this test. Let's replace it with, say balance() and the test should pass on EOF as well.

Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
function i() { let z := mload(0) }
}
// ====
// bytecodeFormat: legacy
// dialect: evm
// ----
3 changes: 1 addition & 2 deletions test/libyul/yulSyntaxTests/string_literal_switch_case.yul
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
switch codesize()
switch calldataload(0)
case "1" {}
case "2" {}
}
// ----
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
}
// ====
// dialect: evm
// bytecodeFormat: legacy
// ----