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

Should Enum::Variant::<TyArgs> be disabled? #3794

Open
esdrubal opened this issue Jan 17, 2023 · 0 comments
Open

Should Enum::Variant::<TyArgs> be disabled? #3794

esdrubal opened this issue Jan 17, 2023 · 0 comments
Labels
compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen language feature Core language features visible to end users

Comments

@esdrubal
Copy link
Contributor

esdrubal commented Jan 17, 2023

We have the following comment in our codebase:

// TODO: This also bans `Enum::<TyArgs>::Variant` but there's no good reason to ban that.
// Instead, we should allow this but ban `Enum::Variant::<TyArgs>`, which Rust does allow,
// but shouldn't, because with GADTs, we could ostensibly have the equivalent of:
// ```haskell
// {-# LANGUAGE GADTs, RankNTypes #-}
// data Foo where Bar :: forall a. Show a => a -> Foo
// ```
// or to illustrate with Sway-ish syntax:
// ```rust
// enum Foo {
// Bar<A: Debug>: A, // Let's ignore memory representation, etc.
// }
// ```

Should we disable Enum::Variant::<TyArgs> and only accept Enum::<TyArgs>::Variant, or do we follow Rust behavior here also and accept both?

@esdrubal esdrubal added language feature Core language features visible to end users compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen labels Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen language feature Core language features visible to end users
Projects
None yet
Development

No branches or pull requests

1 participant