aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2019-01-16 05:49:15 +0800
committerchriseth <chris@ethereum.org>2019-01-18 03:36:48 +0800
commit4669b06ab448b61350bff23db12da1a8e9fff5fa (patch)
tree940774b639d7980eb5721f17888c9ec4abc5af26 /test
parent0bfdaa500af6ae1a480f6f6f417a6a12ada0a313 (diff)
downloaddexon-solidity-4669b06ab448b61350bff23db12da1a8e9fff5fa.tar.gz
dexon-solidity-4669b06ab448b61350bff23db12da1a8e9fff5fa.tar.zst
dexon-solidity-4669b06ab448b61350bff23db12da1a8e9fff5fa.zip
Warn if type(..).runtimeCode is used with assembly in the constructor.
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/syntaxTests/metaTypes/runtimeCodeWarningAssembly.sol17
1 files changed, 17 insertions, 0 deletions
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.