fix(haskell): prevent segfault due to anchorless queries (#5502)

This commit is contained in:
Marc Jakobi 2023-10-10 10:12:36 +02:00 committed by GitHub
parent 34e6ace726
commit 0eb1a0ad1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 36 deletions

View file

@ -162,26 +162,11 @@
;; Functions and variables
(signature name: (variable) @function)
((signature name: (variable) @variable)
(function
name: (variable) @_name
rhs: [
(exp_literal)
(exp_apply
(exp_name
[(constructor)
(variable)
]))
(quasiquote)
((exp_name) . (operator))
])
(#eq? @variable @_name))
((signature name: (variable) @variable)
(function
name: (variable) @_name
rhs: (exp_infix
[
. (function
name: (variable) @_name
rhs: [
(exp_literal)
(exp_apply
(exp_name
@ -190,26 +175,36 @@
]))
(quasiquote)
((exp_name) . (operator))
]))
])
(#eq? @variable @_name))
((signature name: (variable) @variable)
. (function
name: (variable) @_name
rhs: (exp_infix
[
(exp_literal)
(exp_apply
(exp_name
[(constructor)
(variable)
]))
(quasiquote)
((exp_name) . (operator))
]))
(#eq? @variable @_name))
((signature name: (variable) @function)
(function
name: (variable) @_name
patterns: (patterns))
. (function
name: (variable) @_name
patterns: (patterns))
(#eq? @function @_name))
(signature
name: (variable) @function
type: (fun))
((signature
name: (variable) @_name
type: (fun))
(function
name: (variable) @function)
(#eq? @function @_name))
;; For some reason, `(signature name: (variable) type: (fun))` doesn't work here
(signature (variable) @function . (fun))
(function name: (variable) @function)
(function
name: (variable) @variable
rhs: [
@ -222,6 +217,7 @@
(quasiquote)
((exp_name) . (operator))
])
(function
name: (variable) @variable
rhs: (exp_infix [

View file

@ -111,16 +111,13 @@ someInfix x = fromIntegral x `myAdd` floatVal
-- ^ @variable
-- ^ @variable
floatVal :: Double
-- ^ @variable
floatVal = 5.5
-- ^ @variable
-- ^ @float
intVal :: Int
-- ^ @variable
intVal = getInt 5
-- ^ @variable
boolVal :: Bool
-- ^ @variable
boolVal = bool False True $ 1 + 2 == 3
-- ^ @variable
isInt :: Either Double Int -> Bool
@ -171,12 +168,14 @@ someIOaction = do
-- ^ @function.call
intVal :: Int
-- ^ @variable
intVal = 5
-- ^ @variable
intFun :: Int -> Int
intFun = 5
-- ^ @function
mbInt :: Maybe Int
-- ^ @variable
mbInt = Just 5
-- ^ @variable