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

[Bug] Assigning empty arrays to a typed array #696

Open
3 tasks done
Luna-Klatzer opened this issue Sep 9, 2024 · 0 comments
Open
3 tasks done

[Bug] Assigning empty arrays to a typed array #696

Luna-Klatzer opened this issue Sep 9, 2024 · 0 comments
Assignees
Labels
bug Bug or issue in the language or API
Milestone

Comments

@Luna-Klatzer
Copy link
Member

Is there an existing issue for this?

  • I have searched the existing issues

I am following the documentation's guide

  • I have read the documentation

This issue exists in the latest version

  • I am using the latest version

Current Behavior

When creating a variable of type Array<T> you usually want to immediately assign it an empty array, which then can be modified and extended. This though does not work in the current version as an empty array is of type Array<any> and conflicts with any given variable:

var x: Array<nun> = []; // <- fails

Expected Behavior

The type checker should not throw a type error for an empty array assignment.

Steps To Reproduce

  1. Write an assignment expression which assigns an empty untyped array (Array<any>) to a variable with an array type other than Array<any>
  2. View type error in console

Environment

  • Kipper: 0.11.0
  • Environment: Node.js v18.20.4
  • Operating System: Arch Linux
@Luna-Klatzer Luna-Klatzer added the bug Bug or issue in the language or API label Sep 9, 2024
@Luna-Klatzer Luna-Klatzer added this to the v0.12.0 milestone Sep 9, 2024
@Luna-Klatzer Luna-Klatzer self-assigned this Sep 9, 2024
@Luna-Klatzer Luna-Klatzer modified the milestones: v0.12.0, v0.13.0 Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug or issue in the language or API
Projects
Development

No branches or pull requests

1 participant