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

Generic constraints can be bypassed using proc default initialization #1428

Open
alaviss opened this issue Aug 21, 2024 · 0 comments
Open

Generic constraints can be bypassed using proc default initialization #1428

alaviss opened this issue Aug 21, 2024 · 0 comments
Labels
bug Something isn't working compiler/sem Related to semantic-analysis system of the compiler

Comments

@alaviss
Copy link
Contributor

alaviss commented Aug 21, 2024

Example

type
  O[T: Ordinal] = object
    x: T

proc invalid[T]: O[T] = discard

let x = invalid[string]()
echo typeof(x)

Actual Output

O[system.string]

Expected Output

This should not compile

@alaviss alaviss added bug Something isn't working compiler/sem Related to semantic-analysis system of the compiler labels Aug 21, 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 compiler/sem Related to semantic-analysis system of the compiler
Projects
None yet
Development

No branches or pull requests

1 participant