Commit Graph

725 Commits

Author SHA1 Message Date
chriseth
4a842ecc82
Merge pull request #4097 from ethereum/noPackedExceptForPacked
[BREAKING] call only takes a single argument and does not pad
2018-06-27 18:29:01 +02:00
chriseth
92cb4acd8a Also mention regular abi.encode in error message. 2018-06-27 15:00:34 +02:00
Alex Beregszaszi
80b7d36187 Remove non-0.5.0 warning for emit keyword (make it mandatory) 2018-06-26 20:00:54 +02:00
chriseth
5cf6fa84ac Provide better suggestions in error messages with respect to call and hash functions. 2018-06-25 17:17:48 +02:00
D-Nice
b2f0d1db43 Fixes storage ref var typo error from 'prefix' to 'suffix' 2018-06-25 11:14:19 -04:00
chriseth
23c4142005 Bare functions take single bytes argument. 2018-06-25 17:01:45 +02:00
Alex Beregszaszi
6d9a091a8e Keep the 'if it not used as an address' helper message for all cases of address related warnings 2018-06-25 16:25:21 +02:00
Alex Beregszaszi
48b003d4d4 Better wording for invalid address literal error 2018-06-25 16:17:50 +02:00
Jason Cobb
51567c0513 Change invalid (not exactly 160 bits long) address literal to error 2018-06-25 16:17:50 +02:00
Alex Beregszaszi
72e87423db Disallow the years unit denomination properly 2018-06-21 20:21:02 +02:00
chriseth
32f2db780c
Merge pull request #4301 from rnaby/TypeChecker
Simplification of typeSupportedByOldABIEncoder
2018-06-21 18:53:31 +02:00
chriseth
0d1047181d
Merge pull request #4306 from ethereum/remove_050_workaround_scoping
[BREAKING] C99 scoping rules by default (remove 050 workaround)
2018-06-21 13:57:59 +02:00
Alex Beregszaszi
7e4bd3e346
Merge pull request #4219 from ethereum/functionTypeNamedArguments
Turn named return parameters in function types into an error.
2018-06-20 23:51:19 +02:00
Khan M Rashedun-Naby
a5f0caa178 Simplification of typeSupportedByOldABIEncoder 2018-06-20 23:16:21 +06:00
Leonardo Alt
8862b3092b C99 scoping rules by default 2018-06-20 12:53:38 +02:00
Alex Beregszaszi
a17059573f Disallow raw callcode (was deprecated in 0.4.12) 2018-06-19 19:31:07 +02:00
Daniel Kirchner
dbfee87860 Return parameters in function types may not be named. 2018-06-18 00:05:06 +02:00
Christian Parpart
a211b89118 Enforce disallowing empty structs
This patch enfoces an error when it encounters an empty struct,
effectively eliminating the deprecation warning.

