1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +03:00
Commit Graph

169 Commits

Author SHA1 Message Date
Rob Rix
42708c333c
Fixtures, fixed. 2019-06-05 16:45:15 -04:00
joshvera
88c172c984 update tests 2019-02-20 15:45:52 -05:00
joshvera
016f6ea0ed Regenerate tests and eval variable declarations 2019-02-11 17:43:19 -05:00
joshvera
c9724d2720 Merge 'origin/master' into deploy-to-moda 2019-02-11 14:27:22 -05:00
Timothy Clem
8c0dd6d3b5 Just return the first line if function defs span multiple lines 2018-11-07 11:48:50 -08:00
Timothy Clem
343289f1c5 Merge remote-tracking branch 'origin/master' into docstrings-round2 2018-11-06 09:17:49 -08:00
Timothy Clem
e14f59b165 Re-generate test with addition of statements in python assignment 2018-11-05 13:12:50 -08:00
Timothy Clem
d0fc88efee Some python specs for tags 2018-11-05 12:33:23 -08:00
Patrick Thomson
7ea52dbfe3 Give Control.Matching API better ergonomics.
Given that @tclem and I have found the matcher API frustrating, I've
taken a stab at improving its ergonomics, and I've found some success
in separating composition of matchers from predicate-based narrowing
thereof.

The biggest change here is the elimination of the old `match`
combinator, which proved to be clumsy in that it complected narrowing
and composition. Top-down matching combinators are now written with
the `need` combinator and the `>>>` combinator, which is more readable
and more versatile. Here's a matcher that accepts functions with
Python docstrings:

```haskell
docstringMatcher :: ( Decl.Function :< fs
                    , [] :< fs
                    , Lit.TextElement :< fs
                    , term ~ Term (Sum fs) ann
                    ) => Matcher term term
docstringMatcher = target <*
               (need Decl.functionBody
                >>> narrow @[]
                >>> mhead
                >>> narrow @Lit.TextElement
                >>> ensure Lit.isTripleQuoted))
```

Pretty readable, right? Each step of the tree regular expression -
choosing function bodies, ensuring said bodies are lists, examining
the first element, and choosing only TextElements containing
triple-quoted strings - is made implicit. The old way would have
looked something like this:

```haskell
docstringMatcher = target <* match Decl.functionBody
                           $ narrow
                           $ matchM listToMaybe
                           $ target <* ensure Lit.isTripleQuoted
```
which is a good deal more disorganized and less flexible
in the quite-common case of applying functions during a
matching pass. Separating the act of composition from
function application is a big win here.

