Commit Graph

716 Commits

Author SHA1 Message Date
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
chriseth
9bc9fe6af7 Warn about side-effect free statements. 2017-04-21 11:36:38 +02:00
Federico Bond
e6f13353f2 Fix PostTypeChecker retaining state across contracts 2017-04-08 18:45:15 -03:00
chriseth
4792806b99 Fix: Contract inheriting from base with unimplemented constructor is abstract. 2017-03-21 18:12:08 +01:00
chriseth
5ced3af3a0 Visit structs only once. 2017-03-21 15:05:59 +01:00
Alex Beregszaszi
96c09fcbcd Simplify interface checks for FunctionDefinition 2017-03-17 17:07:20 +00:00
Alex Beregszaszi
2067a00f22 Disallow private or internal functions in interfaces 2017-03-17 17:07:18 +00:00
Alex Beregszaszi
d5102c1db7 Disallow constructor in interfaces 2017-03-17 17:06:52 +00:00
Alex Beregszaszi
2c4bce2d62 Disallow enums in interfaces 2017-03-17 17:06:52 +00:00
Alex Beregszaszi
16a91ef90a Use declared instead of defined 2017-03-17 17:06:52 +00:00
Alex Beregszaszi
4693aed177 Reject invalid definitions for interface contracts 2017-03-17 16:27:04 +00:00
Alex Beregszaszi
3ae88377d6 Change references to FunctionType::Location 2017-03-16 12:49:52 +00:00
chriseth
ab178b8bac Mention 'transfer' in warning about unchecked 'send'. 2017-03-15 11:10:24 +01:00
Yoichi Hirai
d134fda0c0 Merge pull request #1729 from ethereum/constantvariables
Only allow pure expressions for constant state variables.
2017-03-15 10:03:35 +01:00
chriseth
9f328ff749 Turn non-constant constants error into warning. 2017-03-14 19:25:16 +01:00
chriseth
47cd8964b8 Require and Assert. 2017-03-14 14:21:33 +01:00
chriseth
592cec7e90 Disallow constants that are neither value types nor strings. 2017-03-13 13:30:23 +01:00
chriseth
14948e514d Allow enum values for constants. 2017-03-13 13:30:23 +01:00
chriseth
f39763e91c Type checking for pure expressions. 2017-03-13 13:30:21 +01:00
Yoichi Hirai
ef8b56a058 Merge pull request #1751 from ethereum/warnLiteralExpBase
Warn if base of exponentiation operation is a literal.
2017-03-10 19:25:47 +01:00
Ryan Casey
797e05ba08 Resolve build-stopping error about 'minor' and 'major' being defined in <sys/types.h> 2017-03-09 17:03:19 -08:00
Yoichi Hirai
e364909e06 Merge pull request #1747 from ethereum/fixICEInternalConstructor
Move privateness of constructor into AST itself.
2017-03-08 17:49:14 +01:00
chriseth
3f9a775834 Merge pull request #1748 from ethereum/singletonArray
Use mobile type for singleton array.
2017-03-08 16:11:03 +01:00
chriseth
93ef7fd260 Disallow compound assignment for tuples. 2017-03-08 12:42:07 +01:00
Yoichi Hirai
a1e350a4ae Merge pull request #1699 from ethereum/asmlabels
Assembly labels with stack information
2017-03-08 11:56:44 +01:00
chriseth
1324ebc4bf Warn about literal constant base in exponentiation. 2017-03-07 13:44:11 +01:00
chriseth
a2ac05e1a2 Merge pull request #1733 from ethereum/selfReferentialConstant
Detect cyclic dependencies between constants.
2017-03-06 17:18:39 +01:00
chriseth
2fcccb97d3 Merge pull request #1737 from ethereum/localmappings
Disallow uninitialized mapping variables.
2017-03-06 15:05:58 +01:00
chriseth
5c5d83fd70 Check for circular references in constant variables. 2017-03-06 15:05:09 +01:00
chriseth
c500d9f717 Convert to mobile type for array type. 2017-03-06 14:42:28 +01:00
chriseth
c126edc6ea Disallow uninitialized mapping variables. 2017-03-06 14:27:18 +01:00
chriseth
f300bdb020 Move public constructor property into AST itself. 2017-03-06 14:12:42 +01:00
chriseth
f521fd7b19 Mention way to remove warning. 2017-03-06 13:37:57 +01:00
Yoichi Hirai
cfbbd89daf Merge pull request #1702 from ethereum/assertError
Change effect of assert to invalid opcode.
2017-03-03 18:25:50 +01:00
chriseth
455e8a4ef8 Move lambda. 2017-03-03 15:41:02 +01:00
chriseth
25dcfa3480 Refactor CodeGen to recurse on blocks. 2017-03-03 15:41:01 +01:00
chriseth
cc01d870ff Disallow variable declaration with inferred empty tuple type. 2017-03-02 14:33:58 +01:00
chriseth
4b1e8111cc Remove assert for now. 2017-02-23 19:43:40 +01:00
chriseth
c0961664f9 Deposit one stack item for non-value types in inline assembly type checking. 2017-02-20 12:33:22 +01:00
chriseth
c3c3cccbec Fix early exist for fatal errors. 2017-02-16 14:57:00 +01:00
chriseth
a791ec75e2 Review comments. 2017-02-14 13:32:48 +01:00
chriseth
b1bb228ab3 Allow different entry scope for registerDeclarations. 2017-02-14 13:23:44 +01:00
chriseth
e67faa9839 Extract scopes into compiler stack. 2017-02-14 13:23:44 +01:00
chriseth
c87bafd2ed Refactor type system to allow multiple entry points. 2017-02-14 13:23:44 +01:00
chriseth
fc8e50f688 Refactor NameAndTypeResolver and SyntaxChecker to allow other entry points. 2017-02-14 13:23:44 +01:00
Alex Beregszaszi
f3158f92d6 Support revert() 2017-02-10 22:40:42 +00:00
Alex Beregszaszi
f8461e9e31 Implement assert as a global function 2017-02-10 13:29:17 +00:00
Alex Beregszaszi
697db80b48 Disallow arrays with negative length 2017-02-02 00:24:45 +00:00
chriseth
1316bb7565 Warn about invalid checksums of addresses. 2017-01-24 23:37:48 +01:00
chriseth
b52a60402d Merge pull request #1245 from ethereum/1215
Allow multiple events of the same name
2017-01-24 11:52:21 +01:00
Yoichi Hirai
4e1fd68b38
analysis: disallow overloading functions with events 2017-01-23 15:25:13 +01:00
Yoichi Hirai
399b7b695a
analysis: fix format 2017-01-23 15:25:13 +01:00
Yoichi Hirai
846f7dc3ea
analysis: Resolve event overloading 2017-01-23 15:25:13 +01:00
Yoichi Hirai
08015590f2
analysis: Allow multiple events of the same name
Fixes #1215
2017-01-23 15:25:13 +01:00
chriseth
0ef460461a Check if constructor is public or not. 2017-01-20 19:22:39 +01:00
chriseth
23a654ade8 Fix default function type name visibility. 2017-01-19 11:11:40 +01:00
Yoichi Hirai
7fea4b7360
analysis: use Declaration::functionType() in another location 2017-01-11 19:55:55 +01:00
Yoichi Hirai
eda147f47b
ast: add Declaration::functionType() 2017-01-11 19:55:50 +01:00
Yoichi Hirai
0216f34010
analysis: avoid emscripten build failure 2017-01-11 18:28:11 +01:00
Yoichi Hirai
91d4e8e0ba
analysis: changes necessary to compile std/StandardToken.sol 2017-01-11 18:28:11 +01:00
Yoichi Hirai
42b6726173
analysis: allow some shadowings explicitly 2017-01-11 18:28:11 +01:00
Yoichi Hirai
bff76c1ca0
analysis: report errors when inheritance causes collision 2017-01-11 18:28:11 +01:00
Federico Bond
de720e643d Improve error message when trying to modify constant variables 2016-12-13 00:32:37 -03:00
Federico Bond
05139500fb Warn about using msg.value in non-payable function 2016-12-08 16:22:13 -03:00
VoR0220
3f9f725737 Fix licensing headers
Signed-off-by: VoR0220 <rj@erisindustries.com>
2016-11-23 12:22:33 +01:00
chriseth
22b4d1b29a Check that no internals are used in any external function type. 2016-11-16 14:37:18 +01:00
chriseth
925d674146 Disallow payable internal functions. 2016-11-16 14:37:18 +01:00
chriseth
cc8583ec7d Function types. 2016-11-16 14:37:17 +01:00
Yoichi Hirai
6c15757618
Type checker: move the burden of computing mobile type to commonType
This solves #621
2016-11-11 15:51:54 +01:00
chriseth
762f7ac250 Suggest correct version for pragma and complain about pre-release version. 2016-10-25 13:45:50 +02:00
chriseth
2f7c847ce4 Merge pull request #1279 from ethereum/semver-helper
Export major/minor/patch helpers on SemVerVersion
2016-10-25 13:20:08 +02:00
Alex Beregszaszi
7a988555c3 Export major/minor/patch helpers on SemVerVersion 2016-10-25 12:13:41 +01:00
chriseth
e00a4b47c0 Merge pull request #1264 from ethereum/988
State variable under contract's name
2016-10-25 12:50:24 +02:00
Yoichi Hirai
59f6c18c2b
analysis: determine if a member access on a contract is an l-value 2016-10-24 19:31:57 +02:00
chriseth
f25aa0c68b More checks for missing mobile type. 2016-10-24 16:45:25 +02:00
Alex Beregszaszi
0dd75ac100 Use warning function in TypeChecker 2016-10-20 13:25:28 +01:00
Alex Beregszaszi
d18e56661d Disallow unsupported RValues in inline assembly 2016-10-19 20:44:15 +01:00
Alex Beregszaszi
9616470f67 Disallow magic variables in inline assembly 2016-10-19 20:44:15 +01:00
Yoichi Hirai
7ae68e1e47 Fix pragma keyword check
Fixes #1192
2016-10-11 00:00:22 +02:00
Alex Beregszaszi
34df80c502 Add alias keccak256() for sha3() 2016-10-06 16:34:41 +02:00
chriseth
031fd568cc Fix crash for TypeName[k]. 2016-09-15 18:16:34 +02:00
Alex Beregszaszi
7af8ecc27a Constructor must be internal or public 2016-09-06 17:53:13 +02:00
Alex Beregszaszi
319ec34093 Reject constant constructors 2016-09-06 17:31:29 +02:00
Alex Beregszaszi
6ec40b3cde Reject constant modifier on the fallback function 2016-09-06 11:40:00 +01:00
chriseth
384f189a6a Tests for payable / private combination. 2016-09-06 10:58:56 +02:00
chriseth
1eb7ddbb09 Make constant and payable mutually exclusive. 2016-09-05 21:28:28 +02:00
chriseth
9c64edf110 Change function type to include and propagate payable and constant modifier. 2016-09-05 21:28:28 +02:00
Alex Beregszaszi
962531af96 Merged in changes from chriseth/payable 2016-09-05 21:28:28 +02:00
chriseth
d87450b9b2 Use version string (including prerelease) for pragma matching. 2016-09-01 00:02:51 +02:00
chriseth
3c412ed2f6 Version pragma. 2016-09-01 00:02:51 +02:00
chriseth
4bfe09897e Make fallback function throw by default. 2016-08-30 15:31:50 +02:00
chriseth
21b6aa92ff Disallow fallback function to return values. 2016-08-26 00:07:50 +02:00
chriseth
6df6728165 Require modifiers to contain "_". 2016-08-16 14:52:47 +02:00
chriseth
25a64c7f8f Only warn about unused return in low-level functions. 2016-06-26 13:53:32 +02:00
chriseth
cc6314cd01 Warn about unused return values. 2016-06-26 13:53:32 +02:00
chriseth
ab7a22f4a0 Disallow implementation of abstract function by constructor of derived class. 2016-06-06 19:38:22 +02:00
moneroexample
9d237fbfdc fix: error: call of overloaded ‘list(int, <brace-enclosed initializer list>)’
Issue: https://github.com/ethereum/solidity/issues/574

Compilation of webthree-umbrella on Arch with gcc 6.1 results in the following
error:

/home/mwo/webthree-umbrella/solidity/libsolidity/analysis/NameAndTypeResolver.cpp:299:51: error: call of overloaded ‘list(int, <brace-enclosed initializer list>)’ is ambiguous
  list<list<ContractDefinition const*>> input(1, {});

This can be overcome by explicitly specifying initial value, for example:

  list<list<ContractDefinition const*>> input(1, list<ContractDefinition const*>{})
2016-05-17 13:27:39 +08:00
chriseth
d4206b7cd0 Remove unused tests and add asserts for not implemented parts in code generation.
quick fix on christian's rational

change so that ubuntu will stop yelling

be more specific with rational declaration for Windows sake

rational in namespace correction for windows
2016-05-10 16:03:33 -05:00
chriseth
656405240e Simplify interface of RationalNumber. 2016-05-10 19:40:37 +02:00
chriseth
80c368dac1 Prefer mobileType() to check rational range. 2016-05-10 19:40:35 +02:00
VoR0220
a6fc3c8f30 reorganized tests and fixed mobile types and implicit conversions of rationals and fixed point types
one final tweak

check for null types
2016-05-09 11:41:03 -05:00
VoR0220
bfc238c8d1 updated algorithm for bit finding...now to figure out literal value
tiny fixups

