Skip to content
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 dependently-typed functions with type reference union member types #43017

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MaryamZi
Copy link
Member

@MaryamZi MaryamZi commented Jul 1, 2024

Purpose

$title.

Fixes #43012

Check List

  • Read the Contributing Guide
  • Updated Change Log
  • Checked Tooling Support (#)
  • Added necessary tests
    • Unit Tests
    • Spec Conformance Tests
    • Integration Tests
    • Ballerina By Example Tests
  • Increased Test Coverage
  • Added necessary documentation
    • API documentation
    • Module documentation in Module.md files
    • Ballerina By Examples

@MaryamZi MaryamZi added the Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. label Jul 1, 2024
@MaryamZi MaryamZi added this to the 2201.10.0 milestone Jul 1, 2024
Copy link

codecov bot commented Jul 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.68%. Comparing base (863c1de) to head (82715a8).
Report is 91 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #43017      +/-   ##
============================================
- Coverage     77.68%   77.68%   -0.01%     
+ Complexity    51481    51480       -1     
============================================
  Files          2933     2933              
  Lines        204239   204244       +5     
  Branches      26720    26721       +1     
============================================
+ Hits         158666   158667       +1     
- Misses        36948    36951       +3     
- Partials       8625     8626       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -986,7 +986,8 @@ private BType getMatchingTypeForInferrableType(BType originalType, BType expType

for (BType inferableType : inferableTypes) {
for (BType expectedType : expectedTypes) {
if (Types.getImpliedType(inferableType).tag == Types.getImpliedType(expectedType).tag) {
expectedType = Types.getImpliedType(expectedType);
if (Types.getImpliedType(inferableType).tag == expectedType.tag) {
Copy link
Member

Choose a reason for hiding this comment

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

Is this correct? When creating the inferableTypes and expectedTypes lists, don't we need to add the original types(by doing the getImpliedType when creating the lists)?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was considering the same. But we seem to have worked with implied types even in the non-union case, so decided to do the same in the union case also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Compiler crashes with a dependently-typed function call
4 participants