Also adjust 419_interface_structs to explicitely test for (non-empty) structs,
as this behaviour "may" change in the future.
2018-06-14 00:24:43 +01:00
Alex Beregszaszi
9de45383d8 Disallow sha3/suicide aliases 2018-06-12 18:16:18 +01:00
Alex Beregszaszi
0f572159ec Show named argument name in error 2018-06-06 15:59:27 +01:00
chriseth
283cdef98c Fix view/pure error ordering problem. 2018-06-04 17:00:37 +02:00
mingchuan
b7cafcbdf9
Allow using calldata keyword to specify data location 2018-05-30 18:05:55 +08:00
Daniel Kirchner
1cbc037a45 Update control flow graph. 2018-05-16 18:32:48 +02:00
Alex Beregszaszi
221a4d1f1f Split warning for multi arguments for hash functions 2018-05-16 11:12:25 +02:00
chriseth
894122c508 Warn/enforce single bytes argument for certain builtins (hashing functions).
In 0.5.0 mode, only accept a single bytes argument for ``.call``,
``keccak256`` and others and do not pad when encoding.
2018-05-16 09:48:03 +02:00
chriseth
dac0029d16 ABI encoding functions are pure and should be usable in constants. 2018-05-15 14:45:54 +02:00
Daniel Kirchner
16e966dea0 Add control flow analyzer and test for uninitialized storage returns. 2018-05-14 20:23:40 +02:00
Daniel Kirchner
995623f0fa Add control flow graph. 2018-05-14 20:23:40 +02:00
chriseth
fe12f05c08 Deprecate wildcard assignments. 2018-05-08 15:13:32 +01:00
chriseth
150d226603
Merge pull request #4063 from ethereum/emit-non-event
Show proper error when trying to emit a non-event
2018-05-04 15:02:04 +02:00
Alex Beregszaszi
ffe7f224a6 Show proper error when trying to emit a non-event 2018-05-04 12:47:01 +02:00
Alex Beregszaszi
b34428249a Change numBits to unsigned IntegerType 2018-05-02 23:22:25 -07:00
chriseth
d1e1293fbd
Merge pull request #3981 from ethereum/years-suffix
The "year" denomination is deprecated
2018-04-24 12:12:03 +02:00
chriseth
e685f9f59e
Merge pull request #3976 from ethereum/emptyTupleComponent
Empty tuple components should not be possible
2018-04-23 17:35:00 +02:00
Alex Beregszaszi
1ac0090f31 The "year" denomination is deprecated 2018-04-23 16:19:51 +01:00
Erik Kundt
896018c8a3 Treats inline array as an error. 2018-04-23 17:11:41 +02:00
Erik Kundt
b2ff9bc88d Turns it into warning (error for 0.5.0) and adds Changelog entry. 2018-04-23 17:09:42 +02:00
Erik Kundt
f2b58de92c Prevents null type from being used in tuple. 2018-04-22 16:54:33 +02:00
Alex Beregszaszi
0493e3b053 Turn deprecated warnings for sha3/suicide into errors (experimental 0.5.0) 2018-04-20 17:40:48 +01:00
Alex Beregszaszi
069ea38916 Make literals an error for tight packing (experimental 0.5.0) 2018-04-20 11:58:16 +01:00
chriseth
a94945dfe4 Improve error message for failed member lookup. 2018-04-18 22:56:45 +01:00
chriseth
4895864302 Warn about functions named "constructor". 2018-04-18 21:23:09 +02:00
chriseth
29a97f1641 Fix name clashes between constructor and fallback function. 2018-04-18 14:24:35 +02:00
chriseth
d8030c9b2a
Merge pull request #3880 from ethereum/addressMemberDocAndWarn
Improve documentation and warning about accessing contract members in…
2018-04-16 11:05:05 +02:00
chriseth
95c49b367e
Merge pull request #3875 from ethereum/constructorSelfRef
Stricter check for "this" in constructor.
2018-04-13 18:39:31 +02:00
Daniel Kirchner
05c5ab19fb Improve documentation and warning about accessing contract members inherited from address. 2018-04-13 18:26:24 +02:00
Daniel Kirchner
be37e3a912 Stricter check for member access to "this" in constructor. 2018-04-13 15:57:13 +02:00
chriseth
7054defdd6
Merge pull request #3364 from ethereum/revertWithReason
Revert with reason
2018-04-12 21:01:08 +02:00
chriseth
44416d1ac6
Merge pull request #2980 from ethereum/abi-api
Add abi.encode and abi.encodePacked
2018-04-12 20:55:03 +02:00
chriseth
75b8828666 Allow struct encoding with new encoder. 2018-04-12 16:37:16 +02:00
chriseth
ae1d040285 Allow error string for `require`. 2018-04-12 13:09:37 +02:00
chriseth
8ab7dc036a Register overload for `revert()` that can receive a reason string. 2018-04-12 13:09:37 +02:00
chriseth
f00bb43593 Allow function overloads involving MagicVariableDeclarations. 2018-04-12 13:09:37 +02:00
chriseth
c3dc67d0e0
Merge pull request #3848 from ethereum/constantDivisionByZero
Error on invalid arithmetic with constant expressions.
2018-04-12 11:49:08 +02:00
chriseth
7343c40283 Check partial function parameters if rest is arbitrary. 2018-04-12 00:10:25 +02:00
Alex Beregszaszi
d56acb68ab Add abi.encode, abi.encodePacked, abi.encodeWithSelector and abi.encodeWithSignature. 2018-04-11 22:32:10 +02:00
chriseth
2ad1acaf72 Warn if modifiers are applied to functions without implementation. 2018-04-11 22:00:21 +02:00
Daniel Kirchner
daa69df447 Error on invalid arithmetic with constant expressions. 2018-04-11 21:17:10 +02:00
Daniel Kirchner
cb548f6f53 Fix ConstantEvaluator to correctly handle single element tuples. 2018-04-11 18:30:34 +02:00
chriseth
c9bdbcf470
Merge pull request #3309 from ethereum/limit-errors
Limit the number of errors output in a single run to 256
2018-04-11 16:13:41 +02:00
Daniel Kirchner
3eedbc6a9c Error when using no parentheses in modifier-style constructor calls. 2018-04-10 12:09:34 +02:00
Daniel Kirchner
549ba801fb Use the most derived contract as main location in case of diamond inheritance. 2018-04-09 16:23:18 +02:00
Daniel Kirchner
b918a105a4 Move constructor argument override check to TypeChecker and reuse annotations in ContractCompiler. 2018-04-09 15:26:08 +02:00
Daniel Kirchner
b8fdb666e2 Allow duplicated constructor calls, if no arguments; support for multiple inheritance; backwards compatibility.
# tmp
2018-04-09 15:26:05 +02:00
Federico Bond
4e037281ac Error on duplicated super constructor calls 2018-04-09 11:22:35 +02:00
Daniel Kirchner
b2753aa053 Static Analyzer: Fix non-deterministic order of unused variable warnings. 2018-04-06 18:10:26 +02:00
Alex Beregszaszi
e8be0e61b3 Catch FatalError in CompilerStack::analysis to cover all the analysis tests 2018-04-06 13:52:19 +02:00
Daniel Kirchner
037eba20fc
Merge pull request #3824 from ethereum/baseArgumentsEmptyParenthesis
Error when using empty parentheses for base class constructors that r…
2018-04-05 14:43:28 +02:00
Alex Beregszaszi
36d6c27e68
Merge pull request #3745 from ethereum/fixRecursion
Fix invalid recursion errors for structs
2018-04-05 12:04:54 +02:00
Daniel Kirchner
96eff0ff6a Error when using empty parenthesis for base class constructors that require arguments. 2018-04-05 11:52:22 +02:00
Daniel Kirchner
d664a599e6 Constructors are defined using the `constructor` keyword. 2018-04-03 18:21:55 +02:00
chriseth
eb5b18e814 Generalize cycle detection. 2018-04-03 16:29:18 +02:00
Alex Beregszaszi
7753249f64
Merge pull request #3699 from ethereum/interfaceExternalVisibility
Defaults to external visibility for interfaces.
2018-04-03 15:15:36 +01:00
Erik Kundt
f9efa41749 Makes visibility warning more concise. 2018-04-03 11:16:50 +02:00
bitshift
8fe1cfb12e Defaults to external visibility for interfaces. 2018-04-03 11:16:44 +02:00
chriseth
326d656a55
Merge pull request #3790 from ethereum/empty-structs
Disallow empty structs
2018-03-30 13:58:35 +02:00
chriseth
5c8a6aac69 Prevent encoding of weird types and support packed encoding of external function types. 2018-03-29 09:57:11 +01:00
Alex Beregszaszi
ebb12756ad Still allow empty structs for non-0.5.0 mode 2018-03-27 15:49:41 +01:00
Alex Beregszaszi
b540ba527a Disallow empty structs 2018-03-27 15:49:41 +01:00
chriseth
62559cf127
Merge pull request #3681 from ethereum/interface-external
Allow overriding external functions in interfaces with public in a child
2018-03-27 15:47:59 +02:00
bitshift
2c56e53046 Changes deprecation and adjusts tests. 2018-03-27 03:30:03 +01:00
bitshift
ed632025fe Moves blockhash function to global level. 2018-03-27 03:30:03 +01:00
Alex Beregszaszi
8bae2dba7c Introduce inContractKind helper on FunctionDefinition 2018-03-26 11:37:38 +01:00
Alex Beregszaszi
ef3595b000 Allow overriding external functions in interfaces with public in an implementing contract 2018-03-26 11:35:17 +01:00
chriseth
c2709a2d8e Decode dynamic data. 2018-03-21 14:53:29 +00:00
chriseth
cc2f71e4ac Move dynamic type removal out of the type system. 2018-03-21 14:53:29 +00:00
Alex Beregszaszi
ba8819542f
Merge pull request #3611 from ethereum/warn-using-address-overload
Warn if using address overloads on contracts
2018-03-06 19:13:55 +01:00
chriseth
baa1526539
Merge pull request #3664 from ethereum/literalsHexUnitSmallFix
Use double quotes for suggestion about hex literals and denominations.
2018-03-06 19:01:25 +01:00
Daniel Kirchner
b4d38c5491 Use double quotes for suggestion about hex literals and denominations. 2018-03-06 18:09:54 +01:00
chriseth
fd1662d1c4 Warn about using loose inline assembly features as experimental 0.5.0 feature. 2018-03-06 17:45:34 +01:00
Alex Beregszaszi
83dacbf669
Merge pull request #3549 from ethereum/fixmultidim
Properly detect which array and struct types are unsupported by the old ABI encoder.
2018-03-06 15:51:17 +01:00
chriseth
f6c0daec14
Merge pull request #3652 from ethereum/gasleft_v2
Use StaticAnalyzer to deprecate msg.gas instead of conditionally remo…
2018-03-06 09:26:14 +01:00
Daniel Kirchner
91b13b734d Use StaticAnalyzer to deprecate msg.gas instead of conditionally removing it in MagicType. 2018-03-05 23:16:26 +01:00
chriseth
3793aa405b
Merge pull request #3643 from ethereum/gasleft
Move msg.gas to global function gasleft(). Closes #2971.
2018-03-05 20:11:37 +01:00
chriseth
1ceb0b04c1 Assert that address members are not present on contract types in 0.5.0. 2018-03-05 15:55:02 +01:00
Alex Beregszaszi
fd60c1cf86 Warn if using address overloads on contracts 2018-03-05 15:50:27 +01:00
chriseth
6dc137317f
Merge pull request #3569 from ethereum/evmVersion
EVM version
2018-03-05 12:10:49 +01:00
Daniel Kirchner
c633c0eacb Move msg.gas to global function gasleft(). Closes #2971. 2018-03-05 11:18:04 +01:00
Daniel Kirchner
454b470cee Suggest expressions of the form '0x1234 * 1 day' instead of hex numbers with unit denominations. 2018-03-02 10:22:58 +01:00
chriseth
dc317a44e0 Provide EVM version to assembly analysis. 2018-03-01 17:19:35 +01:00
chriseth
a53d6b499d Use EVM version in type checker. 2018-03-01 17:19:35 +01:00
Daniel Kirchner
bd4c2b9bde Deprecate using unit denominations in combination with hex numbers. Closes #3574. 2018-03-01 16:58:55 +01:00
chriseth
08b6a72d37 Fix multi-dimensional arrays in the ABI. 2018-03-01 14:28:27 +01:00
chriseth
22d26e059c
Merge pull request #3613 from ethereum/require-visibility
Issue error if no visibility is specified (on 0.5.0)
2018-02-28 16:33:39 +01:00
Alex Beregszaszi
a566825589 Issue error if no visibility is specified (on 0.5.0) 2018-02-27 16:31:53 +01:00
chriseth
88a5c66f4a Only active variables at the point of their declaration. 2018-02-27 12:17:25 +01:00
chriseth
6b9dda06f3 Enable C99-scoping with the 0.5.0-experimental pragma. 2018-02-27 12:17:25 +01:00
chriseth
e6d48bb72a Blocks and for loops can be scopes. 2018-02-27 12:17:25 +01:00
chriseth
5f20129e65 Scopes do not have to be declarations. 2018-02-27 12:17:25 +01:00
chriseth
53289e15a2 Make all lookups recursive by default. 2018-02-27 12:17:25 +01:00
Alex Beregszaszi
5c0d82059f Turn throw into a syntax error for 0.5.0 2018-02-27 02:10:24 +01:00
chriseth
8c1a8ecc2e Warn about using events without emit. 2018-02-22 15:17:42 +01:00
chriseth
388718b59f Introduce emit statement. 2018-02-22 15:17:30 +01:00
chriseth
c182284d28 Do not warn about analysis-only experimental features. 2018-02-22 14:50:20 +01:00
chriseth
4272d16f30 Fix shadowing for imports with aliases. 2018-02-20 13:06:28 +01:00
chriseth
930485cd24 Properly warn about the use of constants in inline assembly in connection with `_offset and _slot`. 2018-02-19 19:22:39 +01:00
chriseth
e08a206070 Disallow uninitialized storage pointers as experimental 0.5.0 feature. 2018-02-15 11:58:50 +01:00
chriseth
23484ba6a4
Merge pull request #3498 from ethereum/allowthisfselector
Allow `this.f.selector` to be pure.
2018-02-13 17:08:35 +01:00
chriseth
1dcd7c5e0b Fix: remove reference. 2018-02-13 15:04:10 +00:00
chriseth
dc0a25f1cd Minor changes. 2018-02-13 15:04:03 +00:00
Balajiganapathi S
8a491c77ba Restructure code for alternative identifier suggestions 2018-02-13 15:00:15 +00:00
Balajiganapathi S
b1417b318f Move string distance function to utils and format error message 2018-02-13 14:59:33 +00:00
Balajiganapathi S
2859834e58 Suggest alternatives when identifier not found. 2018-02-13 14:54:36 +00:00
chriseth
5916cf1e0a Allow this.f.selector to be pure. 2018-02-13 11:00:59 +01:00
Jimmy Vogel
dc5ad899d0 Deprecate the var keyword (and mark it an error as experimental 0.5.0 feature) 2018-02-12 22:37:26 +00:00
Federico Bond
75a3a707a2 Fix segfault with undeclared array types 2018-02-11 21:40:41 -03:00
Alex Beregszaszi
32300ea3ff
Merge pull request #3360 from federicobond/nonfatal-reference-errors
Replace some fatal errors when resolving references with normal ones
2018-02-04 13:07:55 +00:00
Federico Bond
600e66e605 Replace some fatal errors when resolving references with normal ones 2018-02-02 14:09:32 -03:00
Alex Beregszaszi
b545987ec7 Issue warning for using public visibility for interface functions 2018-02-01 10:28:00 +00:00
chriseth
124190336b Split inline assembly into loose and strict flavours. 2018-01-06 01:23:38 +00:00
Alex Beregszaszi
2cdd789b5d
Merge pull request #3297 from ethereum/separate_expression_and_statement
Separate expression and statement
2018-01-04 12:04:19 +00:00
Federico Bond
a0771691ff Improve error message for wrong struct initialization (#3359) 2018-01-04 11:24:39 +01:00
chriseth
3d1830f3f2
Merge pull request #3232 from ethereum/simplifyConstant
Simplify ConstantEvaluator.
2017-12-14 16:14:46 +01:00
chriseth
54b6739962 Separate expression and statement. 2017-12-13 12:28:15 +01:00
chriseth
e7ed9d878e
Re-use commonType 2017-12-12 10:45:40 +01:00
chriseth
48c7ba72f3 Simplify ConstantEvaluator. 2017-12-12 09:44:18 +00:00
Alex Beregszaszi
7ff9a85592 Reduce the types of errors outputted by ConstantEvaluator 2017-12-12 09:40:29 +00:00
Alex Beregszaszi
5226d54ed1 Improve error message for constant evaluator 2017-12-12 09:39:26 +00:00
chriseth
2d171c25e5 Limit number of secondary source locations. 2017-12-12 10:27:28 +01:00
chriseth
9e36c189e5 Fix struct encoding warning for libraries. 2017-12-11 02:34:42 +00:00
Alex Beregszaszi
e9d256ddf4 Suggest the experimental ABI encoder if using structs as function parameters 2017-12-11 02:34:42 +00:00
Alex Beregszaszi
745eefa36f Split Instruction and FunctionalInstruction in Julia 2017-12-05 14:52:11 +00:00
chriseth
19e067465a Unary operators and division. 2017-11-30 01:20:21 +01:00
chriseth
6dbc34e16e If statement for Iulia / inline assembly. 2017-11-22 16:25:24 +01:00
Alex Beregszaszi
455e51a608 Improve cyclic constant error message 2017-11-22 02:11:22 +00:00
Balajiganapathi S
d102deaec9 Detect cyclic constant definitions 2017-11-22 02:07:56 +00:00
Balajiganapathi S
165857b1d4 Allow constant integer variables as array lengths. 2017-11-22 01:41:46 +00:00
Alex Beregszaszi
1d5dd909b4 Do not try to display checksummed address for too-short/long address literals 2017-11-17 00:46:45 +00:00
wadeAlexC
8a6692b2cf Improves address literal checksum error message 2017-11-17 00:46:44 +00:00
Kwang Yul Seo
33664c04a8 Update outdated comments
_errors -> _errorReporter.
2017-11-16 00:28:41 +09:00
Kwang Yul Seo
f364529713 Fix a typo
A semicolon was mistakenly inserted where a string concatenation
operator was meant.
2017-11-14 21:50:09 +09:00
Alex Beregszaszi
3a8324266f More detailed errors for invalid array lengths (such as division by zero). 2017-10-20 11:59:18 +01:00
Alex Beregszaszi
10677125ae Turn usage of callcode into an error as experimental 0.5.0 feature 2017-10-19 02:20:30 +01:00
chriseth
8a8a71de84 Only check tuples for valid rational numbers if they have more than one element. 2017-10-17 19:14:49 +02:00
Alex Beregszaszi
c99d2aae04 Validate each tuple literal 2017-10-17 18:59:01 +02:00
Alex Beregszaszi
c45e55675c Force interface functions as external (0.5.0) 2017-10-06 13:48:38 +01:00
Alex Beregszaszi
ed62b2583c Use the proper error reporting interface in ConstantEvaluator 2017-10-05 20:17:54 +01:00
Alex Beregszaszi
81519845bc Require location keyword for local variables (0.5.0) 2017-10-05 19:02:30 +01:00
Federico Bond
76d3d24842 Do not consider shadowing in variable names inside event declarations 2017-10-04 13:30:26 -03:00
wadeAlexC
73f17876e9 Better error message when using fractional number as array size expressions 2017-10-03 22:01:58 +01:00
Federico Bond
2b82352692 Disallow non-pure constant state variables in 0.5.0 2017-10-03 15:30:16 +01:00
Federico Bond
1e7b6875b7 Extract duplicate function or event finding logic 2017-09-29 19:45:56 -03:00
Federico Bond
6d95447955 Emit error when declaring event with same name and arguments twice 2017-09-29 19:17:31 -03:00
Rhett Aultman
e434437eb7 Unary + now a synax error (experimental 0.5.0)
The unary + was deprecated with a warning, but will be elevated to an
error in 0.5.0.  This adds the syntax error for the 0.5.0 pragma, and
for a true 0.5.0 release we should consider removing the operator from
the parser.
2017-09-29 17:50:25 +01:00
Alex Beregszaszi
b1741b7735 Validate array length in type checker 2017-09-29 16:44:00 +01:00
Alex Beregszaszi
0dda5eeca3 Order GlobalContext entries 2017-09-27 11:19:53 +01:00
Alex Beregszaszi
82673b7b3f Format GlobalContext for readability 2017-09-27 11:19:53 +01:00
chriseth
9c62647f19 Merge pull request #2978 from ethereum/infer-location
Report correct location for inferred types in packed encoding
2017-09-27 12:13:01 +02:00
Alex Beregszaszi
dcb61352f6 Report correct location for inferred types in packed encoding 2017-09-27 10:21:24 +01:00
Alex Beregszaszi
ee65ecfb3b Ensure that address types are always declared as 160bit 2017-09-26 22:46:33 +01:00
chriseth
8af298ade3 Merge pull request #2902 from ethereum/warn-obsolete
Warn about obsolete sha3/suicide calls
2017-09-20 18:00:40 +02:00
Alex Beregszaszi
aad829948a Ensure parameter names match between headers and implementation 2017-09-20 01:23:21 +01:00
Alex Beregszaszi
ed1fd49ab0 Warn about obsolete sha3/suicide calls 2017-09-19 11:11:19 +01:00
chriseth
ff275e369c Allow constant byte arrays. 2017-09-18 19:49:27 +01:00
chriseth
3a9a9db6d6 Merge pull request #2910 from ethereum/fallback-restrict-external
Force fallback to be external (experimental 0.5.0 change)
2017-09-18 16:38:55 +02:00
Alex Beregszaszi
a3380ea8d0 Force fallback to be external (experimental 0.5.0 change) 2017-09-18 11:58:37 +01:00
chriseth
59ea19b3b9 Check for recursive structs. 2017-09-16 12:12:43 +01:00
Alex Beregszaszi
7dd372ce5c Merge pull request #2904 from ethereum/viewPure5
Enforce view with error for experimental 0.5.0.
2017-09-14 18:13:56 +01:00
chriseth
24fd67b7db Enforce view with error for experimental 0.5.0. 2017-09-14 17:53:43 +02:00
Alex Beregszaszi
5b5367dc12 Warn if no visibility is specified on contract functions. 2017-09-14 15:58:04 +01:00
chriseth
3f3bcc4f8a Merge pull request #2848 from ethereum/checkViewPure
Enforce view and pure.
2017-09-13 18:29:13 +02:00
chriseth
e2f30ce9ca Minor changes from review. 2017-09-13 17:29:27 +02:00
chriseth
66c01301fe Rename to invalidInPureFunctions 2017-09-13 17:18:22 +02:00
Alex Beregszaszi
0259459b21 Limit each duplicate declaration error to 32 references 2017-09-12 21:37:06 +01:00
chriseth
5084a9cda9 Merge pull request #2852 from ssuman/develop
This commit will display warning when there is unused function parameter
2017-09-12 17:57:55 +02:00
Suman
10d290cb9b Display helpful warning for unused function arguments/return parameters 2017-09-12 15:35:03 +01:00
Alex Beregszaszi
5ae9b8dab1 Do not report overload conflicts for every line excessively 2017-09-12 14:58:10 +01:00
Alex Beregszaszi
f2412da800 Merge pull request #2888 from ethereum/same-declaration-error
Use secondary source location as a vector in same declaration errors
2017-09-12 14:57:42 +01:00
Alex Beregszaszi
da1a53e02a Use secondary source location as a vector in same declaration errors 2017-09-12 12:06:16 +01:00
Alex Beregszaszi
a03211f3c9 Show each unimplemented function in secondary source location 2017-09-12 10:59:56 +01:00
Alex Beregszaszi
a52e0de67c Do not show the same error multiple times for events 2017-09-12 00:03:35 +01:00
chriseth
b756274357 Allow constant variables in pure functions. 2017-09-06 13:52:29 +02:00
chriseth
15bdc48a73 Rename and add anonymous namespace. 2017-09-06 13:52:29 +02:00
chriseth
c83768c426 Fix tests 2017-09-06 13:52:29 +02:00
chriseth
1a1db1ec96 Tone down error message. 2017-09-06 13:52:29 +02:00
chriseth
7886c24d40 Modifier invocation can be base constructor call 2017-09-06 13:52:29 +02:00
chriseth
d6861d909c Analyze assembly. 2017-09-06 13:52:29 +02:00
chriseth
ec27e569b0 Do not report on overriding function and only warn for view. 2017-09-06 13:50:49 +02:00
chriseth
342367d5dc Store super function. 2017-09-06 13:50:49 +02:00
chriseth
eacee5b25c Remove previous warning about pureness not being enforced. 2017-09-06 13:50:49 +02:00
chriseth
5470da4d9a View-pure checker. 2017-09-06 13:50:49 +02:00
Alex Beregszaszi
3326a2282e Change array too large error message as it is valid for non-calldata too 2017-09-05 22:38:45 +01:00
Alex Beregszaszi
79e84a8fa4 Swap declaration/statemutability in FunctionType constructor 2017-08-28 19:43:35 +01:00
Alex Beregszaszi
aa94000a91 Mark all built in functions with appropriate statemutability 2017-08-28 19:43:35 +01:00
Alex Beregszaszi
f6dba97fe1 Warn on using literals in tight packing 2017-08-25 14:16:50 +01:00
Alex Beregszaszi
e03dfd8476 Remove unused statements from the Natspec headers 2017-08-25 13:15:08 +01:00
Alex Beregszaszi
5668377c72 Introduce pure specifier on functions 2017-08-24 13:46:18 +01:00
chriseth
7b0046a9aa Check inheritance specifier arguments for interfaces. 2017-08-22 11:39:50 +01:00
Alex Beregszaszi
b25f0c52ac Reject the creation of interface with the new statement 2017-08-21 23:02:18 +01:00
chriseth
ec82706396 Fix crash related to `using for` without a library. 2017-08-21 16:57:37 +02:00
Alex Beregszaszi
fe25bcf350 Library cannot have constructors 2017-08-21 11:03:55 +01:00
Alex Beregszaszi
a61c88e9fe Use state mutability in override error messages 2017-08-16 17:23:09 +01:00
Alex Beregszaszi
a2aaa47ee2 Use state mutability in fallback/constructor check 2017-08-16 17:23:09 +01:00
chriseth
3d595d4b14 Warn about shift of literals. 2017-08-16 13:54:28 +02:00
Alex Beregszaszi
b225bf5d53 Remove useless payable & constant typecheck 2017-08-14 14:21:47 +01:00
chriseth
4d9790b6d5 Merge pull request #2703 from ethereum/warnAboutLargeStorageArrays
Warn about large storage structures.
2017-08-14 11:37:01 +02:00
Federico Bond
3571db6e3f Avoid duplicate errors due to function overrides 2017-08-11 22:45:26 +01:00
Federico Bond
d4997dd9a3 Use a secondary location for function override errors 2017-08-11 22:45:25 +01:00
Federico Bond
a6949851f3 Refactor function override check to remove duplicate logic 2017-08-11 22:45:25 +01:00
Federico Bond
ff5bb54e3c Use fully qualified name of super in message 2017-08-11 22:45:25 +01:00
Federico Bond
a5ceaac8df Improve override changes signature error message 2017-08-11 22:45:25 +01:00
chriseth
da3ac86403 Warn about large storage structures. 2017-08-11 20:57:57 +02:00
Alex Beregszaszi
57c2451130 Introduce ExperimentalFeatures header 2017-08-10 00:15:25 +01:00
Alex Beregszaszi
690ed37fd4 Reject wildcard and multiple experimental pragmas 2017-08-09 23:41:46 +01:00
Alex Beregszaszi
de9e758ef7 Reject unsupported experimental feature names 2017-08-09 23:41:46 +01:00
Alex Beregszaszi
e44da40835 Warn if using experimental pragma 2017-08-09 23:41:46 +01:00
Alex Beregszaszi
fbcc5f4ee5 Support experimental feature pragma 2017-08-09 23:41:46 +01:00
Alex Beregszaszi
8df89c5d5b Disable unimplemented library functions instead 2017-08-08 12:42:10 +01:00
Alex Beregszaszi
1ada48f61e Raise error when using unimplemented internal library functions. 2017-08-08 11:58:00 +01:00
Alex Beregszaszi
bb0eb57c2f Constructors must be implemented if declared. 2017-08-04 20:38:45 +01:00
Alex Beregszaszi
a372941a44 Merge pull request #2687 from ethereum/show-unimplemented-funcs
Show unimplemented function if trying to instantiate an abstract class
2017-08-04 19:46:09 +01:00
chriseth
060d229a22 Search for shadowee starting from parent scope. 2017-08-04 19:06:24 +02:00
Alex Beregszaszi
32acadf43d Do not mark overloaded functions as shadowing 2017-08-04 19:06:23 +02:00
Alex Beregszaszi
2186401479 Remove duplicated check for unimplemented functions 2017-08-04 14:03:38 +01:00
Alex Beregszaszi
494dea262e Show unimplemented function if trying to instantiate an abstract class 2017-08-04 14:03:37 +01:00
Alex Beregszaszi
c835bcec62 Replace isFullyImplemented with unimplementedFunctions in ASTAnnotations 2017-08-04 14:03:37 +01:00
Alex Beregszaszi
6d37f30d76 Rename Bare to Barecall 2017-08-01 10:47:10 +01:00
Alex Beregszaszi
9fc6eccc26 Add isFallback() helper 2017-07-27 21:52:57 +01:00
Alex Beregszaszi
53f747b7de Merge pull request #2635 from ethereum/fixCrashOnAssignmentToNonLValue
Fix crash on assignment to non-LValue
2017-07-27 13:59:22 +01:00
chriseth
7c7c2baa82 Re-allow multiple modifiers per function. 2017-07-27 13:45:39 +02:00
chriseth
cb75e6218b Fix crash on assignment to non-lvalue. 2017-07-26 14:32:25 +02:00
Alex Beregszaszi
e0dc74b895 Warn about shadowing variables. 2017-07-25 16:32:37 +02:00
Rhett Aultman
a2a759f792 Migrate over to ErrorReporter 2017-07-19 07:19:21 -07:00
Alex Beregszaszi
b3db1c361c Warn if this is used in constructor 2017-07-19 06:47:36 -07:00
Alex Beregszaszi
033fc0cb1a Include types in explicit conversion error message 2017-07-13 23:09:01 +02:00
Alex Beregszaszi
4229caaadc Disable large arrays for memory location too 2017-07-13 22:47:35 +02:00
Alex Beregszaszi
cb4875a28b Issue error properly for oversized arrays for calldata 2017-07-13 22:33:46 +02:00
Federico Bond
f20b150f38 Add type error when attempting value transfer to a non-payable contract 2017-07-12 23:57:53 -03:00
Alex Beregszaszi
db7ad508f8 Issue proper warning trying to access calldata variables in inline assembly 2017-07-12 10:48:44 +02:00
chriseth
883666d2c0 Fix invalid "explicit storage keyword" warning for reference members of structs. 2017-07-10 18:30:41 +02:00
chriseth
0400e61e28 Deprecate throw. 2017-07-05 21:15:00 +02:00
chriseth
dd34277ca6 Warn if local storage reference variable does not use "storage" explicitly. 2017-07-05 19:38:00 +02:00
Alex Beregszaszi
a46b3479bb Remove parsing of why3 doc strings 2017-06-30 22:34:03 +01:00
chriseth
044058276e Warn about callcode. 2017-06-30 16:37:32 +02:00
Alex Beregszaszi
06fe61f89b Rename to isHexNumber() 2017-06-28 17:01:55 +01:00
Alex Beregszaszi
8b0c866f02 Add hasHexPrefix() to AST::Literal 2017-06-28 16:57:32 +01:00
chriseth
c3e5d6b7ef Give min and max values in warning message. 2017-06-28 15:02:25 +02:00
chriseth
9f19bc8cbc Warn if using var x = 0 2017-06-28 11:41:03 +02:00
chriseth
708d17d13f Merge pull request #2464 from federicobond/deprecate-function-type-names
Warn deprecated usage of parameter names in function types
2017-06-27 16:32:48 +02:00
Federico Bond
70fd5c1770 Warn deprecated usage of parameter names in function types 2017-06-26 15:39:01 -03:00
chriseth
d0b6de0b34 Warn about copies in storage that might overwrite unexpectedly. 2017-06-26 16:31:36 +02:00
Alex Beregszaszi
a0b0df2d98 Merge pull request #2460 from ethereum/disallowMultiModifier
Disallow invoking the same modifier multiple times.
2017-06-26 11:51:12 +01:00
chriseth
f879489291 Merge pull request #2449 from federicobond/warn-bytesxx-decimal
Warn if decimal literals are used in a bytesXX context
2017-06-26 09:13:41 +02:00
Federico Bond
7a3ea61ffd Warn if decimal literals are used in a bytesXX context
Fixes #2349
2017-06-23 23:21:19 -03:00
chriseth
5a75581f66 Disallow invoking the same modifier multiple times. 2017-06-23 20:12:22 +02:00
Federico Bond
0fb1621a98 Fix address literals not being treated as compile-time constants
The early return implemented for address literals in TypeChecker was
preventing the isPure annotation from getting applied. Closes #2441
2017-06-23 11:19:57 +02:00
Federico Bond
0f8ad1d68f Fix segmentation fault with constant function parameters 2017-06-21 22:46:27 -03:00
chriseth
29e7ad3d7b Silence compiler warning. 2017-06-14 17:39:36 +02:00
chriseth
07cc84fade Fix a crash about a non-callable expression. 2017-06-14 14:26:20 +02:00
Yoichi Hirai
8775e77305
Add a warning about a varialbe of the name of an instruction 2017-06-13 16:57:08 +02:00
chriseth
ba5ee71b7f Generate only single error in inline assembly. 2017-06-08 15:52:45 +02:00
chriseth
97cc968a13 Initial EVM1.5 assembly implementation. 2017-06-08 15:52:44 +02:00
Rhett Aultman
89b60ffbd4 Refactor error reporting
This commit introduces ErrorReporter, a utility class which consolidates
all of the error logging functionality into a common set of functions.
It also replaces all direct interactions with an ErrorList with calls to
an ErrorReporter.

This commit resolves issue #2209
2017-05-30 07:28:31 -07:00
Alex Beregszaszi
8fe79fe706 Introduce Julia mode in AsmAnalyzer 2017-05-26 20:39:30 +01:00
chriseth
261731f7ee Adapt EVM codegen to new namespace. 2017-05-26 15:08:27 +02:00
Alex Beregszaszi
e9b106cd0e Merge pull request #2292 from roadriverrail/inline_asm_unused_warning
Drop the inline asm includes from StaticAnalyzer
2017-05-23 23:11:03 +01:00
Rhett Aultman
f735207732 Drop the inline asm includes from StaticAnalyzer 2017-05-23 06:38:17 -07:00
chriseth
74d2e7311a Merge pull request #2265 from roadriverrail/inline_asm_unused_warning
Analyze InlineAssembly for variable use
2017-05-22 16:34:29 +02:00
djudjuu
e82df073d1 minor fixes and changelog update 2017-05-22 12:25:50 +02:00
Rhett Aultman
621c3fa22f Analyze InlineAssembly for variable use
The unused variable checker in StaticAnalyzer did not conssider
InlineAssembly objects.  This commit introduces that missing feature.
2017-05-21 15:23:05 -07:00
djudjuu
1d22233a43 refactoring functionCallAnnotation 2017-05-19 15:48:07 +02:00
Erik Quenon Steggall
0489c99870 Added change to make compile happy on MacOS 10.9.5 2017-05-05 16:49:09 -07:00
chriseth
230f51efb7 Cleanup, style and additional test. 2017-05-03 11:26:21 +02:00
chriseth
e0266b79f3 Refactor: Combine bool and function pointer. 2017-05-03 11:26:21 +02:00
Rhett Aultman
a6faa5acf3 Treat returns with expressions as return param use
There are many cases of code where the return parameters exist mostly
as a form of documentation.  This change ensures that they do not have
to be used in the function body so long as there is a return supplying
values
2017-05-03 11:26:21 +02:00
Rhett Aultman
a40c8cfb68 Warn on unused local variables
Analyze functions for all local variables, parameters, and named
return variables which are never used in the function, and issue
a warning.
2017-05-03 11:26:21 +02:00
chriseth
acab525fef Merge pull request #2199 from roadriverrail/no_unary_plus
Deprecate use of unary '+'
2017-05-02 16:43:47 +02:00
chriseth
96870686a9 Style and stricter tests. 2017-05-02 15:48:58 +02:00
chriseth
2891b98882 Merge pull request #2110 from federicobond/fix-posttypechecker
Fix PostTypeChecker retaining state across contracts
2017-05-02 12:12:46 +02:00
Rhett Aultman
e544698ad3 Deprecate use of unary '+'
The unary '+' serves no meaningful purpose in Solidity and it makes it
possible to produce typos with dagerous implications (e.g. 'a =+5 '),
so we are deprecating it.  The SyntaxChecker currently issues warnings
on the unary '+' but will still compile it for now.
2017-04-28 17:43:19 -07:00
chriseth
f3ec2ba39e Refactor to combined scope and stack height info. 2017-04-26 17:12:04 +02:00
chriseth
1d712c7d64 Fix storage access tests. 2017-04-25 16:49:04 +02:00
chriseth
978884d9ca Build fix. 2017-04-25 16:49:04 +02:00
chriseth
478f2997ea Storage access from inline assembly. 2017-04-25 16:49:04 +02:00
chriseth
dfb7d5ebd9 Move analysis out of code generator. 2017-04-25 16:49:04 +02:00
chriseth
dfaab73efe Only allow access to local variables and only if they have a stack size of one. 2017-04-25 16:49:04 +02:00
chriseth
83bf34c571 Review comments and cleanup. 2017-04-25 16:49:03 +02:00
chriseth
c6fa78c73e Use actual type checking phase of assembler. 2017-04-25 16:49:03 +02:00
chriseth
e0849f2f3b Split external identifier access into resolving and code generation. 2017-04-25 16:49:03 +02:00
chriseth
937695bfdc Change error message. 2017-04-21 15:04:03 +02:00