mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #9619 from ethereum/yul-tests
Add more syntax tests for Yul
This commit is contained in:
commit
b1fb9da63a
@ -0,0 +1,43 @@
|
||||
contract C {
|
||||
function f() pure public {
|
||||
assembly {
|
||||
dup0()
|
||||
dup1()
|
||||
dup2()
|
||||
dup3()
|
||||
dup4()
|
||||
dup5()
|
||||
dup6()
|
||||
dup7()
|
||||
dup8()
|
||||
dup9()
|
||||
dup10()
|
||||
dup11()
|
||||
dup12()
|
||||
dup13()
|
||||
dup14()
|
||||
dup15()
|
||||
dup16()
|
||||
dup32()
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 4619: (75-79): Function not found.
|
||||
// DeclarationError 4619: (94-98): Function not found.
|
||||
// DeclarationError 4619: (113-117): Function not found.
|
||||
// DeclarationError 4619: (132-136): Function not found.
|
||||
// DeclarationError 4619: (151-155): Function not found.
|
||||
// DeclarationError 4619: (170-174): Function not found.
|
||||
// DeclarationError 4619: (189-193): Function not found.
|
||||
// DeclarationError 4619: (208-212): Function not found.
|
||||
// DeclarationError 4619: (227-231): Function not found.
|
||||
// DeclarationError 4619: (246-250): Function not found.
|
||||
// DeclarationError 4619: (265-270): Function not found.
|
||||
// DeclarationError 4619: (285-290): Function not found.
|
||||
// DeclarationError 4619: (305-310): Function not found.
|
||||
// DeclarationError 4619: (325-330): Function not found.
|
||||
// DeclarationError 4619: (345-350): Function not found.
|
||||
// DeclarationError 4619: (365-370): Function not found.
|
||||
// DeclarationError 4619: (385-390): Function not found.
|
||||
// DeclarationError 4619: (405-410): Function not found.
|
@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
function f() pure public {
|
||||
assembly {
|
||||
jumpdest()
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 4619: (75-83): Function not found.
|
@ -0,0 +1,73 @@
|
||||
contract C {
|
||||
function f() pure public {
|
||||
assembly {
|
||||
push0()
|
||||
push1()
|
||||
push2()
|
||||
push3()
|
||||
push4()
|
||||
push5()
|
||||
push6()
|
||||
push7()
|
||||
push8()
|
||||
push9()
|
||||
push10()
|
||||
push11()
|
||||
push12()
|
||||
push13()
|
||||
push14()
|
||||
push15()
|
||||
push16()
|
||||
push17()
|
||||
push18()
|
||||
push19()
|
||||
push20()
|
||||
push21()
|
||||
push22()
|
||||
push23()
|
||||
push24()
|
||||
push25()
|
||||
push26()
|
||||
push27()
|
||||
push28()
|
||||
push29()
|
||||
push30()
|
||||
push31()
|
||||
push32()
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 4619: (75-80): Function not found.
|
||||
// DeclarationError 4619: (95-100): Function not found.
|
||||
// DeclarationError 4619: (115-120): Function not found.
|
||||
// DeclarationError 4619: (135-140): Function not found.
|
||||
// DeclarationError 4619: (155-160): Function not found.
|
||||
// DeclarationError 4619: (175-180): Function not found.
|
||||
// DeclarationError 4619: (195-200): Function not found.
|
||||
// DeclarationError 4619: (215-220): Function not found.
|
||||
// DeclarationError 4619: (235-240): Function not found.
|
||||
// DeclarationError 4619: (255-260): Function not found.
|
||||
// DeclarationError 4619: (275-281): Function not found.
|
||||
// DeclarationError 4619: (296-302): Function not found.
|
||||
// DeclarationError 4619: (317-323): Function not found.
|
||||
// DeclarationError 4619: (338-344): Function not found.
|
||||
// DeclarationError 4619: (359-365): Function not found.
|
||||
// DeclarationError 4619: (380-386): Function not found.
|
||||
// DeclarationError 4619: (401-407): Function not found.
|
||||
// DeclarationError 4619: (422-428): Function not found.
|
||||
// DeclarationError 4619: (443-449): Function not found.
|
||||
// DeclarationError 4619: (464-470): Function not found.
|
||||
// DeclarationError 4619: (485-491): Function not found.
|
||||
// DeclarationError 4619: (506-512): Function not found.
|
||||
// DeclarationError 4619: (527-533): Function not found.
|
||||
// DeclarationError 4619: (548-554): Function not found.
|
||||
// DeclarationError 4619: (569-575): Function not found.
|
||||
// DeclarationError 4619: (590-596): Function not found.
|
||||
// DeclarationError 4619: (611-617): Function not found.
|
||||
// DeclarationError 4619: (632-638): Function not found.
|
||||
// DeclarationError 4619: (653-659): Function not found.
|
||||
// DeclarationError 4619: (674-680): Function not found.
|
||||
// DeclarationError 4619: (695-701): Function not found.
|
||||
// DeclarationError 4619: (716-722): Function not found.
|
||||
// DeclarationError 4619: (737-743): Function not found.
|
@ -0,0 +1,43 @@
|
||||
contract C {
|
||||
function f() pure public {
|
||||
assembly {
|
||||
swap0()
|
||||
swap1()
|
||||
swap2()
|
||||
swap3()
|
||||
swap4()
|
||||
swap5()
|
||||
swap6()
|
||||
swap7()
|
||||
swap8()
|
||||
swap9()
|
||||
swap10()
|
||||
swap11()
|
||||
swap12()
|
||||
swap13()
|
||||
swap14()
|
||||
swap15()
|
||||
swap16()
|
||||
swap32()
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 4619: (75-80): Function not found.
|
||||
// DeclarationError 4619: (95-100): Function not found.
|
||||
// DeclarationError 4619: (115-120): Function not found.
|
||||
// DeclarationError 4619: (135-140): Function not found.
|
||||
// DeclarationError 4619: (155-160): Function not found.
|
||||
// DeclarationError 4619: (175-180): Function not found.
|
||||
// DeclarationError 4619: (195-200): Function not found.
|
||||
// DeclarationError 4619: (215-220): Function not found.
|
||||
// DeclarationError 4619: (235-240): Function not found.
|
||||
// DeclarationError 4619: (255-260): Function not found.
|
||||
// DeclarationError 4619: (275-281): Function not found.
|
||||
// DeclarationError 4619: (296-302): Function not found.
|
||||
// DeclarationError 4619: (317-323): Function not found.
|
||||
// DeclarationError 4619: (338-344): Function not found.
|
||||
// DeclarationError 4619: (359-365): Function not found.
|
||||
// DeclarationError 4619: (380-386): Function not found.
|
||||
// DeclarationError 4619: (401-407): Function not found.
|
||||
// DeclarationError 4619: (422-428): Function not found.
|
5
test/libyul/yulSyntaxTests/datacopy_shadowing.yul
Normal file
5
test/libyul/yulSyntaxTests/datacopy_shadowing.yul
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
function datacopy(a, b, c) {}
|
||||
}
|
||||
// ----
|
||||
// ParserError 5568: (15-23): Cannot use builtin function name "datacopy" as identifier name.
|
5
test/libyul/yulSyntaxTests/dataoffset_shadowing.yul
Normal file
5
test/libyul/yulSyntaxTests/dataoffset_shadowing.yul
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
function dataoffset(a) -> b {}
|
||||
}
|
||||
// ----
|
||||
// ParserError 5568: (15-25): Cannot use builtin function name "dataoffset" as identifier name.
|
5
test/libyul/yulSyntaxTests/datasize_shadowing.yul
Normal file
5
test/libyul/yulSyntaxTests/datasize_shadowing.yul
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
function datasize(a) -> b {}
|
||||
}
|
||||
// ----
|
||||
// ParserError 5568: (15-23): Cannot use builtin function name "datasize" as identifier name.
|
39
test/libyul/yulSyntaxTests/invalid/dup_disallowed.yul
Normal file
39
test/libyul/yulSyntaxTests/invalid/dup_disallowed.yul
Normal file
@ -0,0 +1,39 @@
|
||||
{
|
||||
dup0()
|
||||
dup1()
|
||||
dup2()
|
||||
dup3()
|
||||
dup4()
|
||||
dup5()
|
||||
dup6()
|
||||
dup7()
|
||||
dup8()
|
||||
dup9()
|
||||
dup10()
|
||||
dup11()
|
||||
dup12()
|
||||
dup13()
|
||||
dup14()
|
||||
dup15()
|
||||
dup16()
|
||||
dup32()
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 4619: (6-10): Function not found.
|
||||
// DeclarationError 4619: (17-21): Function not found.
|
||||
// DeclarationError 4619: (28-32): Function not found.
|
||||
// DeclarationError 4619: (39-43): Function not found.
|
||||
// DeclarationError 4619: (50-54): Function not found.
|
||||
// DeclarationError 4619: (61-65): Function not found.
|
||||
// DeclarationError 4619: (72-76): Function not found.
|
||||
// DeclarationError 4619: (83-87): Function not found.
|
||||
// DeclarationError 4619: (94-98): Function not found.
|
||||
// DeclarationError 4619: (105-109): Function not found.
|
||||
// DeclarationError 4619: (116-121): Function not found.
|
||||
// DeclarationError 4619: (128-133): Function not found.
|
||||
// DeclarationError 4619: (140-145): Function not found.
|
||||
// DeclarationError 4619: (152-157): Function not found.
|
||||
// DeclarationError 4619: (164-169): Function not found.
|
||||
// DeclarationError 4619: (176-181): Function not found.
|
||||
// DeclarationError 4619: (188-193): Function not found.
|
||||
// DeclarationError 4619: (200-205): Function not found.
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
let x := 0100
|
||||
}
|
||||
// ----
|
||||
// ParserError 1856: (15-16): Literal or identifier expected.
|
5
test/libyul/yulSyntaxTests/invalid/jump_disallowed.yul
Normal file
5
test/libyul/yulSyntaxTests/invalid/jump_disallowed.yul
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
jump(2)
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 4619: (6-10): Function not found.
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
jumpdest()
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 4619: (6-14): Function not found.
|
5
test/libyul/yulSyntaxTests/invalid/jumpi_disallowed.yul
Normal file
5
test/libyul/yulSyntaxTests/invalid/jumpi_disallowed.yul
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
jumpi(2, 1)
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 4619: (6-11): Function not found.
|
5
test/libyul/yulSyntaxTests/invalid/label_disallowed.yul
Normal file
5
test/libyul/yulSyntaxTests/invalid/label_disallowed.yul
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
label:
|
||||
}
|
||||
// ----
|
||||
// ParserError 6913: (11-12): Call or assignment expected.
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
mload(0)
|
||||
}
|
||||
// ----
|
||||
// TypeError 3083: (6-14): Top-level expressions are not supposed to return values (this expression returns 1 value). Use ``pop()`` or assign them.
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
1
|
||||
}
|
||||
// ----
|
||||
// ParserError 6913: (8-9): Call or assignment expected.
|
69
test/libyul/yulSyntaxTests/invalid/push_disallowed.yul
Normal file
69
test/libyul/yulSyntaxTests/invalid/push_disallowed.yul
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
push0()
|
||||
push1()
|
||||
push2()
|
||||
push3()
|
||||
push4()
|
||||
push5()
|
||||
push6()
|
||||
push7()
|
||||
push8()
|
||||
push9()
|
||||
push10()
|
||||
push11()
|
||||
push12()
|
||||
push13()
|
||||
push14()
|
||||
push15()
|
||||
push16()
|
||||
push17()
|
||||
push18()
|
||||
push19()
|
||||
push20()
|
||||
push21()
|
||||
push22()
|
||||
push23()
|
||||
push24()
|
||||
push25()
|
||||
push26()
|
||||
push27()
|
||||
push28()
|
||||
push29()
|
||||
push30()
|
||||
push31()
|
||||
push32()
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 4619: (6-11): Function not found.
|
||||
// DeclarationError 4619: (18-23): Function not found.
|
||||
// DeclarationError 4619: (30-35): Function not found.
|
||||
// DeclarationError 4619: (42-47): Function not found.
|
||||
// DeclarationError 4619: (54-59): Function not found.
|
||||
// DeclarationError 4619: (66-71): Function not found.
|
||||
// DeclarationError 4619: (78-83): Function not found.
|
||||
// DeclarationError 4619: (90-95): Function not found.
|
||||
// DeclarationError 4619: (102-107): Function not found.
|
||||
// DeclarationError 4619: (114-119): Function not found.
|
||||
// DeclarationError 4619: (126-132): Function not found.
|
||||
// DeclarationError 4619: (139-145): Function not found.
|
||||
// DeclarationError 4619: (152-158): Function not found.
|
||||
// DeclarationError 4619: (165-171): Function not found.
|
||||
// DeclarationError 4619: (178-184): Function not found.
|
||||
// DeclarationError 4619: (191-197): Function not found.
|
||||
// DeclarationError 4619: (204-210): Function not found.
|
||||
// DeclarationError 4619: (217-223): Function not found.
|
||||
// DeclarationError 4619: (230-236): Function not found.
|
||||
// DeclarationError 4619: (243-249): Function not found.
|
||||
// DeclarationError 4619: (256-262): Function not found.
|
||||
// DeclarationError 4619: (269-275): Function not found.
|
||||
// DeclarationError 4619: (282-288): Function not found.
|
||||
// DeclarationError 4619: (295-301): Function not found.
|
||||
// DeclarationError 4619: (308-314): Function not found.
|
||||
// DeclarationError 4619: (321-327): Function not found.
|
||||
// DeclarationError 4619: (334-340): Function not found.
|
||||
// DeclarationError 4619: (347-353): Function not found.
|
||||
// DeclarationError 4619: (360-366): Function not found.
|
||||
// DeclarationError 4619: (373-379): Function not found.
|
||||
// DeclarationError 4619: (386-392): Function not found.
|
||||
// DeclarationError 4619: (399-405): Function not found.
|
||||
// DeclarationError 4619: (412-418): Function not found.
|
39
test/libyul/yulSyntaxTests/invalid/swap_disallowed.yul
Normal file
39
test/libyul/yulSyntaxTests/invalid/swap_disallowed.yul
Normal file
@ -0,0 +1,39 @@
|
||||
{
|
||||
swap0()
|
||||
swap1()
|
||||
swap2()
|
||||
swap3()
|
||||
swap4()
|
||||
swap5()
|
||||
swap6()
|
||||
swap7()
|
||||
swap8()
|
||||
swap9()
|
||||
swap10()
|
||||
swap11()
|
||||
swap12()
|
||||
swap13()
|
||||
swap14()
|
||||
swap15()
|
||||
swap16()
|
||||
swap32()
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 4619: (6-11): Function not found.
|
||||
// DeclarationError 4619: (18-23): Function not found.
|
||||
// DeclarationError 4619: (30-35): Function not found.
|
||||
// DeclarationError 4619: (42-47): Function not found.
|
||||
// DeclarationError 4619: (54-59): Function not found.
|
||||
// DeclarationError 4619: (66-71): Function not found.
|
||||
// DeclarationError 4619: (78-83): Function not found.
|
||||
// DeclarationError 4619: (90-95): Function not found.
|
||||
// DeclarationError 4619: (102-107): Function not found.
|
||||
// DeclarationError 4619: (114-119): Function not found.
|
||||
// DeclarationError 4619: (126-132): Function not found.
|
||||
// DeclarationError 4619: (139-145): Function not found.
|
||||
// DeclarationError 4619: (152-158): Function not found.
|
||||
// DeclarationError 4619: (165-171): Function not found.
|
||||
// DeclarationError 4619: (178-184): Function not found.
|
||||
// DeclarationError 4619: (191-197): Function not found.
|
||||
// DeclarationError 4619: (204-210): Function not found.
|
||||
// DeclarationError 4619: (217-223): Function not found.
|
7
test/libyul/yulSyntaxTests/linkersymbol_shadowing.yul
Normal file
7
test/libyul/yulSyntaxTests/linkersymbol_shadowing.yul
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
function linkersymbol(a) {}
|
||||
}
|
||||
// ====
|
||||
// dialect: evm
|
||||
// ----
|
||||
// ParserError 5568: (15-27): Cannot use builtin function name "linkersymbol" as identifier name.
|
7
test/libyul/yulSyntaxTests/loadimmutable_shadowing.yul
Normal file
7
test/libyul/yulSyntaxTests/loadimmutable_shadowing.yul
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
function loadimmutable(a) {}
|
||||
}
|
||||
// ====
|
||||
// dialect: evm
|
||||
// ----
|
||||
// ParserError 5568: (15-28): Cannot use builtin function name "loadimmutable" as identifier name.
|
7
test/libyul/yulSyntaxTests/setimmutable_shadowing.yul
Normal file
7
test/libyul/yulSyntaxTests/setimmutable_shadowing.yul
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
function setimmutable(a, b) {}
|
||||
}
|
||||
// ====
|
||||
// dialect: evm
|
||||
// ----
|
||||
// ParserError 5568: (15-27): Cannot use builtin function name "setimmutable" as identifier name.
|
Loading…
Reference in New Issue
Block a user