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

Some irrelevant errors may be reported when the are conflicting attributes across a module declaration and its module header #117

Open
fmease opened this issue Dec 23, 2021 · 0 comments
Labels
A-diagnostics Area: Diagnostics T-bug Type: Something isn't working as intended

Comments

@fmease
Copy link
Owner

fmease commented Dec 23, 2021

In the normal case (when attributes aren't spread across module declaration and module header), we first filter duplicate/conflicting attributes before potentially showing more errors about the (first) attribute. Consider the expression @Int @Int @Nat 0, the output is:

error[E014]: attributes `Int` and `Nat` are mutually exclusive
 --> /home/fmease/programming/main_projects/lushui/y.lushui:1:13
  |
1 | main: Nat = @Int @Int @Nat 0
  |             ^^^^ conflicting attribute
  |
 --> /home/fmease/programming/main_projects/lushui/y.lushui:1:23
  |
1 | main: Nat = @Int @Int @Nat 0
  |                       ^^^^ conflicting attribute
  |

error[E006]: multiple `Int` attributes
 --> /home/fmease/programming/main_projects/lushui/y.lushui:1:13
  |
1 | main: Nat = @Int @Int @Nat 0
  |             ^^^^ duplicate or conflicting attribute
  |
 --> /home/fmease/programming/main_projects/lushui/y.lushui:1:18
  |
1 | main: Nat = @Int @Int @Nat 0
  |                  ^^^^ duplicate or conflicting attribute
  |

But for the anormal case, e.g:

@doc-attributes
module a of
    @doc-attributes
    module

It's:

error[E038]: attribute `doc-attributes` is an internal feature
 --> /home/fmease/programming/main_projects/lushui/rr.lushui:1:1
  |
1 | @doc-attributes
  | ^^^^^^^^^^^^^^^
  |

error[E006]: multiple `doc-attributes` attributes
 --> /home/fmease/programming/main_projects/lushui/rr.lushui:1:1
  |
1 | @doc-attributes
  | ^^^^^^^^^^^^^^^ duplicate or conflicting attribute
  |
 --> /home/fmease/programming/main_projects/lushui/rr.lushui:3:5
  |
3 |     @doc-attributes
  |     ^^^^^^^^^^^^^^^ duplicate or conflicting attribute
  |

error[E038]: attribute `doc-attributes` is an internal feature
 --> /home/fmease/programming/main_projects/lushui/rr.lushui:3:5
  |
3 |     @doc-attributes
  |     ^^^^^^^^^^^^^^^
  |

The error about the attribute being internal should only show up once.

See:

// @Bug this sequence may lead to some unnecessary diagnostics being emitted
// since the "synergy check" (which filters duplicate attribute) is run too late
let module_header_attributes = self
.lower_attributes(&declaration.attributes, &declaration)
.unwrap(&mut health);
attributes.0.extend(module_header_attributes.0);
attributes =
self.check_attribute_synergy(attributes).unwrap(&mut health);

@fmease fmease added T-bug Type: Something isn't working as intended A-diagnostics Area: Diagnostics labels Dec 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Diagnostics T-bug Type: Something isn't working as intended
Projects
None yet
Development

No branches or pull requests

1 participant