changed location of the check

got rid of extra space and fixed a couple of things

added binary results bits

change back literal value
2016-05-09 11:41:03 -05:00
VoR0220
f67bfd24a3 rational renaming 2016-05-09 11:41:03 -05:00
VoR0220
4b749fc333 changed names for Rational Constants and categories 2016-05-09 11:41:02 -05:00
RJ Catalano
9a075458ad initial work for fixed types...potentially needing a constant literal type for this
notation

Rational implemented...trying to figure out exponential

fix for token bug, also quick fix for the wei and seconds

fixed problem with var...probably a conversion problem for fixed in size capabilities

adding fixed type tests

Removing bitshift and regrouping fixed type tests together

size capabilities functioning properly for fixed types

got exponents up and working with their inverse, changed a few of the tests....something is working that likely shouldn't be

slight changes to how to flip the rational negative around...still trying to figure it out

tests added

updated tests

odd differences in trying soltest from solc binary, let me know if you can replicate

test not working for odd reason

fixed test problem with fixed literals...still need a way to log this error

broken up the tests, added some, changed some things in types and began compiler work

moar tests and prepping for rebuilding much of the types.cpp file

further fixing

initial work for fixed types...potentially needing a constant literal type for this
2016-05-09 11:41:02 -05:00
Dimitry
d2cee6f9c6 reduce unnecessary solidity:: namespace 2016-04-04 15:41:35 +04:00
Dimitry
858c41260d rename namespace for instruction.h/cpp in libevmasm 2016-04-02 15:56:43 +03:00
chriseth
f049430723 Code generation (missing external access and source locations). 2016-03-30 02:37:00 +02:00
RJ Catalano
7b918a7bc7 changes to redefine the token list, the scanner, and the parser and how they pass around variable types of different sizes
not ready for change to FixedPoint just yet

made this more const correct and added a switch statement for easier reading
2016-02-18 11:22:52 -06:00
chriseth
4a837169c5 Fix segfault when using wrong number of constructor arguments. 2016-02-11 17:12:30 +01:00