Skip to content

Handle nil dependencies in case of inheritance#1620

Merged
KaanOzkan merged 1 commit into
Shopify:mainfrom
LTe:active-support-dsl-inheritance
Aug 28, 2023
Merged

Handle nil dependencies in case of inheritance#1620
KaanOzkan merged 1 commit into
Shopify:mainfrom
LTe:active-support-dsl-inheritance

Conversation

@LTe

@LTe LTe commented Aug 24, 2023

Copy link
Copy Markdown
Contributor

Motivation

When you inherit from class that extends ActiveSupport::Concern it will break DSL compiler ActiveSupportConcern.

Implementation

This commit modifies the dependencies_of method in the ActiveSupport::Concern compiler to ensure it returns an empty array when the concern has no dependencies, preventing potential nil errors.

A new test ensures that constants inheriting from a class extending ActiveSupport::Concern are not gathered, ensuring only direct dependencies are included.

Tests

I added specs

This commit modifies the `dependencies_of` method in the
ActiveSupport::Concern compiler to ensure it returns an empty array
when the concern has no dependencies, preventing potential `nil` errors.

A new test ensures that constants inheriting from a class extending
ActiveSupport::Concern are not gathered, ensuring only direct
dependencies are included.
@LTe LTe requested a review from a team as a code owner August 24, 2023 11:02
@LTe LTe requested review from Morriar and st0012 August 24, 2023 11:02
@KaanOzkan KaanOzkan merged commit b1dd52e into Shopify:main Aug 28, 2023
@shopify-shipit shopify-shipit Bot temporarily deployed to production September 13, 2023 22:55 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants