Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[soltest] Add support for left-aligned hex literals #6036

Merged
merged 1 commit into from
Feb 21, 2019

Conversation

erak
Copy link
Collaborator

@erak erak commented Feb 19, 2019

Part of #4223.

This PR aims to add support for hex literals in (i)soltest. Hex literals result in a left-aligned, padded 32-byte representation:

contract C {
    function g(uint x, uint y) public returns (uint) {
        return x - y;
    }
    function x(bytes32 b) public returns (bytes32) {
        return b;
    }
}
// ----
// g(uint256,uint256): 1, -2 -> 3
// x(bytes32): 0x31 -> 0x31

Decimal number literals are still right-aligned, padded 32 bytes.

This PR also moves some code that is shared between the Solidity parser and the soltest parser.

@codecov
Copy link

codecov bot commented Feb 19, 2019

Codecov Report

Merging #6036 into develop will increase coverage by 0.03%.
The diff coverage is 97.56%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #6036      +/-   ##
===========================================
+ Coverage    88.66%   88.69%   +0.03%     
===========================================
  Files          368      368              
  Lines        34956    35031      +75     
  Branches      4131     4133       +2     
===========================================
+ Hits         30992    31070      +78     
+ Misses        2573     2568       -5     
- Partials      1391     1393       +2
Flag Coverage Δ
#all 88.69% <97.56%> (+0.03%) ⬆️
#syntax 27.82% <4.87%> (-0.05%) ⬇️

@erak erak self-assigned this Feb 19, 2019
@erak erak force-pushed the soltest-hexliterals branch from 2bc0b6c to 15bc101 Compare February 19, 2019 17:53
@erak
Copy link
Collaborator Author

erak commented Feb 19, 2019

Updated. Hex number literals with an odd number of digits now throw an exception and character checking is shared in the langutil namespace.

@erak
Copy link
Collaborator Author

erak commented Feb 20, 2019

Will push an update very soon, that does not decrease coverage.

@erak erak force-pushed the soltest-hexliterals branch from 82b1e0d to d02a26d Compare February 21, 2019 00:29
@erak erak changed the base branch from develop to soltest-langutil-commons February 21, 2019 00:30
@erak erak changed the base branch from soltest-langutil-commons to soltest-formatting February 21, 2019 01:07
@erak erak force-pushed the soltest-hexliterals branch from d02a26d to ecf21ff Compare February 21, 2019 01:07
@erak erak mentioned this pull request Feb 21, 2019
1 task
@erak erak force-pushed the soltest-formatting branch from 92e0b99 to d1ad431 Compare February 21, 2019 15:39
@erak erak force-pushed the soltest-hexliterals branch from ecf21ff to d40928f Compare February 21, 2019 16:07
@erak erak changed the base branch from soltest-formatting to develop February 21, 2019 16:07
@erak
Copy link
Collaborator Author

erak commented Feb 21, 2019

Rebased.

@chriseth chriseth merged commit 773a3ff into develop Feb 21, 2019
@chriseth chriseth deleted the soltest-hexliterals branch April 30, 2019 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants