getgrit / gritql

GritQL is a query language for searching, linting, and modifying code.
https://docs.grit.io/
MIT License
3.09k stars 72 forks source link

Can't match type predicates in Python #424

Open morgante opened 3 months ago

morgante commented 3 months ago

The $type condition doesn't work here.

engine marzano(0.1)
language python

`def matching_method($_) -> $type:
  $body` where {
    $type <: `List`
  }
morgante commented 3 months ago

Note this also doesn't work:

type() as $t where {
    $t <: `List`
}

Easy enough to work around though: Note this also doesn't work:

type() as $t where {
    $t <: contains `List`
}