google / google/mtail

const patterns can't be used by themselves, need // prefix

Open
#191 0 comments 0 reactions 1 assignee Claimed by @jaqx0r View on GitHub
bug mtail-Language/VM
Dominant language
Go
Stars
4k
Forks
392
PR merge metrics
No merged PRs in 30d

Description

When using a const by itself as a match condition, then we get warnings about
the capture group names not existing.

```
const A /(?.*)/
A {
x[$a]++
}
```

reports that `$a` not defined in scope.

A workaround is to prefix A with a // to force it into a locally evaluated pattern, which is weird:

```
// + A {
x[$a]++
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.