mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Extra tests for shadowing within function parameter lists
This commit is contained in:
parent
f59145f21f
commit
362fc6650d
@ -0,0 +1,20 @@
|
|||||||
|
contract C {
|
||||||
|
enum EnumType {A, B, C}
|
||||||
|
|
||||||
|
struct StructType {
|
||||||
|
uint x;
|
||||||
|
}
|
||||||
|
|
||||||
|
function f(StructType memory StructType) external {}
|
||||||
|
function g(EnumType EnumType) external {}
|
||||||
|
function h(EnumType StructType, StructType memory EnumType) external {}
|
||||||
|
|
||||||
|
function z(EnumType e) external returns (uint EnumType) {}
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// Warning 2519: (104-132): This declaration shadows an existing declaration.
|
||||||
|
// Warning 2519: (161-178): This declaration shadows an existing declaration.
|
||||||
|
// Warning 2519: (207-226): This declaration shadows an existing declaration.
|
||||||
|
// Warning 2519: (228-254): This declaration shadows an existing declaration.
|
||||||
|
// Warning 2519: (314-327): This declaration shadows an existing declaration.
|
||||||
|
// TypeError 5172: (104-114): Name has to refer to a struct, enum or contract.
|
@ -0,0 +1,20 @@
|
|||||||
|
library C {
|
||||||
|
enum EnumType {A, B, C}
|
||||||
|
|
||||||
|
struct StructType {
|
||||||
|
uint x;
|
||||||
|
}
|
||||||
|
|
||||||
|
function f1(function (StructType memory StructType) external f) external {}
|
||||||
|
function f2(function (EnumType EnumType) external f) external {}
|
||||||
|
function f3(function (EnumType StructType, StructType memory EnumType) external f) external {}
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// Warning 6162: (114-142): Naming function type parameters is deprecated.
|
||||||
|
// Warning 6162: (194-211): Naming function type parameters is deprecated.
|
||||||
|
// Warning 6162: (263-282): Naming function type parameters is deprecated.
|
||||||
|
// Warning 6162: (284-310): Naming function type parameters is deprecated.
|
||||||
|
// Warning 2519: (114-142): This declaration shadows an existing declaration.
|
||||||
|
// Warning 2519: (194-211): This declaration shadows an existing declaration.
|
||||||
|
// Warning 2519: (263-282): This declaration shadows an existing declaration.
|
||||||
|
// Warning 2519: (284-310): This declaration shadows an existing declaration.
|
@ -0,0 +1,20 @@
|
|||||||
|
contract C {
|
||||||
|
enum EnumType {A, B, C}
|
||||||
|
|
||||||
|
struct StructType {
|
||||||
|
uint x;
|
||||||
|
}
|
||||||
|
|
||||||
|
function f() external returns (StructType memory StructType) {}
|
||||||
|
function g() external returns (EnumType EnumType) {}
|
||||||
|
function h() external returns (EnumType StructType, StructType memory EnumType) {}
|
||||||
|
|
||||||
|
function z(uint EnumType) external returns (EnumType e) {}
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// Warning 2519: (124-152): This declaration shadows an existing declaration.
|
||||||
|
// Warning 2519: (192-209): This declaration shadows an existing declaration.
|
||||||
|
// Warning 2519: (249-268): This declaration shadows an existing declaration.
|
||||||
|
// Warning 2519: (270-296): This declaration shadows an existing declaration.
|
||||||
|
// Warning 2519: (317-330): This declaration shadows an existing declaration.
|
||||||
|
// TypeError 5172: (124-134): Name has to refer to a struct, enum or contract.
|
@ -0,0 +1,20 @@
|
|||||||
|
contract C {
|
||||||
|
enum EnumType {A, B, C}
|
||||||
|
|
||||||
|
struct StructType {
|
||||||
|
uint x;
|
||||||
|
}
|
||||||
|
|
||||||
|
function (StructType memory StructType) external ext1;
|
||||||
|
function (EnumType EnumType) external ext2;
|
||||||
|
function (EnumType StructType, StructType memory EnumType) external ext3;
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// Warning 6162: (103-131): Naming function type parameters is deprecated.
|
||||||
|
// Warning 6162: (162-179): Naming function type parameters is deprecated.
|
||||||
|
// Warning 6162: (210-229): Naming function type parameters is deprecated.
|
||||||
|
// Warning 6162: (231-257): Naming function type parameters is deprecated.
|
||||||
|
// Warning 2519: (103-131): This declaration shadows an existing declaration.
|
||||||
|
// Warning 2519: (162-179): This declaration shadows an existing declaration.
|
||||||
|
// Warning 2519: (210-229): This declaration shadows an existing declaration.
|
||||||
|
// Warning 2519: (231-257): This declaration shadows an existing declaration.
|
@ -0,0 +1,20 @@
|
|||||||
|
contract C {
|
||||||
|
enum EnumType {A, B, C}
|
||||||
|
|
||||||
|
struct StructType {
|
||||||
|
uint x;
|
||||||
|
}
|
||||||
|
|
||||||
|
function () external returns (StructType memory StructType) ext1;
|
||||||
|
function () external returns (EnumType EnumType) ext2;
|
||||||
|
function () external returns (EnumType StructType, StructType memory EnumType) ext3;
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// SyntaxError 7304: (123-151): Return parameters in function types may not be named.
|
||||||
|
// SyntaxError 7304: (193-210): Return parameters in function types may not be named.
|
||||||
|
// SyntaxError 7304: (252-271): Return parameters in function types may not be named.
|
||||||
|
// SyntaxError 7304: (273-299): Return parameters in function types may not be named.
|
||||||
|
// Warning 2519: (123-151): This declaration shadows an existing declaration.
|
||||||
|
// Warning 2519: (193-210): This declaration shadows an existing declaration.
|
||||||
|
// Warning 2519: (252-271): This declaration shadows an existing declaration.
|
||||||
|
// Warning 2519: (273-299): This declaration shadows an existing declaration.
|
@ -0,0 +1,12 @@
|
|||||||
|
contract C {
|
||||||
|
enum E {a, b, c}
|
||||||
|
struct S {function (E X) external f; uint E;}
|
||||||
|
struct T {function (E T) external f; uint E;}
|
||||||
|
struct U {function (E E) external f;}
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// Warning 6162: (58-61): Naming function type parameters is deprecated.
|
||||||
|
// Warning 6162: (108-111): Naming function type parameters is deprecated.
|
||||||
|
// Warning 6162: (158-161): Naming function type parameters is deprecated.
|
||||||
|
// Warning 2519: (108-111): This declaration shadows an existing declaration.
|
||||||
|
// Warning 2519: (158-161): This declaration shadows an existing declaration.
|
Loading…
Reference in New Issue
Block a user