Skip to content

[v2] Reintroduce built-ins to the language definition and generate an enum for the AST API#1655

Open
ggiraldez wants to merge 4 commits intoggiraldez/v2-migrate-astfrom
ggiraldez/v2-spec-built-ins
Open

[v2] Reintroduce built-ins to the language definition and generate an enum for the AST API#1655
ggiraldez wants to merge 4 commits intoggiraldez/v2-migrate-astfrom
ggiraldez/v2-spec-built-ins

Conversation

@ggiraldez
Copy link
Copy Markdown
Contributor

Builds on top of #1597

This PR reintroduces the built-in definitions to the language model, this time as a simple enumeration. This serves a dual purpose:

  • We can declare the versions at which they are introduce or deprecated, so that we can properly test those versions for semantic differences in the semantic snapshots.
  • It can produce an enum that can be used in the AST public API without leaking internal only types such as NodeId and TypeId which the existing BuiltIn enum has for resolution/typing purposes.

The built-ins declarations contain the valid version range, but that's not used for validation since it's hard-coded in the built-ins resolver code. It would be hard to generate that code from the definitions, but maybe we can use that information somehow when implementing semantic validation.

I'm not sure it makes sense to put the generated enum in the common crate, but since it's only constants it maybe fits the bill there. Happy to move it somewhere else. Ideally I'd like to avoid having also an internal enum, but I don't see how we can remove that without losing the type checking benefits for the variants that carry extra information.

The PR also removes obsolete built-ins no longer valid in Solidity >= 0.8.0 that slipped through the cracks in the migration.

@ggiraldez ggiraldez requested review from OmarTawfik and teofr April 9, 2026 18:45
@ggiraldez ggiraldez requested review from a team as code owners April 9, 2026 18:45
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 9, 2026

⚠️ No Changeset found

Latest commit: 1778173

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ggiraldez ggiraldez force-pushed the ggiraldez/v2-migrate-ast branch from 5dc7adb to e917ee5 Compare April 9, 2026 20:44
@ggiraldez ggiraldez force-pushed the ggiraldez/v2-spec-built-ins branch from 31cb643 to e63f118 Compare April 9, 2026 20:45
@ggiraldez ggiraldez force-pushed the ggiraldez/v2-migrate-ast branch from e917ee5 to 592548c Compare April 13, 2026 15:34
@ggiraldez ggiraldez force-pushed the ggiraldez/v2-spec-built-ins branch from e63f118 to 1778173 Compare April 13, 2026 15:37
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.

1 participant