-
Notifications
You must be signed in to change notification settings - Fork 744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix several issues with object type reference #18404
Fix several issues with object type reference #18404
Conversation
…into obj-reference-fixes
Codecov Report
@@ Coverage Diff @@
## master #18404 +/- ##
=======================================
Coverage 14.82% 14.82%
=======================================
Files 48 48
Lines 1268 1268
Branches 201 201
=======================================
Hits 188 188
Misses 1066 1066
Partials 14 14 Continue to review full report at Codecov.
|
@@ -1688,6 +1690,7 @@ private void createDummyTypeDefSymbol(TypeDefinition typeDefNode, SymbolEnv env) | |||
|
|||
private void resolveReferencedFields(BLangStructureTypeNode structureTypeNode, SymbolEnv typeDefEnv) { | |||
List<BSymbol> referencedTypes = new ArrayList<>(); | |||
List<BLangType> invalidTypeRefs = new ArrayList<>(); | |||
// Get the inherited fields from the type references | |||
structureTypeNode.referencedFields = structureTypeNode.typeRefs.stream().flatMap(typeRef -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, This is not a good stream implementation. we should refactor this later.
} | ||
|
||
BObjectType objectType = (BObjectType) referredType; | ||
if (structureTypeNode.type.tsymbol.owner != referredType.tsymbol.owner) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There can be scenario, this logic fails, Like, local type def. Better to validate pkg, instated.
Purpose
$title.
Fixes #17920 Referencing objects with fields/methods with module level visibility is not restricted across modules
Fixes #18370 No validation for function param visibility match when referencing objects
Fixes #13822 Referencing two abstract objects which both have a method with the same signature does not cause a compilation error
Fixes #18402 Object type reference attempts copying methods of invalid references
Approach
Samples
Remarks
Check List