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

[Task]: Handle duplicate typedesc creation for remaining case #43667

Open
rdulmina opened this issue Dec 2, 2024 · 0 comments
Open

[Task]: Handle duplicate typedesc creation for remaining case #43667

rdulmina opened this issue Dec 2, 2024 · 0 comments
Labels
Area/BIR Compiler BIR related issues #Compiler Area/Desugar Issue related Desugar and Code optimizer #Compiler Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Task userCategory/Compilation

Comments

@rdulmina
Copy link
Contributor

rdulmina commented Dec 2, 2024

Description

Duplicate typedesc creation for type definitions and in statement level is handled by #38844. How ever there are few cases left to be handled only for anonymous types. Please find the cases below. Record type works fine since it has a type definition created.

  1. function-signature := ( param-list ) return-type-descriptor (param list also contains typedesc)

  2. Expressions can contain anonymous type descriptors. Those are not handled at the global level.
    eg:
    int a = int a = let [int] a = [1] in a[0];
    boolean bool = someVar is [int];

  3. object-field in module class definition :=
    metadata [object-visibility-qual] [final]
    type-descriptor field-name [= field-initializer] ;

  4. listener-decl :=
    metadata
    [public] listener [type-descriptor] variable-name = expression ;

  5. service-decl :=
    metadata [isolated-qual]
    service [type-descriptor] [attach-point] on expression-list object-constructor-block [;]

  6. annotation-decl :=
    metadata
    [public] [const] annotation [type-descriptor] annot-tag

  7. For samples like below

     public type Identifier record {|
	    string name;
     |};
    
     table<Identifier> & readonly q = table [{name: "Jo"}];

The row type will be Immutable Identifier and there will be no intersection type definition created for that. Only the immutable record type is created. Because of that no typedesc created for row type intersection at Desugar. BIRGen will create duplicate type desc.

Describe your task(s)

No response

Related area

-> Compilation

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@rdulmina rdulmina added Type/Task Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. userCategory/Compilation labels Dec 2, 2024
@ballerina-bot ballerina-bot added the needTriage The issue has to be inspected and labeled manually label Dec 2, 2024
@rdulmina rdulmina added Area/Desugar Issue related Desugar and Code optimizer #Compiler Area/BIR Compiler BIR related issues #Compiler and removed needTriage The issue has to be inspected and labeled manually labels Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/BIR Compiler BIR related issues #Compiler Area/Desugar Issue related Desugar and Code optimizer #Compiler Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Task userCategory/Compilation
Projects
None yet
Development

No branches or pull requests

2 participants