aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/syntaxTests
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2019-01-22 20:49:41 +0800
committerGitHub <noreply@github.com>2019-01-22 20:49:41 +0800
commit10d17f245839f208ec5085309022a32cd2502f55 (patch)
treeb2c9f68980d0d418cd6f511e9f3f3f71369abe25 /test/libsolidity/syntaxTests
parent1df8f40cd2fd7b47698d847907b8ca7b47eb488d (diff)
parent0ecafe032a84cb6960545dd7f18733430c1f782d (diff)
downloaddexon-solidity-10d17f245839f208ec5085309022a32cd2502f55.tar
dexon-solidity-10d17f245839f208ec5085309022a32cd2502f55.tar.gz
dexon-solidity-10d17f245839f208ec5085309022a32cd2502f55.tar.bz2
dexon-solidity-10d17f245839f208ec5085309022a32cd2502f55.tar.lz
dexon-solidity-10d17f245839f208ec5085309022a32cd2502f55.tar.xz
dexon-solidity-10d17f245839f208ec5085309022a32cd2502f55.tar.zst
dexon-solidity-10d17f245839f208ec5085309022a32cd2502f55.zip
Merge pull request #5836 from ethereum/develop
Merge develop into release for 0.5.3.
Diffstat (limited to 'test/libsolidity/syntaxTests')
-rw-r--r--test/libsolidity/syntaxTests/controlFlow/storageReturn/dowhile_err.sol4
-rw-r--r--test/libsolidity/syntaxTests/controlFlow/storageReturn/dowhile_fine.sol1
-rw-r--r--test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/always_revert.sol4
-rw-r--r--test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/unreachable.sol1
-rw-r--r--test/libsolidity/syntaxTests/controlFlow/unreachableCode/comment_fine.sol6
-rw-r--r--test/libsolidity/syntaxTests/controlFlow/unreachableCode/constant_condition.sol8
-rw-r--r--test/libsolidity/syntaxTests/controlFlow/unreachableCode/do_while_continue.sol12
-rw-r--r--test/libsolidity/syntaxTests/controlFlow/unreachableCode/double_return.sol8
-rw-r--r--test/libsolidity/syntaxTests/controlFlow/unreachableCode/double_revert.sol8
-rw-r--r--test/libsolidity/syntaxTests/controlFlow/unreachableCode/for_break.sol12
-rw-r--r--test/libsolidity/syntaxTests/controlFlow/unreachableCode/if_both_return.sol12
-rw-r--r--test/libsolidity/syntaxTests/controlFlow/unreachableCode/revert.sol8
-rw-r--r--test/libsolidity/syntaxTests/controlFlow/unreachableCode/revert_empty.sol8
-rw-r--r--test/libsolidity/syntaxTests/controlFlow/unreachableCode/while_break.sol12
-rw-r--r--test/libsolidity/syntaxTests/controlFlow/unreachableCode/while_continue.sol11
-rw-r--r--test/libsolidity/syntaxTests/inheritance/override/calldata_memory_struct.sol4
-rw-r--r--test/libsolidity/syntaxTests/metaTypes/codeAccess.sol12
-rw-r--r--test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractCreation.sol10
-rw-r--r--test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractRuntime.sol10
-rw-r--r--test/libsolidity/syntaxTests/metaTypes/codeAccessBase.sol22
-rw-r--r--test/libsolidity/syntaxTests/metaTypes/codeAccessCyclic.sol12
-rw-r--r--test/libsolidity/syntaxTests/metaTypes/codeAccessIsConstant.sol7
-rw-r--r--test/libsolidity/syntaxTests/metaTypes/codeAccessLibrary.sol12
-rw-r--r--test/libsolidity/syntaxTests/metaTypes/codeIsNoLValue.sol10
-rw-r--r--test/libsolidity/syntaxTests/metaTypes/noArgForType.sol7
-rw-r--r--test/libsolidity/syntaxTests/metaTypes/runtimeCodeWarningAssembly.sol17
-rw-r--r--test/libsolidity/syntaxTests/metaTypes/tooManyArgsForType.sol7
-rw-r--r--test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierContractName.sol3
-rw-r--r--test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierFunction.sol6
-rw-r--r--test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierParameter.sol6
-rw-r--r--test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierStateVariable.sol5
-rw-r--r--test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierVariable.sol7
-rw-r--r--test/libsolidity/syntaxTests/metaTypes/typeOfContract.sol6
-rw-r--r--test/libsolidity/syntaxTests/metaTypes/typeRecursive.sol8
-rw-r--r--test/libsolidity/syntaxTests/metaTypes/unsupportedArgForType.sol9
-rw-r--r--test/libsolidity/syntaxTests/parsing/for_loop_simple_initexpr.sol2
-rw-r--r--test/libsolidity/syntaxTests/parsing/for_loop_simple_noexpr.sol1
-rw-r--r--test/libsolidity/syntaxTests/parsing/for_loop_vardef_initexpr.sol2
-rw-r--r--test/libsolidity/syntaxTests/parsing/while_loop.sol1
-rw-r--r--test/libsolidity/syntaxTests/structs/array_calldata.sol10
-rw-r--r--test/libsolidity/syntaxTests/structs/calldata.sol8
-rw-r--r--test/libsolidity/syntaxTests/types/encoding_fractional.sol7
-rw-r--r--test/libsolidity/syntaxTests/types/encoding_fractional_abiencoderv2.sol9
-rw-r--r--test/libsolidity/syntaxTests/types/encoding_packed_fractional.sol8
-rw-r--r--test/libsolidity/syntaxTests/types/encoding_packed_fractional_abiencoderv2.sol10
45 files changed, 352 insertions, 1 deletions
diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/dowhile_err.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/dowhile_err.sol
index b868d61d..c7e3eacd 100644
--- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/dowhile_err.sol
+++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/dowhile_err.sol
@@ -46,7 +46,11 @@ contract C {
}
// ----
// TypeError: (87-98): This variable is of storage pointer type and can be returned without prior assignment.
+// Warning: (146-151): Unreachable code.
+// Warning: (169-174): Unreachable code.
// TypeError: (223-234): This variable is of storage pointer type and can be returned without prior assignment.
+// Warning: (316-321): Unreachable code.
// TypeError: (440-451): This variable is of storage pointer type and can be returned without prior assignment.
// TypeError: (654-665): This variable is of storage pointer type and can be returned without prior assignment.
// TypeError: (871-882): This variable is of storage pointer type and can be returned without prior assignment.
+// Warning: (933-938): Unreachable code.
diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/dowhile_fine.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/dowhile_fine.sol
index 55c5edd3..5a113668 100644
--- a/test/libsolidity/syntaxTests/controlFlow/storageReturn/dowhile_fine.sol
+++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/dowhile_fine.sol
@@ -29,3 +29,4 @@ contract C {
}
}
// ----
+// Warning: (567-572): Unreachable code.
diff --git a/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/always_revert.sol b/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/always_revert.sol
index 96767402..da7f1a90 100644
--- a/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/always_revert.sol
+++ b/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/always_revert.sol
@@ -5,4 +5,6 @@ contract C {
revert();
b;
}
-} \ No newline at end of file
+}
+// ----
+// Warning: (125-126): Unreachable code.
diff --git a/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/unreachable.sol b/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/unreachable.sol
index b941ad34..9ebd0321 100644
--- a/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/unreachable.sol
+++ b/test/libsolidity/syntaxTests/controlFlow/uninitializedAccess/unreachable.sol
@@ -8,3 +8,4 @@ contract C {
}
}
// ----
+// Warning: (112-135): Unreachable code.
diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/comment_fine.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/comment_fine.sol
new file mode 100644
index 00000000..17119ca6
--- /dev/null
+++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/comment_fine.sol
@@ -0,0 +1,6 @@
+contract C {
+ function f() public pure {
+ return;
+ // unreachable comment
+ }
+}
diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/constant_condition.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/constant_condition.sol
new file mode 100644
index 00000000..e00398bc
--- /dev/null
+++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/constant_condition.sol
@@ -0,0 +1,8 @@
+contract C {
+ function f() public pure {
+ if (false) {
+ return; // unreachable, but not yet detected
+ }
+ return;
+ }
+}
diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/do_while_continue.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/do_while_continue.sol
new file mode 100644
index 00000000..363c53e1
--- /dev/null
+++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/do_while_continue.sol
@@ -0,0 +1,12 @@
+contract C {
+ function f() public pure {
+ do {
+ uint a = 42; a;
+ continue;
+ return; // this is unreachable
+ } while(false);
+ return; // this is still reachable
+ }
+}
+// ----
+// Warning: (119-126): Unreachable code.
diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/double_return.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/double_return.sol
new file mode 100644
index 00000000..9b755347
--- /dev/null
+++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/double_return.sol
@@ -0,0 +1,8 @@
+contract C {
+ function f() public pure returns (uint) {
+ return 0;
+ return 0;
+ }
+}
+// ----
+// Warning: (85-93): Unreachable code.
diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/double_revert.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/double_revert.sol
new file mode 100644
index 00000000..a6457e4f
--- /dev/null
+++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/double_revert.sol
@@ -0,0 +1,8 @@
+contract C {
+ function f() public pure {
+ revert();
+ revert();
+ }
+}
+// ----
+// Warning: (70-78): Unreachable code.
diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/for_break.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/for_break.sol
new file mode 100644
index 00000000..496addb2
--- /dev/null
+++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/for_break.sol
@@ -0,0 +1,12 @@
+contract C {
+ function f() public pure {
+ for (uint a = 0; a < 1; a++) {
+ break;
+ uint b = 42; b;
+ }
+ return;
+ }
+}
+// ----
+// Warning: (76-79): Unreachable code.
+// Warning: (114-128): Unreachable code.
diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/if_both_return.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/if_both_return.sol
new file mode 100644
index 00000000..3513b17d
--- /dev/null
+++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/if_both_return.sol
@@ -0,0 +1,12 @@
+contract C {
+ function f(bool c) public pure {
+ if (c) {
+ return;
+ } else {
+ return;
+ }
+ return; // unreachable
+ }
+}
+// ----
+// Warning: (142-149): Unreachable code.
diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/revert.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/revert.sol
new file mode 100644
index 00000000..9bb6a41c
--- /dev/null
+++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/revert.sol
@@ -0,0 +1,8 @@
+contract C {
+ function f() public pure {
+ revert();
+ uint a = 0; a;
+ }
+}
+// ----
+// Warning: (70-83): Unreachable code.
diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/revert_empty.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/revert_empty.sol
new file mode 100644
index 00000000..4c80c5ca
--- /dev/null
+++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/revert_empty.sol
@@ -0,0 +1,8 @@
+contract C {
+ function f() public pure {
+ revert();
+ for(int i = 0; i < 3; i++) { f(); }
+ }
+}
+// ----
+// Warning: (70-105): Unreachable code.
diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/while_break.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/while_break.sol
new file mode 100644
index 00000000..2d1ddd4f
--- /dev/null
+++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/while_break.sol
@@ -0,0 +1,12 @@
+contract C {
+ function f() public pure {
+ uint a = 0;
+ while (a < 100) {
+ a++;
+ break;
+ a--;
+ }
+ }
+}
+// ----
+// Warning: (138-141): Unreachable code.
diff --git a/test/libsolidity/syntaxTests/controlFlow/unreachableCode/while_continue.sol b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/while_continue.sol
new file mode 100644
index 00000000..55f98f67
--- /dev/null
+++ b/test/libsolidity/syntaxTests/controlFlow/unreachableCode/while_continue.sol
@@ -0,0 +1,11 @@
+contract C {
+ function f() public pure {
+ while(true) {
+ continue;
+ return;
+ }
+ return; // this is unreachable as well, but currently undetected (needs to consider constant condition "true")
+ }
+}
+// ----
+// Warning: (100-107): Unreachable code.
diff --git a/test/libsolidity/syntaxTests/inheritance/override/calldata_memory_struct.sol b/test/libsolidity/syntaxTests/inheritance/override/calldata_memory_struct.sol
index 42aebf30..b81e3859 100644
--- a/test/libsolidity/syntaxTests/inheritance/override/calldata_memory_struct.sol
+++ b/test/libsolidity/syntaxTests/inheritance/override/calldata_memory_struct.sol
@@ -15,3 +15,7 @@ contract B is A {
}
// ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
+// TypeError: (102-112): Calldata structs are not yet supported.
+// TypeError: (146-156): Calldata structs are not yet supported.
+// TypeError: (198-208): Calldata structs are not yet supported.
+// TypeError: (250-260): Calldata structs are not yet supported.
diff --git a/test/libsolidity/syntaxTests/metaTypes/codeAccess.sol b/test/libsolidity/syntaxTests/metaTypes/codeAccess.sol
new file mode 100644
index 00000000..e90443e1
--- /dev/null
+++ b/test/libsolidity/syntaxTests/metaTypes/codeAccess.sol
@@ -0,0 +1,12 @@
+contract Test {
+ function creationOther() public pure returns (bytes memory) {
+ return type(Other).creationCode;
+ }
+ function runtimeOther() public pure returns (bytes memory) {
+ return type(Other).runtimeCode;
+ }
+}
+contract Other {
+ function f(uint) public pure returns (uint) {}
+}
+// ----
diff --git a/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractCreation.sol b/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractCreation.sol
new file mode 100644
index 00000000..bae137c5
--- /dev/null
+++ b/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractCreation.sol
@@ -0,0 +1,10 @@
+contract Test {
+ function creationOther() public pure returns (bytes memory) {
+ return type(Other).creationCode;
+ }
+}
+contract Other {
+ function f(uint) public returns (uint);
+}
+// ----
+// TypeError: (97-121): Member "creationCode" not found or not visible after argument-dependent lookup in type(contract Other).
diff --git a/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractRuntime.sol b/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractRuntime.sol
new file mode 100644
index 00000000..186d2714
--- /dev/null
+++ b/test/libsolidity/syntaxTests/metaTypes/codeAccessAbstractRuntime.sol
@@ -0,0 +1,10 @@
+contract Test {
+ function runtime() public pure returns (bytes memory) {
+ return type(Other).runtimeCode;
+ }
+}
+contract Other {
+ function f(uint) public returns (uint);
+}
+// ----
+// TypeError: (91-114): Member "runtimeCode" not found or not visible after argument-dependent lookup in type(contract Other).
diff --git a/test/libsolidity/syntaxTests/metaTypes/codeAccessBase.sol b/test/libsolidity/syntaxTests/metaTypes/codeAccessBase.sol
new file mode 100644
index 00000000..33dbfd7c
--- /dev/null
+++ b/test/libsolidity/syntaxTests/metaTypes/codeAccessBase.sol
@@ -0,0 +1,22 @@
+contract Base {
+ function f() public pure returns (uint) {}
+}
+contract Test is Base {
+ function creation() public pure returns (bytes memory) {
+ return type(Test).creationCode;
+ }
+ function runtime() public pure returns (bytes memory) {
+ return type(Test).runtimeCode;
+ }
+ function creationBase() public pure returns (bytes memory) {
+ return type(Base).creationCode;
+ }
+ function runtimeBase() public pure returns (bytes memory) {
+ return type(Base).runtimeCode;
+ }
+}
+// ----
+// TypeError: (165-188): Circular reference for contract code access.
+// TypeError: (271-293): Circular reference for contract code access.
+// TypeError: (381-404): Circular reference for contract code access.
+// TypeError: (491-513): Circular reference for contract code access.
diff --git a/test/libsolidity/syntaxTests/metaTypes/codeAccessCyclic.sol b/test/libsolidity/syntaxTests/metaTypes/codeAccessCyclic.sol
new file mode 100644
index 00000000..d5723df6
--- /dev/null
+++ b/test/libsolidity/syntaxTests/metaTypes/codeAccessCyclic.sol
@@ -0,0 +1,12 @@
+contract A {
+ function f() public pure {
+ type(B).runtimeCode;
+ }
+}
+contract B {
+ function f() public pure {
+ type(A).runtimeCode;
+ }
+}
+// ----
+// TypeError: (133-152): Circular reference for contract code access.
diff --git a/test/libsolidity/syntaxTests/metaTypes/codeAccessIsConstant.sol b/test/libsolidity/syntaxTests/metaTypes/codeAccessIsConstant.sol
new file mode 100644
index 00000000..cda5d5c3
--- /dev/null
+++ b/test/libsolidity/syntaxTests/metaTypes/codeAccessIsConstant.sol
@@ -0,0 +1,7 @@
+contract Test {
+ bytes constant c = type(B).creationCode;
+ bytes constant r = type(B).runtimeCode;
+
+}
+contract B { function f() public pure {} }
+// ----
diff --git a/test/libsolidity/syntaxTests/metaTypes/codeAccessLibrary.sol b/test/libsolidity/syntaxTests/metaTypes/codeAccessLibrary.sol
new file mode 100644
index 00000000..f746dc35
--- /dev/null
+++ b/test/libsolidity/syntaxTests/metaTypes/codeAccessLibrary.sol
@@ -0,0 +1,12 @@
+contract Test {
+ function creationOther() public pure returns (bytes memory) {
+ return type(Library).creationCode;
+ }
+ function runtime() public pure returns (bytes memory) {
+ return type(Library).runtimeCode;
+ }
+}
+contract Library {
+ function f(uint) public pure returns (uint) {}
+}
+// ----
diff --git a/test/libsolidity/syntaxTests/metaTypes/codeIsNoLValue.sol b/test/libsolidity/syntaxTests/metaTypes/codeIsNoLValue.sol
new file mode 100644
index 00000000..022e4d6f
--- /dev/null
+++ b/test/libsolidity/syntaxTests/metaTypes/codeIsNoLValue.sol
@@ -0,0 +1,10 @@
+contract Test {
+ function f() public pure {
+ type(C).creationCode = new bytes(6);
+ type(C).runtimeCode = new bytes(6);
+ }
+}
+contract C {}
+// ----
+// TypeError: (55-75): Expression has to be an lvalue.
+// TypeError: (100-119): Expression has to be an lvalue.
diff --git a/test/libsolidity/syntaxTests/metaTypes/noArgForType.sol b/test/libsolidity/syntaxTests/metaTypes/noArgForType.sol
new file mode 100644
index 00000000..542aaf53
--- /dev/null
+++ b/test/libsolidity/syntaxTests/metaTypes/noArgForType.sol
@@ -0,0 +1,7 @@
+contract Test {
+ function creation() public pure returns (bytes memory) {
+ type();
+ }
+}
+// ----
+// TypeError: (85-91): This function takes one argument, but 0 were provided.
diff --git a/test/libsolidity/syntaxTests/metaTypes/runtimeCodeWarningAssembly.sol b/test/libsolidity/syntaxTests/metaTypes/runtimeCodeWarningAssembly.sol
new file mode 100644
index 00000000..ec8d9784
--- /dev/null
+++ b/test/libsolidity/syntaxTests/metaTypes/runtimeCodeWarningAssembly.sol
@@ -0,0 +1,17 @@
+contract Test {
+ function f() public pure returns (uint) {
+ return type(C).runtimeCode.length +
+ type(D).runtimeCode.length +
+ type(C).creationCode.length +
+ type(D).creationCode.length;
+ }
+}
+contract C {
+ constructor() public { assembly {} }
+}
+contract D is C {
+ constructor() public {}
+}
+// ----
+// Warning: (77-96): The constructor of the contract (or its base) uses inline assembly. Because of that, it might be that the deployed bytecode is different from type(...).runtimeCode.
+// Warning: (118-137): The constructor of the contract (or its base) uses inline assembly. Because of that, it might be that the deployed bytecode is different from type(...).runtimeCode.
diff --git a/test/libsolidity/syntaxTests/metaTypes/tooManyArgsForType.sol b/test/libsolidity/syntaxTests/metaTypes/tooManyArgsForType.sol
new file mode 100644
index 00000000..61c2b779
--- /dev/null
+++ b/test/libsolidity/syntaxTests/metaTypes/tooManyArgsForType.sol
@@ -0,0 +1,7 @@
+contract Test {
+ function creation() public pure returns (bytes memory) {
+ type(1, 2);
+ }
+}
+// ----
+// TypeError: (85-95): This function takes one argument, but 2 were provided.
diff --git a/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierContractName.sol b/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierContractName.sol
new file mode 100644
index 00000000..144ca1c3
--- /dev/null
+++ b/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierContractName.sol
@@ -0,0 +1,3 @@
+contract type { }
+// ----
+// ParserError: (9-13): Expected identifier but got 'type'
diff --git a/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierFunction.sol b/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierFunction.sol
new file mode 100644
index 00000000..b7881f15
--- /dev/null
+++ b/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierFunction.sol
@@ -0,0 +1,6 @@
+contract Test {
+ function type() public pure {
+ }
+}
+// ----
+// ParserError: (29-33): Expected identifier but got 'type'
diff --git a/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierParameter.sol b/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierParameter.sol
new file mode 100644
index 00000000..001ba840
--- /dev/null
+++ b/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierParameter.sol
@@ -0,0 +1,6 @@
+contract Test {
+ function f(uint type) public pure {
+ }
+}
+// ----
+// ParserError: (36-40): Expected ',' but got 'type'
diff --git a/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierStateVariable.sol b/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierStateVariable.sol
new file mode 100644
index 00000000..fa827a33
--- /dev/null
+++ b/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierStateVariable.sol
@@ -0,0 +1,5 @@
+contract Test {
+ uint type;
+}
+// ----
+// ParserError: (25-29): Expected identifier but got 'type'
diff --git a/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierVariable.sol b/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierVariable.sol
new file mode 100644
index 00000000..fa57698d
--- /dev/null
+++ b/test/libsolidity/syntaxTests/metaTypes/typeNotRegularIdentifierVariable.sol
@@ -0,0 +1,7 @@
+contract Test {
+ function f() public pure {
+ uint type;
+ }
+}
+// ----
+// ParserError: (60-64): Expected ';' but got 'type'
diff --git a/test/libsolidity/syntaxTests/metaTypes/typeOfContract.sol b/test/libsolidity/syntaxTests/metaTypes/typeOfContract.sol
new file mode 100644
index 00000000..036c36e8
--- /dev/null
+++ b/test/libsolidity/syntaxTests/metaTypes/typeOfContract.sol
@@ -0,0 +1,6 @@
+contract Test {
+ function f() public pure returns (bytes memory) {
+ type(Test);
+ }
+}
+// ----
diff --git a/test/libsolidity/syntaxTests/metaTypes/typeRecursive.sol b/test/libsolidity/syntaxTests/metaTypes/typeRecursive.sol
new file mode 100644
index 00000000..0ce06786
--- /dev/null
+++ b/test/libsolidity/syntaxTests/metaTypes/typeRecursive.sol
@@ -0,0 +1,8 @@
+contract Test {
+ function f() public pure {
+ type(type(type(Test)));
+ }
+}
+// ----
+// TypeError: (65-75): Invalid type for argument in function call. Contract type required, but type(contract Test) provided.
+// TypeError: (60-76): Invalid type for argument in function call. Contract type required, but tuple() provided.
diff --git a/test/libsolidity/syntaxTests/metaTypes/unsupportedArgForType.sol b/test/libsolidity/syntaxTests/metaTypes/unsupportedArgForType.sol
new file mode 100644
index 00000000..5c27d42f
--- /dev/null
+++ b/test/libsolidity/syntaxTests/metaTypes/unsupportedArgForType.sol
@@ -0,0 +1,9 @@
+contract Test {
+ struct S { uint x; }
+ function f() public pure {
+ // Unsupported for now, but might be supported in the future
+ type(S);
+ }
+}
+// ----
+// TypeError: (154-155): Invalid type for argument in function call. Contract type required, but type(struct Test.S) provided.
diff --git a/test/libsolidity/syntaxTests/parsing/for_loop_simple_initexpr.sol b/test/libsolidity/syntaxTests/parsing/for_loop_simple_initexpr.sol
index fce669dd..9fafd706 100644
--- a/test/libsolidity/syntaxTests/parsing/for_loop_simple_initexpr.sol
+++ b/test/libsolidity/syntaxTests/parsing/for_loop_simple_initexpr.sol
@@ -7,6 +7,8 @@ contract test {
}
}
// ----
+// Warning: (103-106): Unreachable code.
+// Warning: (144-152): Unreachable code.
// Warning: (33-42): Unused function parameter. Remove or comment out the variable name to silence this warning.
// Warning: (122-131): Unused local variable.
// Warning: (20-169): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/for_loop_simple_noexpr.sol b/test/libsolidity/syntaxTests/parsing/for_loop_simple_noexpr.sol
index 4adf0948..c36f9c58 100644
--- a/test/libsolidity/syntaxTests/parsing/for_loop_simple_noexpr.sol
+++ b/test/libsolidity/syntaxTests/parsing/for_loop_simple_noexpr.sol
@@ -7,6 +7,7 @@ contract test {
}
}
// ----
+// Warning: (144-152): Unreachable code.
// Warning: (37-46): Unused function parameter. Remove or comment out the variable name to silence this warning.
// Warning: (122-131): Unused local variable.
// Warning: (24-177): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/for_loop_vardef_initexpr.sol b/test/libsolidity/syntaxTests/parsing/for_loop_vardef_initexpr.sol
index c22ae42f..c81f611b 100644
--- a/test/libsolidity/syntaxTests/parsing/for_loop_vardef_initexpr.sol
+++ b/test/libsolidity/syntaxTests/parsing/for_loop_vardef_initexpr.sol
@@ -6,6 +6,8 @@ contract test {
}
}
// ----
+// Warning: (89-92): Unreachable code.
+// Warning: (130-138): Unreachable code.
// Warning: (33-42): Unused function parameter. Remove or comment out the variable name to silence this warning.
// Warning: (108-117): Unused local variable.
// Warning: (20-155): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/while_loop.sol b/test/libsolidity/syntaxTests/parsing/while_loop.sol
index dbb00a69..cdac929f 100644
--- a/test/libsolidity/syntaxTests/parsing/while_loop.sol
+++ b/test/libsolidity/syntaxTests/parsing/while_loop.sol
@@ -5,3 +5,4 @@ contract test {
}
}
// ----
+// Warning: (105-113): Unreachable code.
diff --git a/test/libsolidity/syntaxTests/structs/array_calldata.sol b/test/libsolidity/syntaxTests/structs/array_calldata.sol
new file mode 100644
index 00000000..3aac5606
--- /dev/null
+++ b/test/libsolidity/syntaxTests/structs/array_calldata.sol
@@ -0,0 +1,10 @@
+pragma experimental ABIEncoderV2;
+contract Test {
+ struct S { int a; }
+ function f(S[] calldata) external { }
+ function f(S[][] calldata) external { }
+}
+// ----
+// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
+// TypeError: (89-101): Calldata structs are not yet supported.
+// TypeError: (131-145): Calldata structs are not yet supported.
diff --git a/test/libsolidity/syntaxTests/structs/calldata.sol b/test/libsolidity/syntaxTests/structs/calldata.sol
new file mode 100644
index 00000000..dadf6e4f
--- /dev/null
+++ b/test/libsolidity/syntaxTests/structs/calldata.sol
@@ -0,0 +1,8 @@
+pragma experimental ABIEncoderV2;
+contract Test {
+ struct S { int a; }
+ function f(S calldata) external { }
+}
+// ----
+// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
+// TypeError: (89-99): Calldata structs are not yet supported.
diff --git a/test/libsolidity/syntaxTests/types/encoding_fractional.sol b/test/libsolidity/syntaxTests/types/encoding_fractional.sol
new file mode 100644
index 00000000..16c76d9a
--- /dev/null
+++ b/test/libsolidity/syntaxTests/types/encoding_fractional.sol
@@ -0,0 +1,7 @@
+contract C {
+ function f1() public pure returns (bytes memory) {
+ return abi.encode(0.1, 1);
+ }
+}
+// ----
+// TypeError: (92-95): Fractional numbers cannot yet be encoded.
diff --git a/test/libsolidity/syntaxTests/types/encoding_fractional_abiencoderv2.sol b/test/libsolidity/syntaxTests/types/encoding_fractional_abiencoderv2.sol
new file mode 100644
index 00000000..80efa9c5
--- /dev/null
+++ b/test/libsolidity/syntaxTests/types/encoding_fractional_abiencoderv2.sol
@@ -0,0 +1,9 @@
+pragma experimental ABIEncoderV2;
+contract C {
+ function f1() public pure returns (bytes memory) {
+ return abi.encode(0.1, 1);
+ }
+}
+// ----
+// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
+// TypeError: (126-129): Fractional numbers cannot yet be encoded.
diff --git a/test/libsolidity/syntaxTests/types/encoding_packed_fractional.sol b/test/libsolidity/syntaxTests/types/encoding_packed_fractional.sol
new file mode 100644
index 00000000..71080cb0
--- /dev/null
+++ b/test/libsolidity/syntaxTests/types/encoding_packed_fractional.sol
@@ -0,0 +1,8 @@
+contract C {
+ function f1() public pure returns (bytes memory) {
+ return abi.encodePacked(0.1, 1);
+ }
+}
+// ----
+// TypeError: (98-101): Fractional numbers cannot yet be encoded.
+// TypeError: (103-104): Cannot perform packed encoding for a literal. Please convert it to an explicit type first.
diff --git a/test/libsolidity/syntaxTests/types/encoding_packed_fractional_abiencoderv2.sol b/test/libsolidity/syntaxTests/types/encoding_packed_fractional_abiencoderv2.sol
new file mode 100644
index 00000000..e82c3c9a
--- /dev/null
+++ b/test/libsolidity/syntaxTests/types/encoding_packed_fractional_abiencoderv2.sol
@@ -0,0 +1,10 @@
+pragma experimental ABIEncoderV2;
+contract C {
+ function f1() public pure returns (bytes memory) {
+ return abi.encodePacked(0.1, 1);
+ }
+}
+// ----
+// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
+// TypeError: (132-135): Fractional numbers cannot yet be encoded.
+// TypeError: (137-138): Cannot perform packed encoding for a literal. Please convert it to an explicit type first.