Skip to content

feat: Add support for extension types, class type aliases and class modifiers#19

Merged
spydon merged 3 commits into
mainfrom
feat/modern-language-features
Jun 22, 2026
Merged

feat: Add support for extension types, class type aliases and class modifiers#19
spydon merged 3 commits into
mainfrom
feat/modern-language-features

Conversation

@spydon

@spydon spydon commented Jun 22, 2026

Copy link
Copy Markdown
Member

Description

Adds support for several modern Dart language features that the extractor did not handle. Previously, extension types and class type aliases would throw an AssertionError (Unknown declaration type: ...), and the Dart 3 class modifiers were silently dropped.

Extension types

extension type Meters(int value) implements num {} is now serialized with a new "extension-type" kind, including its representation declaration, const modifier, implements clause, type parameters and members:

{
  "kind": "extension-type",
  "name": "Meters",
  "representation": {"name": "value", "type": "int"},
  "implements": ["num"]
}

Class type aliases

class C = B with M implements I; (ClassTypeAlias) is now serialized as a "class" declaration with its extends/with/implements clauses and modifiers.

Class modifiers

The Dart 3 base, interface, final, sealed and mixin class modifiers are now reported as boolean fields on class declarations (and base on mixins), alongside the existing abstract field.

Notes

  • The ExtensionTypeDeclaration and RepresentationDeclaration AST nodes are still flagged @experimental by the analyzer even though extension types have been stable since Dart 3.3, so a scoped experimental_member_use ignore is used.
  • Following the repository convention, the version bump and CHANGELOG.md entry are left for a separate release PR.

Testing

  • dart format .
  • dart analyze --fatal-warnings --fatal-infos
  • dart test (81 tests passing, up from 69)

@spydon
spydon requested a review from a team June 22, 2026 08:21
@spydon
spydon merged commit bf18d41 into main Jun 22, 2026
3 checks passed
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