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

Cannot assign empty map literal #1135

Open
lars-reimann opened this issue May 3, 2024 · 0 comments
Open

Cannot assign empty map literal #1135

lars-reimann opened this issue May 3, 2024 · 0 comments
Labels
bug 🪲 Something isn't working

Comments

@lars-reimann
Copy link
Member

lars-reimann commented May 3, 2024

Describe the bug

Cannot assign an empty map literal to a declaration of type Map. This is part of a larger issue that invariant type parameters are replaced by a fixed type.

It's OK to replace covariant type parameters by Nothing and contravariant type parameters by Any?.

To Reproduce

Check this code:

fun f(
    p: Map<String, Int> = {}
)

Expected behavior

The assignment should work. We could either try to infer a type from the context or remember a special type like Unbound that is compatible to everything.

Screenshots (optional)

No response

Additional Context (optional)

No response

@lars-reimann lars-reimann added the bug 🪲 Something isn't working label May 3, 2024
@lars-reimann lars-reimann added this to DSL May 3, 2024
@github-project-automation github-project-automation bot moved this to Backlog in DSL May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working
Projects
Status: Backlog
Development

No branches or pull requests

1 participant