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

Merged contraints lead to invalid type #10446

Open
frabbit opened this issue Oct 22, 2021 · 5 comments
Open

Merged contraints lead to invalid type #10446

frabbit opened this issue Oct 22, 2021 · 5 comments
Labels
Milestone

Comments

@frabbit
Copy link
Member

frabbit commented Oct 22, 2021

class Test {
 static function main() {
   var x: { foo: Int, bar: Int, ohno: Int } = merge({ foo: 1}, { bar: 2});
 }
 
 static function merge<A:{}, B:{}, C:A & B>(a:A, b:B):C {
  return null;
 }
}
@frabbit
Copy link
Member Author

frabbit commented Oct 22, 2021

see: #9554 (comment)

@frabbit
Copy link
Member Author

frabbit commented Oct 23, 2021

this is not really a bug, but it shows that this technique is not a replacement for returning A & B.

@Simn
Copy link
Member

Simn commented Oct 27, 2021

I suppose we really do need TIntersect or something to that extent...

@frabbit
Copy link
Member Author

frabbit commented Oct 27, 2021

Ah, i just realized that & is just AExtend for AnonStatus, right?

@Simn
Copy link
Member

Simn commented Oct 27, 2021

Yes. Originally I thought that there should be a way to directly handle & when translating from syntax to typed expressions, but this falls apart when type parameters get involved (and probably in other situations as well).

@RealyUniqueName RealyUniqueName added this to the Bugs milestone Oct 31, 2021
@Simn Simn modified the milestones: Bugs, Later Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants