Skip to content

Conversation

@matheusaaguiar
Copy link
Collaborator

@matheusaaguiar matheusaaguiar commented Sep 24, 2025

Partially solves #15795 and #14770.

@matheusaaguiar matheusaaguiar force-pushed the futureKeywordWarnings branch 3 times, most recently from 586c3ca to 268a776 Compare October 3, 2025 18:17
@github-actions
Copy link

This pull request is stale because it has been open for 14 days with no activity.
It will be closed in 7 days unless the stale label is removed.

@github-actions github-actions bot added the stale The issue/PR was marked as stale because it has been open for too long. label Oct 18, 2025
@matheusaaguiar matheusaaguiar removed the stale The issue/PR was marked as stale because it has been open for too long. label Oct 20, 2025
@github-actions
Copy link

This pull request is stale because it has been open for 14 days with no activity.
It will be closed in 7 days unless the stale label is removed.

@github-actions github-actions bot added the stale The issue/PR was marked as stale because it has been open for too long. label Nov 11, 2025
@matheusaaguiar matheusaaguiar removed the stale The issue/PR was marked as stale because it has been open for too long. label Nov 11, 2025
@github-actions
Copy link

This pull request is stale because it has been open for 14 days with no activity.
It will be closed in 7 days unless the stale label is removed.

@github-actions github-actions bot added the stale The issue/PR was marked as stale because it has been open for too long. label Nov 26, 2025
@matheusaaguiar matheusaaguiar removed the stale The issue/PR was marked as stale because it has been open for too long. label Nov 26, 2025
pragma solidity >=0.4.16 <0.9.0;
library GetCode {
// This will report a warning - at you will be promoted to reserved keyword
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// This will report a warning - at you will be promoted to reserved keyword
// This will report a warning - `at` will be promoted to a reserved keyword

Comment on lines +533 to +534
if (futureKeywords.count(_declaration.name()))
m_errorReporter.warning(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if is indented too much.

Suggested change
if (futureKeywords.count(_declaration.name()))
m_errorReporter.warning(
if (futureKeywords.contains(_declaration.name()))
m_errorReporter.warning(

@@ -1,3 +1,4 @@
contract at layout at type(uint).max { }
Copy link
Collaborator

@cameel cameel Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rename the contract here and in other similar tests to something other than at or layout. The name is not the point of the test and we already have it covered by contract_named_at.sol and contract_named_layout.sol.

Comment on lines +962 to +967
if (m_evmVersion < langutil::EVMVersion::london())
futureReservedKeywords.insert("basefee");
if (m_evmVersion < langutil::EVMVersion::paris())
futureReservedKeywords.insert("prevrandao");
if (m_evmVersion < langutil::EVMVersion::cancun())
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This warning should not be EVM-version dependent. When we make these into keywords, they will be disallowed regardless of EVM version.

Comment on lines +538 to +539
"\"{}\" will be promoted to reserved keyword in the next breaking version"
" and will not be allowed as an identifier anymore.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessarily something to change here, but just wanted to note that our terminology is all over the place: "keyword" vs "reserved keyword" vs "reserved identifier". We should get that straight at some point, because these are not synonyms.

Copy link
Collaborator

@cameel cameel Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add a few more tests:

  • That the future keywords trigger the warning when used as:
    • module name (import ... as X or import * as X from ...)
    • alias name (import {... as X} from ...)
    • UDVT name
    • struct/enum field name
    • Yul variable/function name
  • That the future Yul keywords (i.e. leave) do trigger the warning outside of Yul.
    • It's actually up for discussion whether these should be reserved at Solidity level, but so far that has been the case with all other Yul keywords (including switch and let, which have no functionality in Solidity).
  • That the future Yul reserved identifiers (e.g. blobhash) do not trigger the warning outside of Yul.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR needs a changelog entry.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should also add a note/warning about the new keywords under Reserved Keywords in the docs.

Comment on lines +525 to +532
std::set<ASTString> const futureKeywords = {
"transient",
"layout",
"at",
"error",
"super",
"this"
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should put the list in a more general location. Token.h seems like the most appropriate one. We already have isYulKeyword() there. We can add isFutureSolidityKeyword() and isFutureYulKeyword().

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.

3 participants