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

[Bug]: Invalid type assigned to literals #1688

Open
Shungy opened this issue Feb 24, 2023 · 1 comment
Open

[Bug]: Invalid type assigned to literals #1688

Shungy opened this issue Feb 24, 2023 · 1 comment
Labels
bug Something isn't working ir

Comments

@Shungy
Copy link

Shungy commented Feb 24, 2023

Describe the issue:

It appears that IR considers literals as uint256 or int256 type, but they should be assigned the smallest possible type instead.

Code example to reproduce the issue:

	function test5(uint40 x) external view returns (uint256 res) {
		res = x * 50;
	}

50 should be uint8, but ir.variable_right.type returns uint256.

Version:

0.9.2

Relevant log output:

No response

@Shungy Shungy added the bug-candidate Bugs reports that are not yet confirmed label Feb 24, 2023
@0xalpharush
Copy link
Contributor

There currently is consistent support for the implicit type conversions #284. We should try to reach parity with Solidity so we can have detectors for unsafe casts

@0xalpharush 0xalpharush added bug Something isn't working ir and removed bug-candidate Bugs reports that are not yet confirmed labels Feb 24, 2023
@0xalpharush 0xalpharush changed the title [Bug-Candidate]: Invalid type assigned to literals [Bug]: Invalid type assigned to literals Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ir
Projects
None yet
Development

No branches or pull requests

2 participants