Fix ICE related to receive function having parameters.

This commit is contained in:
hrkrshnn
2021-06-03 13:08:57 +02:00
parent 9be57546db
commit c3eef8af91
14 changed files with 73 additions and 35 deletions
@@ -0,0 +1,12 @@
contract C {
receive(bytes2) {}
}
contract D is C {
receive() {}
}
// ----
// SyntaxError 4937: (17-35): No visibility specified. Did you intend to add "external"?
// SyntaxError 4937: (60-72): No visibility specified. Did you intend to add "external"?
// DeclarationError 7793: (17-35): Receive ether function must be payable, but is "nonpayable".
// DeclarationError 4095: (17-35): Receive ether function must be defined as "external".
// DeclarationError 6857: (24-32): Receive ether function cannot take parameters.
@@ -0,0 +1,8 @@
contract C {
receive() external payable virtual returns(uint) {}
}
contract D is C {
receive() external payable override {}
}
// ----
// DeclarationError 6899: (59-65): Receive ether function cannot return values.
@@ -0,0 +1,13 @@
interface I {
receive(bytes2) external payable;
}
interface J is I {
receive() external payable override;
}
contract C is J {
receive() external payable override {}
}
// ----
// DeclarationError 6857: (25-33): Receive ether function cannot take parameters.
@@ -2,5 +2,5 @@ library C {
receive() external payable {}
}
// ----
// DeclarationError 4549: (16-45): Libraries cannot have receive ether functions.
// TypeError 7708: (16-45): Library functions cannot be payable.
// TypeError 4549: (16-45): Libraries cannot have receive ether functions.
@@ -2,4 +2,4 @@ contract C {
receive(uint256) external payable {}
}
// ----
// TypeError 6857: (24-33): Receive ether function cannot take parameters.
// DeclarationError 6857: (24-33): Receive ether function cannot take parameters.
@@ -4,5 +4,5 @@ contract C {
}
// ----
// SyntaxError 4937: (95-107): No visibility specified. Did you intend to add "external"?
// TypeError 7793: (95-107): Receive ether function must be payable, but is "nonpayable".
// TypeError 4095: (95-107): Receive ether function must be defined as "external".
// DeclarationError 7793: (95-107): Receive ether function must be payable, but is "nonpayable".
// DeclarationError 4095: (95-107): Receive ether function must be defined as "external".
@@ -3,4 +3,4 @@ contract C {
receive() external pure { x = 2; }
}
// ----
// TypeError 7793: (29-63): Receive ether function must be payable, but is "pure".
// DeclarationError 7793: (29-63): Receive ether function must be payable, but is "pure".
@@ -2,5 +2,5 @@ contract C {
receive() external returns (uint256) {}
}
// ----
// TypeError 7793: (17-56): Receive ether function must be payable, but is "nonpayable".
// TypeError 6899: (44-53): Receive ether function cannot return values.
// DeclarationError 7793: (17-56): Receive ether function must be payable, but is "nonpayable".
// DeclarationError 6899: (44-53): Receive ether function cannot return values.
@@ -3,4 +3,4 @@ contract C {
receive() external view { x = 2; }
}
// ----
// TypeError 7793: (29-63): Receive ether function must be payable, but is "view".
// DeclarationError 7793: (29-63): Receive ether function must be payable, but is "view".