grain-lang / grain

The Grain compiler toolchain and CLI. Home of the modern web staple. 🌾
https://grain-lang.org/
GNU Lesser General Public License v3.0
3.28k stars 115 forks source link

feat(compiler): Ignore compiler warnings #2142

Open alex-snezhko opened 3 months ago

alex-snezhko commented 3 months ago
match (true) {
  true => void
}
let a = [> 1, 2]
a[1.5]
# will warn
grain compile main.gr
# will not warn
grain compile main.gr --ignore-warnings=all
grain compile main.gr --ignore-warnings=partialMatch,arrayIndexNonInteger

Closes #163

ospencer commented 2 months ago

We discussed this on Discord and decided that for now, we don't want the command line flag. For what's needed for Silo, it just needs to be programmatically configurable, but ideally we'd allow disabling a warning using a comment.

alex-snezhko commented 2 months ago

@ospencer do we want comments or attributes for this?

ospencer commented 2 months ago

Attributes would be a little nicer, but we don't currently support attributes on arbitrary nodes, and that's actually kind of a hard problem. If you want to pair on trying to make that happen we can do that in another PR.