You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Duplicate enum/error variant names are accepted silently (enum E: A, A compiles) #1344
A type declaration may list the same variant name twice and nothing reports it. Found while implementing D57 (§10.9 combined error E from A = form), whose own wrapper-vs-written collision is now an error. The general duplicate is still silent.
Repro (seed and stage1 of branch error-from-with-variants):
enum E:
A
A
fn main:
let e = E.A
match e:
.A => print("a")
with run prints a, rc 0. error E = | A | A passes with check the same way. Also error E from DbError, DbError generates two Db wrappers.
Expected: a compile-time error naming the variant and the declaration. E.A has two meanings and the compiler picks one without saying so. The spec has no sentence about duplicate variant names, so the diagnostic wording is Eric's call. A duplicate is never meaningful, so this looks like a missing check, not a new rule.
Workaround: none needed. No known program depends on it.
Activity