Skip to content

Conversation

Mikaka27
Copy link
Contributor

@Mikaka27 Mikaka27 commented Aug 29, 2025

Fixes #8235

Copy link
Contributor

github-actions bot commented Aug 29, 2025

CT Test Results

  2 files   36 suites   12m 20s ⏱️
151 tests 146 ✅ 5 💤 0 ❌
179 runs  174 ✅ 5 💤 0 ❌

Results for commit 08fb796.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@Mikaka27 Mikaka27 requested a review from Copilot August 29, 2025 16:10
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements an indirect_inherits feature for the Diameter dictionary compiler that enables automatic recursive inheritance resolution. The feature ensures that when a dictionary inherits from another dictionary, all ancestors in the inheritance chain are automatically considered during code generation, eliminating the need to explicitly list all parent dictionaries.

  • Adds new indirect_inherits option to the diameter compiler
  • Implements automatic resolution of inheritance chains with proper handling of AVPs, enums, and vendor IDs
  • Adds comprehensive test suites to verify inheritance behavior

Reviewed Changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
lib/diameter/test/modules.mk Adds new test suites to the build configuration
lib/diameter/test/diameter_indirect_inherits_SUITE.erl Comprehensive test suite for indirect inheritance functionality
lib/diameter/test/diameter_codegen_SUITE.erl Test suite for code generation aspects of indirect inheritance
lib/diameter/test/diameter_compiler_SUITE.erl Updates existing compiler tests to support indirect inherits
lib/diameter/src/compiler/diameter_make.erl Adds documentation for the new indirect_inherits option
lib/diameter/src/compiler/diameter_dict_util.erl Core implementation of inheritance chain resolution logic
lib/diameter/src/compiler/diameter_codegen.erl Updates code generation to handle inherited enums properly
lib/diameter/doc/references/diameterc_cmd.md Documents the new --indirect-inherits command line option
lib/diameter/doc/references/diameter_dict.md Comprehensive documentation of inheritance behavior

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

end_per_suite/1,
init_per_testcase/2,
end_per_testcase/2,

Copy link
Preview

Copilot AI Aug 29, 2025

Choose a reason for hiding this comment

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

Remove the trailing whitespace on this line.

Suggested change

Copilot uses AI. Check for mistakes.

end_per_suite/1,
init_per_testcase/2,
end_per_testcase/2,

Copy link
Preview

Copilot AI Aug 29, 2025

Choose a reason for hiding this comment

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

Remove the trailing whitespace on this line.

Suggested change

Copilot uses AI. Check for mistakes.

verify_multiple_limited_imports_same_file(_) ->
%% This test checks that when you inherit same avp twice you get avp_already_defined error.
DictA = ?AVP_DICT_A,
DictB = ?AVP_DICT_B(["@inherits diameter_test_a AAA", "@inherits diameter_test_a AAA"]),
Copy link
Preview

Copilot AI Aug 29, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider extracting the duplicate inherit statement into a variable to make the test intent clearer and reduce duplication.

Copilot uses AI. Check for mistakes.

Comment on lines +1316 to +1317
% inherited_modules/2
% Returns list of inherited modules, without returning module in which avp is defined
Copy link
Preview

Copilot AI Aug 29, 2025

Choose a reason for hiding this comment

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

The comment style is inconsistent - use %% for function documentation comments to match the rest of the file.

Suggested change
% inherited_modules/2
% Returns list of inherited modules, without returning module in which avp is defined
%% inherited_modules/2
%% Returns list of inherited modules, without returning module in which avp is defined

Copilot uses AI. Check for mistakes.

Comment on lines +1512 to +1516
NestedInherits = lists:flatmap(fun([]) ->
[];
({Mod, _}) ->
get_all_inherits_from_module(dict(?A(Mod)))
end, Inherits),
Copy link
Preview

Copilot AI Aug 29, 2025

Choose a reason for hiding this comment

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

[nitpick] The pattern matching for empty list ([]) -> [] could be simplified by filtering out empty lists before the flatmap operation for better readability.

Suggested change
NestedInherits = lists:flatmap(fun([]) ->
[];
({Mod, _}) ->
get_all_inherits_from_module(dict(?A(Mod)))
end, Inherits),
NestedInherits = lists:flatmap(
fun({Mod, _}) ->
get_all_inherits_from_module(dict(?A(Mod)))
end,
[I || I <- Inherits, I =/= []]
),

Copilot uses AI. Check for mistakes.

@Mikaka27 Mikaka27 self-assigned this Aug 29, 2025
@Mikaka27 Mikaka27 added team:PS Assigned to OTP team PS testing currently being tested, tag is used by OTP internal CI labels Aug 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team:PS Assigned to OTP team PS testing currently being tested, tag is used by OTP internal CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Diameter .dia not automatically inheriting indirect inherits
1 participant