Further comments are inline.
2018-11-02 19:25:29 -04:00
Timothy Clem
018dc73af9 Python assignment: conditionally include annotation on functions 2018-11-02 12:39:38 -07:00
Timothy Clem
4ef4c63851 I changed functions in python that don't have annotations 2018-11-01 17:48:27 -07:00
Timothy Clem
a25e848c9f Fix assigning comments with multiple elif in Python 2018-09-18 10:43:18 -07:00
Timothy Clem
0931fc81f2 Add a simple roundtrip spec for python printing 2018-08-28 10:31:54 -07:00
Timothy Clem
68a93c6740 Python example code 2018-08-28 09:12:56 -07:00
Rick Winfrey
9e87ea9fc5 Update python fixtures
I think this got lost when merging in master
2018-08-13 12:48:47 -07:00
Rick Winfrey
62fb9635e0 Merge branch 'master' into update-haskell-tree-sitter 2018-08-13 11:36:10 -07:00
Rick Winfrey
686e1e6d09 Update fixtures 2018-08-10 14:33:39 -07:00
Rick Winfrey
bb23084035 Add future import statement test fixtures 2018-08-10 10:11:01 -07:00
Ayman Nadeem
29a49ca4fb regenerate failing python tests 2018-08-09 15:29:31 -04:00
Patrick Thomson
5c8cd4a109 test less-copacetic cases 2018-07-16 11:36:17 -04:00
Patrick Thomson
e05f419314 Abstract interpretation test. 2018-07-16 11:12:17 -04:00
Patrick Thomson
0ed48c7bbe Simplest test possible. 2018-07-16 11:07:40 -04:00
joshvera
d3c912784b Fix tests 2018-06-22 14:19:01 -04:00
Rob Rix
83ee082259 Regenerate all of the affected fixtures. 2018-06-06 10:35:47 -04:00
Patrick Thomson
dd4a939f21 merge fallout 2018-06-04 12:18:02 -04:00
Patrick Thomson
7c9b1ec17e Merge remote-tracking branch 'origin/master' into text-names 2018-06-04 11:46:54 -04:00
Timothy Clem
359031d777 s/Program/Statements in all of the tests 2018-06-01 11:44:03 -07:00
Patrick Thomson
d144087486 Merge remote-tracking branch 'origin/master' into text-names 2018-05-30 23:51:11 -04:00
Patrick Thomson
f541c42da8 Fix literals to store text internally. 2018-05-30 22:32:22 -04:00
Patrick Thomson
7ba832d566 Fix tests. 2018-05-30 18:29:54 -04:00
Timothy Clem
2d08451d87 Call [] Statements 2018-05-29 14:25:31 -07:00
Timothy Clem
1cbccd5557 Merge branch 'master' into python-relative-imports 2018-05-17 07:55:33 -07:00
Rob Rix
101798fd39 Update a bunch of fixtures. 2018-05-16 16:38:40 -04:00
Timothy Clem
62956f78d7 Print and actually return a string 2018-05-15 11:57:18 -07:00
Timothy Clem
27ce720904 Test out relative python imports 2018-05-15 11:26:16 -07:00
Patrick Thomson
6f63463269 Remove explicit Paren node from syntax trees.
As @robrix pointed out, adding explicit parenthesis nodes to our ASTs
bloats them with no added gain in expressivity. A pretty-printing
solution should use something analogous to `showsPrec` to ensure that
parentheses are printed properly.
2018-04-23 11:00:10 -04:00
Timothy Clem
ea0afa1747 Move corpus tests into their own dir 2018-04-18 13:33:17 -07:00
joshvera
d8c597e894 Merge remote-tracking branch 'origin/master' into typescript-graphs 2018-04-18 14:20:22 -04:00
Patrick Thomson
eb649777cd fix test cases 2018-04-17 18:42:02 -04:00
Timothy Clem
36e4bbecd9 Python fixture fixes 2018-04-16 16:52:54 -07:00
Patrick Thomson
d31e3eca88 fix ALL the test failures 2018-04-06 13:05:28 -04:00
Timothy Clem
4b9caec4c5 Fix up tests for Name wrapper 2018-04-04 08:59:13 -07:00
Timothy Clem
e9b6887268 Python import assignment changed - update fixtures 2018-04-02 15:18:23 -07:00
Patrick Thomson
178da2959e Implement multiple inheritance.
Python is the only language that we support that permits multiple
inheritance, which is probably good, since MI is generally considered
a sign of a poorly-designed object hierarchy. But there's no reason
not to support it. This algorithm is more simplistic than Python's
actual method-resolution lookup, but it's fine for now, and the
behavior for simple cases matches that of Python.
2018-03-22 15:54:21 -04:00
Patrick Thomson
bd939d2579 Fix Python method calls.
`identifier` in the Python assignment module was too eager to reduce a
nested Attribute into a dotted identifier. Removing it fixes method
calls, which now have a unit test.
2018-03-22 15:35:08 -04:00
Timothy Clem
aeb49477a1 Update integration fixtures for changes to assignment 2018-03-14 16:13:41 -07:00
Timothy Clem
201387957a Some additional Python examples 2018-03-09 14:02:06 -08:00
Timothy Clem
642a96a53f Bring back python imports with a little assignment fix 2018-03-08 13:18:13 -08:00
Timothy Clem
24a470ba7a FreeVariable Name as NonEmpty List 2018-03-08 09:34:09 -08:00
Timothy Clem
948162c88d Fix up tests again 2018-03-08 07:57:18 -08:00