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

25899 Commits

Author SHA1 Message Date
Patrick Thomson
d3db754004 weirdness in tests 2018-10-16 23:04:39 -04:00
Patrick Thomson
d56badfb29 Use upstream Resource effect. 2018-10-16 20:11:38 -04:00
Rob Rix
c9e6912068 Port most of the system over to higher-order-effects. 2018-10-16 18:48:08 -04:00
Ayman Nadeem
f0dcd1d2fc attempt to make this less manual 2018-10-16 18:01:28 -04:00
Timothy Clem
602432359b Merge remote-tracking branch 'origin/bracket-effect' into quiet-parsing 2018-10-16 14:57:14 -07:00
Patrick Thomson
ebda4bfaa1 Merge branch 'master' into bracket-effect 2018-10-16 17:52:30 -04:00
Patrick Thomson
a9ab40b7a5 Merge pull request #2197 from github/port-rewriting-examples
Port rewriting examples to the Rewrite DSL.
2018-10-16 17:46:02 -04:00
Patrick Thomson
1de1f0b5c1 try catching ParserTimedOut exceptions in parse-examples 2018-10-16 17:39:36 -04:00
Patrick Thomson
fb1806f3e9 whoops 2018-10-16 17:18:59 -04:00
Patrick Thomson
37522ddc35 lints 2018-10-16 17:15:36 -04:00
Patrick Thomson
1dfb4981cc warnings 2018-10-16 17:10:34 -04:00
Patrick Thomson
75bf696e47 Fix crash/race associated with bracket (#2207)
The bracket that I wrote inside effects does not properly handle
asynchronous exceptions, as it has no way to call the mask function.
As such, because the asynchronous exception is rethrown by both
`bracket` and `wait`, the exception handler will trigger twice. This
is what is causing the crash: `bracket` is passing the TSParser we
create in parseToAST to ts_parser_delete twice.

The best thing to do here is to create the new `Resource` effect,
which is interpreted down to `Control.Exception.bracket`, which has
the correct asynchronous-masking behavior, unlike the `bracket` in
`Control.Monad.Effect.Exception`, which I propose to remove in a patch
to `effects`.

This also bumps haskell-tree-sitter so that the
`ts_node_copy_child_nodes` function is considered `interruptible`.

To test:

1. Download [this file](https://gist.ghe.io/tclem/c2ffe3d20b248fdac59588aa98f168ae)
2. Run `TREE_SITTER_PARSE_TIMEOUT=1000 stack exec semantic -- --log-level=debug parse lexer.rb`

Before applying this patch, you will see a crash associated with a
double-free; afterwards, it should time out normally.
2018-10-16 17:05:29 -04:00
Ayman Nadeem
f9a3966a3c github universe results 2018-10-16 15:55:24 -04:00
Ayman Nadeem
2cb9b43ad5 entitlements results 2018-10-16 15:55:02 -04:00
Ayman Nadeem
66c397bd73 airflow results 2018-10-16 15:54:50 -04:00
Timothy Clem
0d762fba86 Include blob language in output too 2018-10-16 11:40:26 -07:00
Timothy Clem
4fc7bb59ae No need for double async (timeout already does this) 2018-10-16 11:28:53 -07:00
Patrick Thomson
5e52bede0a Fix the test suite. 2018-10-15 12:47:18 -04:00
Patrick Thomson
b7364f6df7 Merge remote-tracking branch 'origin/master' into port-rewriting-examples 2018-10-15 11:22:06 -04:00
Rob Rix
800c459bb0 Bump higher-order-effects for catchIO/bracket. 2018-10-14 22:16:07 -04:00
Patrick Thomson
14b4ed0bc7 Merge pull request #2204 from github/declaration-matching-improvement
Refactor: remove duplicate code in Analysis.Declaration
2018-10-12 20:22:34 -04:00
Rob Rix
a66788c682 Only re-export Generic/Generic1. 2018-10-12 17:54:57 -04:00
Timothy Clem
7663c46d79 New cli switch for quiet parsing with timing stats 2018-10-12 12:47:11 -07:00
Rob Rix
56dabab68f Bump higher-order-effects for hmap. 2018-10-12 14:46:00 -04:00
Rob Rix
0db8091c5e Bump higher-order-effects. 2018-10-12 14:22:50 -04:00
Rob Rix
298d861a20 Add a dependency on higher-order-effects. 2018-10-12 14:08:49 -04:00
Rob Rix
6fb6fd3d4e Add higher-order-effects. 2018-10-12 12:37:08 -04:00
Timothy Clem
c04d165a2b Merge branch 'master' into declaration-matching-improvement 2018-10-10 15:22:20 -07:00
Patrick Thomson
deb0956a8e remove annoying duplication 2018-10-10 12:49:25 -04:00
Patrick Thomson
8c19724cbe Merge branch 'port-rewriting-examples' of github.com:github/semantic into port-rewriting-examples 2018-10-10 12:37:37 -04:00
Patrick Thomson
ecb3d0cec3 Merge branch 'master' into port-rewriting-examples 2018-10-10 12:20:33 -04:00
Patrick Thomson
ea66d5323a Merge pull request #2203 from github/lts-upgrade-12.12
Upgrade to LTS 12.12.
2018-10-10 12:18:55 -04:00
Patrick Thomson
8549d70b77 Refactor: remove duplicate code in Analysis.Declaration
The family of functions that extracted a meaningful "identifier" for a
declaration contained a large amount of duplication, owing to
type-specific pattern-matching. Encapsulating this pattern-matching in
a Rule means we can go from six functions to one.
2018-10-10 12:17:10 -04:00
Patrick Thomson
c4561184ff Merge branch 'master' into lts-upgrade-12.12 2018-10-09 16:31:05 -04:00
Patrick Thomson
156f3f6dbc fix ansi-terminal 2018-10-09 15:38:52 -04:00
Timothy Clem
ad3ceb7ab3 Merge pull request #2198 from github/pair-down-symbols-output
Change up what Declarations we identify
2018-10-09 09:28:01 -07:00
Patrick Thomson
0ae629142a License revitalization. 2018-10-09 11:32:42 -04:00
Rob Rix
6ac9b657f0 Merge branch 'master' into pair-down-symbols-output 2018-10-09 10:45:03 -04:00
Patrick Thomson
989d38f27d Update to LTS 12.12.
The major bumps we get here are `algebraic-graphs` v0.2, which
contains a number of speed improvements, and the removal of the
`foundation` as a dependency.
2018-10-09 01:06:55 -04:00
Timothy Clem
ac70c565cc Change up what Declarations we identify 2018-10-05 09:54:57 -07:00
Patrick Thomson
5c3a65338a debug utility 2018-10-05 11:50:54 -04:00
Patrick Thomson
53a7f19d90 fix lints 2018-10-05 11:23:42 -04:00
Patrick Thomson
845d5892de Remove otiose imports. 2018-10-05 11:08:14 -04:00
Patrick Thomson
d382baabc5 Merge remote-tracking branch 'origin/master' into port-rewriting-examples 2018-10-05 11:06:13 -04:00
Timothy Clem
8a5e152790 Merge pull request #2196 from github/fix-pretty-range-instance
Fix Range's Show instance to assuage the pretty-printer.
2018-10-04 13:36:22 -07:00
Patrick Thomson
d9c9e6838e Merge branch 'master' into fix-pretty-range-instance 2018-10-04 15:57:54 -04:00
Patrick Thomson
932a613cf4 Merge pull request #2195 from github/ghci-slowness
Prevent slowdowns when pretty-printing in ghci.
2018-10-04 15:57:42 -04:00
Patrick Thomson
7746f7f006 Fix Range's Show instance to assuage the pretty-printer.
We use the `pretty-show` for pretty-printing Haskell values. This is a
convenient package in that it provides acceptably-good output without
having to define any extra instances of some `Pretty` class, and
we get nice colored output with `hscolour`.

It's not all skateboards and firecrackers, though. `pretty-show` uses
a predefined parser targeting the `Show` idioms in Haskell, and it
doesn't always do the thing we mean. For example, in #2192 we changed
the `Show` instance of `Range` to be a little more concise: a value of
shape `Range n m` is now printed as `[ n - m ]`. However, the
`pretty-show` parser sees that dash as Haskell's negate operator,
which is wrong, and leads to confused output from `ppShow` versus
`show`: the former prints out `[ n (-m) ]`, which is wrong.

There are three solutions we could pursue here, in increasing order of
practicality:

1. Dispense with `Show` entirely. There's an argument that we should
   never write our own `Show` instances, as this ensures that
   `read . show` is equivalent to `id`. If we want to examine values in
   the REPL, we should be using a `Pretty` typeclass from some
   library, and our `-interactive-print` function should operate on
   `Pretty` values rather than `Show`. This would mean we could elide
   a lot of generated `Show` instances, which is nice.
2. Keep our `Show` instances around, but move any custom
   instances to a `Pretty` class, and use a function that engages that
   class for our `-interactive-print` function.
3. Change the output of this `Show` instance to use something other
   than `-` for its separator.

Option 1 is the most principled, but also would require a lot of
legwork (though it might save us some compile time). Option 2 would be
more tolerable if we had `-XDerivingVia` or some easy way to use
`Show` as a `Pretty` instance. But both are unsatisfactory in light of
option 3, so I've changed the `-` to a `..`, which avoids all
lexer-related confusion.
2018-10-04 14:49:39 -04:00
Patrick Thomson
d56377aea9 Prevent slowdowns when pretty-printing in ghci.
Right now, when opening a shell with `script/ghci`, you can encounter
a tremendous slowdown by turning on pretty-printing (with `pretty`)
then printing any value (`[0..3]` should work).

This stems from the fact that our `.ghci` specifies the `prettyShow`
function, defined in Semantic.Util, as its `-interactive-print`
function. While this is a good choice of a pretty-printer, the fact
that it is in Util, a file which imports many modules and uses fancy
types, is not good: pretty-printing cannot begin until Util is
recompiled and linked in. This explains why benchmarking this slowdown
revealed nothing but `dlsym` calls: we thought it was due to linking
in the tree-sitter libraries, but it was actually waiting for Util to
compile and link in.

The fix is simple: define `prettyShow` in another module. This should
provide significant speedups to our developer workflow.
2018-10-04 14:38:36 -04:00
Patrick Thomson
2c28df6135 fallout from the Record-ectomy 2018-10-04 11:43:25 -04:00