Skip to content
This repository has been archived by the owner on Jun 9, 2021. It is now read-only.

$*_ for import specs #50

Open
quasilyte opened this issue Dec 24, 2019 · 2 comments
Open

$*_ for import specs #50

quasilyte opened this issue Dec 24, 2019 · 2 comments

Comments

@quasilyte
Copy link
Contributor

It seems that $*_ can't be used inside import spec:

import ($*_; "something/of/interest"; $*_)

The parsing error is:

cannot parse expr: 1:1: expected statement, found 'import'

If this is expected behavior, this issue can be closed.

@mvdan
Copy link
Owner

mvdan commented Dec 24, 2019

This is very similar to #48. Dollar expressions just get converted to gogrep_N identifiers, so that's not a valid import spec there.

@quasilyte
Copy link
Contributor Author

quasilyte commented Jan 9, 2020

I think even if #32 becomes a preferred way to match something like this, it would be cool to have a way to match it via patterns as well.

To avoid another very similar issue, I'll add an additional case here:

type ($*_; $_ $x; $*_)

The type $_ $x pattern can't match type spec if it's inside ( ) group.
Needed to make quasilyte/go-ruleguard#43 more reliable.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants