Commit Graph

201 Commits

Author SHA1 Message Date
Nicolás Acosta
da7dfeb0c5 style(reference-types): fix mapping style 2023-02-01 15:54:32 -03:00
Nicolás Acosta
e89efe89a6 style(mapping-types): fix mapping style 2023-02-01 15:49:34 -03:00
Daniel
f441e1323a
Merge pull request #13384 from zemse/develop
Allow named parameters in mapping types
2023-01-09 17:59:29 +01:00
Soham Zemse
fa78e0f3d4 feat: allow named parameters in mapping types
Co-authored-by: Hari <webmail.hari@gmail.com>

test: add parser and abi test cases

docs: add example on using named parameters for mappings

- Add changelog

feat: update antlr grammar to allow named parameters in mappings

fix: prevent conflicting mapping parameter names

ref: change order of mapping initializers

test: update expectations and fix build

test: add more tests

fix: use common error & code for conflicting params

fix: issue with accessing nested mapping

test: add conflicting params tests for more nested levels

Update libsolidity/analysis/DeclarationTypeChecker.cpp

Co-authored-by: Nikola Matić <nikola.matic@ethereum.org>

fix: error reported with the same code twice

test: add more tests for 3 level nested mapping

Address review comments
2022-12-08 11:56:58 +01:00
wechman
64a4f32bc2 Consistent terminology for attached/bound functions 2022-12-07 19:31:41 +01:00
Sabnock
dbc1bc1515
Array member clarification (#13763)
* clarify array members

Co-authored-by: Kamil Śliwak <cameel2@gmail.com>
2022-11-30 00:39:57 +01:00
andy53
1e5c229a37 update value-types.rst 2022-11-10 15:42:31 -03:00
nishant-sachdeva
8c0740748e functions taking calldata args should be assignable to function pointers of same type 2022-10-26 13:29:02 +05:30
emmaodia
0d98436de6 Grammar fix 2022-09-05 20:34:10 +02:00
Leo
5cf3973bb5
Merge pull request #12852 from aathan/patch-9
Update reference-types.rst
2022-08-13 15:09:33 +02:00
Leo
9dd2e0ec3f
Merge pull request #12954 from aathan/clarify-address-literals-eip-55
Link to address literals from address value types
2022-08-13 15:06:34 +02:00
Leo
898ad25aab Review suggestions 2022-08-13 14:25:09 +02:00
aathan
18ce69ebbd Update reference-types.rst 2022-08-13 14:25:09 +02:00
Leo
681581d7f0
Merge pull request #12844 from aathan/patch-6
Update operators.rst
2022-08-13 14:25:07 +02:00
aathan
ffbb6f159e Update value-types.rst 2022-08-13 14:22:42 +02:00
aathan
9d5fb1bf8b Update operators.rst 2022-08-13 13:36:57 +02:00
aathan
f1a5bc7ed9 Update reference-types.rst
Clarify comment using language similar to that in the Array section of the documentation. Previously it said simply "Because of that..." but what the word "that" was about, was not evident.
2022-08-13 13:29:22 +02:00
vdusart
f012a77980
Fix mistake 2022-07-07 13:48:20 +02:00
vdusart
eb6b1291b7
Fix type error
Fix type error according to #13144
2022-07-07 13:41:33 +02:00
CJ42
e4d3425ad9 docs: add uint160 type in address conversion section
docs: add notice for uint conversion before 0.8.0

docs: edit sentence structure + remove 'result in `address payable`'

docs: add keyword 'explicitly' to be more specific for `address payable`

docs: edit notice uint to address conversion change since 0.8.0

Co-authored-by: Kamil Śliwak <cameel2@gmail.com>
2022-07-01 09:43:24 -03:00
Aiman Baharna
392b1872b3 docs: Disallow decimal literals with trailing dots
Currently the documentation suggests that a decimal literal can omit the
fractional part [1]:

> Decimal fractional literals are formed by a `.` with at least one
> number on one side. Examples include `1.`, `.1` and `1.3`.

However, commit ac68710 (May 30, 2018) disallowed trailing dots that are
not followed by a number [2].

Using decimal literals of the form `1.` will actually result in a
`ParserError` and so the docs should no longer recommend this form.

[1] https://docs.soliditylang.org/en/v0.8.15/types.html#rational-and-integer-literals
[2] ac68710789
2022-06-22 17:19:12 +01:00
Daniel Kirchner
3f112280f8 Add warning comment to dangling references docs. 2022-06-15 14:52:37 +02:00
Daniel Kirchner
1cb8e17d94 Add documentation section about dangling references.
Co-authored-by: Kamil Śliwak <kamil.sliwak@codepoets.it>
2022-06-15 12:51:24 +02:00
Kamil Śliwak
1ab84bb361 Put the table with operator precedence in a separate file, included in both Operators and Cheatsheet 2022-06-14 14:41:41 +02:00
shady41
ecb7c0b008 Moved operator precedence from the cheatsheet to the operator docs 2022-05-25 23:07:51 +02:00
alpharush
93755fcb70
document that pop does not return last element
It's already documented for push and this would clarify my incorrect assumption (that pop returns a value as in other languages) that caused confusion with https://github.com/ethereum/solidity/issues/13017
2022-05-13 09:45:55 -05:00
aathan
54fa215885
Update mapping-types.rst
typo
2022-03-23 17:15:17 -07:00
aathan
07c9384b44
Update value-types.rst 2022-03-22 23:06:23 -07:00
Richie
beb51068bb
fix: corrects _ prefixes 2022-03-14 08:03:10 -07:00
nishant-sachdeva
b7a9daa2f8 Generate warning when rational numbers are converted to their mobile type without explicit requests 2022-03-14 14:04:46 +05:30
chriseth
fb7cdda891 Fix iterable mapping example. 2022-02-28 17:57:19 +01:00
Richie
49f06dacdf fix: remove lower_case_with_underscores and Capitalized_Words_With_Underscores from code examples 2022-02-21 10:53:35 -08:00
nishant-sachdeva
276851ff91 Added support for FunctionType::Kind::StringConcat and functions string.concat 2022-02-10 22:08:47 +05:30
chriseth
a9b9170a1b
Merge pull request #12636 from fulldecent/patch-25
Fix signature of pop member
2022-02-07 13:03:51 +01:00
Naveen Sahu
2e2094ad82 plain address can be sent Ether too
The docs state that a plain `address` cannot be sent Ether. But even though `send` and `transfer` members are not available for plain `address`, the `call` is. And `call` can be invoked upon a plain `address` type to send Ether to the address.

For instance, the `someone` (`address` type) can be sent Ether by invoking `sendSomeone()` method in the following `Dummy` contract:

```
contract Dummy {
    address someone = 0xAb8...cb2;

    function balanceOf(address addr) public view returns (uint) {
        return addr.balance;
    }

    function sendToSomeone() public payable returns (bool) {
        (bool sent, ) = someone.call{value: msg.value}("");
        return sent;
    }
}
```
2022-02-07 12:44:21 +01:00
William Entriken
6bd38aa4ef
Fix signature of pop member 2022-02-05 23:59:09 -05:00
chriseth
8728971354
Correct type of address.code 2022-01-31 19:07:01 +01:00
William Entriken
78f0be56c3 Document address members code and codehash 2022-01-13 01:20:45 -05:00
Daniel Kirchner
cac0f203a2
Merge pull request #12467 from ethereum/fixMappingExample
Fix mapping example.
2022-01-04 18:23:57 +01:00
Pranay Reddy
f30130888e Added specificity to data location.
Added the specificity that bytes1[] and bytes differ because of padding only in memory data location. Added extra sentence that they are similar when used in storage data location.
2022-01-03 12:47:51 +05:30
chriseth
0010027e17 Fix mapping example. 2021-12-30 15:28:09 +01:00
chriseth
c15ef45d29 Explanation about operators. 2021-12-15 18:37:18 +01:00
chriseth
d414153258 Some clarifications on literals. 2021-12-06 17:36:34 +01:00
Alex Beregszaszi
b36a3c6bf5
Fix documentation for valid ASCII string literals 2021-11-20 22:41:19 +00:00
José López
b4a527039f fixed example address payable 2021-11-03 20:21:31 -03:00
sgmoore
ca232142be
Update value-types.rst - fix typo
Fix typo at line 69.
2021-10-02 20:32:25 -07:00
CrimsonGlory
e2bb3a3347
[docs] Add bitwise assignment operators
Add bitwise assignment operators to the list of operators involving LValues [skip ci]
2021-09-25 21:48:20 -03:00
hrkrshnn
952540c3b5 User defined value type: changes in documentation and test case
Changed the name of a function from `truncate` to `floor`, since that is more appropriate; updated
the inaccurate description on the rounding behaviour. Also modified the respective semantic test.
2021-09-09 16:57:03 +02:00
hrkrshnn
fbb1b884b2 Documentation and Changelog 2021-09-08 21:19:30 +02:00
Marenz
2b28f87abf Add type().min/max for enums 2021-09-01 15:02:02 +02:00