Skip to content

Conversation

@davidmorgan
Copy link
Contributor

@davidmorgan davidmorgan commented Jul 15, 2025

For #1265.

This edits pubspec+CHANGELOG as if there will be a dev release, but I don't think we actually need to release it, I think the actual build 3.0.0 release will be this week or early next week.

Summary by CodeRabbit

  • New Features

    • Updated compatibility to support the latest Dart analyzer element2 API, ensuring continued functionality with future Dart SDKs.
  • Bug Fixes

    • Improved internal handling of code generation and type resolution by migrating to the new analyzer APIs, reducing potential for incompatibility issues.
  • Chores

    • Upgraded dependencies to development versions, including build, source_gen, and json_serializable.
    • Updated test suite to align with the new analyzer element2 API and maintain test coverage.

@coderabbitai
Copy link

coderabbitai bot commented Jul 15, 2025

Walkthrough

This update migrates the Freezed codebase and tests from the Dart analyzer's legacy element API to the new element2 API. All relevant imports, type usages, and property accesses are updated accordingly. The package version and dependencies are incremented to development releases compatible with the new analyzer API. No changes to the overall logic or control flow are introduced.

Changes

File(s) / Group Change Summary
pubspec.yaml, CHANGELOG.md Bump version to 3.2.0-dev; update dependencies (build, source_gen, json_serializable, build_test) to dev/major versions supporting analyzer element2 API.
lib/src/ast.dart, lib/src/models.dart, lib/src/parse_generator.dart, lib/src/templates/concrete_template.dart, lib/src/templates/parameter_template.dart, lib/src/templates/properties.dart, lib/src/templates/prototypes.dart, lib/src/tools/imports.dart, lib/src/tools/recursive_import_locator.dart, lib/src/tools/type.dart Migrate all imports, types, and property accesses from element.dart to element2.dart. Update all analyzer element usages (e.g., ElementElement2, .name.name3, .fields.fields2, .metadata.metadata2.annotations, etc.). Update method and extension signatures to use new types. Add null safety where required. No changes to logic or control flow.
lib/src/parse_generator.dart, lib/src/templates/concrete_template.dart, lib/src/templates/parameter_template.dart, lib/src/templates/properties.dart, lib/src/templates/prototypes.dart, lib/src/tools/imports.dart, lib/src/tools/recursive_import_locator.dart, lib/src/tools/type.dart Update function/extension signatures and class fields to use element2 types (e.g., Element2, LibraryElement2, FormalParameterElement, etc.).
test/bidirectional_test.dart, test/common_types_test.dart, test/decorator_test.dart, test/deep_copy_test.dart, test/generic_test.dart, test/generics_refs_test.dart, test/json_test.dart, test/multiple_constructors_test.dart, test/optional_maybe_test.dart, test/single_class_constructor_test.dart, test/typedef_parameter_test.dart Update test code to use element2 API: change imports, update type references, and property/method accesses (e.g., element.sourceelement.firstFragment.source, ClassElementClassElement2, etc.). No changes to test logic or assertions.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant FreezedGenerator
    participant AnalyzerElement2

    User->>FreezedGenerator: Run code generation
    FreezedGenerator->>AnalyzerElement2: Query class, constructor, field, and type info (element2 API)
    AnalyzerElement2-->>FreezedGenerator: Return element2-based metadata
    FreezedGenerator-->>User: Output generated code (unchanged logic, new API)
Loading

Suggested reviewers

  • rrousselGit

Poem

A hop and a skip, through element lands,
We trade old for new with gentle hands.
From .name to .name3, the changes abound,
With element2 magic, new methods are found!
The code still runs true, the tests all agree—
Freezed is now future-proof, as happy as can be!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cd335da and 32b29eb.

📒 Files selected for processing (1)
  • packages/freezed/pubspec.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/freezed/pubspec.yaml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: freezed (packages/freezed, stable, get)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@davidmorgan davidmorgan force-pushed the element2 branch 4 times, most recently from f1471fc to 3079fb3 Compare July 16, 2025 12:26
@davidmorgan davidmorgan force-pushed the element2 branch 2 times, most recently from c66763a to 6fa2d30 Compare July 16, 2025 14:33
@davidmorgan davidmorgan marked this pull request as ready for review July 16, 2025 14:46
@rrousselGit
Copy link
Owner

LGTM thanks :)

@rrousselGit
Copy link
Owner

Ping me when a stable version of the packages is available. I'd rather not merge before then.

@CodeDoctorDE
Copy link

stable version is out: https://pub.dev/packages/build/changelog

@davidmorgan
Copy link
Contributor Author

@rrousselGit pubspec updated to remove -dev, looking good :)

@rrousselGit
Copy link
Owner

Thanks!

@rrousselGit rrousselGit merged commit 562b66a into rrousselGit:master Jul 18, 2025
4 checks passed
This was referenced Sep 9, 2025
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