Hannes Siebenhandl pushed to branch wip/hie-file-improvements at Glasgow Haskell Compiler / GHC

Commits:

3 changed files:

Changes:

  • testsuite/tests/hiefile/should_run/T25709.hs
    1
    +{-# LANGUAGE QuantifiedConstraints#-}
    
    2
    +{-# LANGUAGE UndecidableInstances #-}
    
    3
    +{-# LANGUAGE AllowAmbiguousTypes #-}
    
    4
    +module Main where
    
    5
    +
    
    6
    +import TestUtils
    
    7
    +import qualified Data.Map.Strict as M
    
    8
    +import qualified Data.Set as S
    
    9
    +import Data.Either
    
    10
    +import Data.Maybe
    
    11
    +import Data.Bifunctor (first)
    
    12
    +import GHC.Plugins (moduleNameString, nameStableString, nameOccName, occNameString, isDerivedOccName)
    
    13
    +import GHC.Iface.Ext.Types
    
    14
    +
    
    15
    +
    
    16
    +import Data.Typeable
    
    17
    +
    
    18
    +data Some c where
    
    19
    +    Some :: c a => a -> Some c
    
    20
    +
    
    21
    +extractSome :: (Typeable a, forall x. c x => Typeable x) => Some c -> Maybe a
    
    22
    +extractSome (Some a) = cast a
    
    23
    +
    
    24
    +f :: (forall x. Ord x => Eq [x]) => ()
    
    25
    +f = ()
    
    26
    +{-# NOINLINE f #-}
    
    27
    +
    
    28
    +g :: ()
    
    29
    +g = f
    
    30
    +
    
    31
    +useQC :: forall c a. (c a, forall x. c x => Show x) => a -> String
    
    32
    +useQC x = show x
    
    33
    +
    
    34
    +points :: [(Int,Int)]
    
    35
    +points = [(22,26),(29, 5), (32, 13)]
    
    36
    +
    
    37
    +main = do
    
    38
    +  (df, hf) <- readTestHie "T25709.hie"
    
    39
    +  let refmap = generateReferencesMap $ getAsts $ hie_asts hf
    
    40
    +  traverse (explainEv df hf refmap) points

  • testsuite/tests/hiefile/should_run/T25709.stdout
    1
    +==========================
    
    2
    +At point (22,26), we found:
    
    3
    +==========================
    
    4
    +
    
    5
    +│ $dTypeable at T25709.hs:22:14-19, of type: Typeable a
    
    6
    +│     is an evidence variable bound by a let, depending on: [$dTypeable]
    
    7
    +│           with scope: LocalScope T25709.hs:22:14-29
    
    8
    +
    
    9
    +│     Defined at <no location info>
    
    10
    +
    
    11
    +|
    
    12
    +`- ┌
    
    13
    +   │ $dTypeable at T25709.hs:22:1-29, of type: Typeable a
    
    14
    +   │     is an evidence variable bound by a HsWrapper
    
    15
    +   │           with scope: LocalScope T25709.hs:22:1-29
    
    16
    +   │           bound at: T25709.hs:22:1-29
    
    17
    +   │     Defined at <no location info>
    
    18
    +
    
    19
    +
    
    20
    +
    
    21
    +│ $dTypeable at T25709.hs:22:14-19, of type: Typeable a
    
    22
    +│     is an evidence variable bound by a let, depending on: [df, irred]
    
    23
    +│           with scope: LocalScope T25709.hs:22:14-29
    
    24
    +
    
    25
    +│     Defined at <no location info>
    
    26
    +
    
    27
    +|
    
    28
    ++- ┌
    
    29
    +|  │ df at T25709.hs:22:1-29, of type: forall x. c x => Typeable x
    
    30
    +|  │     is an evidence variable bound by a HsWrapper
    
    31
    +|  │           with scope: LocalScope T25709.hs:22:1-29
    
    32
    +|  │           bound at: T25709.hs:22:1-29
    
    33
    +|  │     Defined at <no location info>
    
    34
    +|  └
    
    35
    +|
    
    36
    +`- ┌
    
    37
    +   │ irred at T25709.hs:22:14-19, of type: c a
    
    38
    +   │     is an evidence variable bound by a let, depending on: [irred]
    
    39
    +   │           with scope: LocalScope T25709.hs:22:14-29
    
    40
    +
    
    41
    +   │     Defined at <no location info>
    
    42
    +
    
    43
    +   |
    
    44
    +   `- ┌
    
    45
    +      │ irred at T25709.hs:22:14-19, of type: c a
    
    46
    +      │     is an evidence variable bound by a pattern
    
    47
    +      │           with scope: LocalScope T25709.hs:22:14-29
    
    48
    +
    
    49
    +      │     Defined at <no location info>
    
    50
    +
    
    51
    +
    
    52
    +==========================
    
    53
    +At point (29,5), we found:
    
    54
    +==========================
    
    55
    +
    
    56
    +│ df at T25709.hs:1:1, of type: forall x. Ord x => Eq [x]
    
    57
    +│     is an evidence variable bound by a let, depending on: [$p1Ord,
    
    58
    +│                                                            $fEqList]
    
    59
    +│           with scope: ModuleScope
    
    60
    +
    
    61
    +│     Defined at <no location info>
    
    62
    +
    
    63
    +|
    
    64
    ++- ┌
    
    65
    +|  │ $p1Ord at T25709.hs:1:1, of type: forall a. Ord a => Eq a
    
    66
    +|  │     is a usage of an external evidence variable
    
    67
    +|  │     Defined in `GHC.Internal.Classes'
    
    68
    +|  └
    
    69
    +|
    
    70
    +`- ┌
    
    71
    +   │ $fEqList at T25709.hs:1:1, of type: forall a. Eq a => Eq [a]
    
    72
    +   │     is a usage of an external evidence variable
    
    73
    +   │     Defined in `GHC.Internal.Classes'
    
    74
    +
    
    75
    +
    
    76
    +==========================
    
    77
    +At point (32,13), we found:
    
    78
    +==========================
    
    79
    +
    
    80
    +│ $dShow at T25709.hs:32:1-16, of type: Show a
    
    81
    +│     is an evidence variable bound by a let, depending on: [df, irred]
    
    82
    +│           with scope: LocalScope T25709.hs:32:1-16
    
    83
    +│           bound at: T25709.hs:32:1-16
    
    84
    +│     Defined at <no location info>
    
    85
    +
    
    86
    +|
    
    87
    ++- ┌
    
    88
    +|  │ df at T25709.hs:32:1-16, of type: forall x. c x => Show x
    
    89
    +|  │     is an evidence variable bound by a HsWrapper
    
    90
    +|  │           with scope: LocalScope T25709.hs:32:1-16
    
    91
    +|  │           bound at: T25709.hs:32:1-16
    
    92
    +|  │     Defined at <no location info>
    
    93
    +|  └
    
    94
    +|
    
    95
    +`- ┌
    
    96
    +   │ irred at T25709.hs:32:1-16, of type: c a
    
    97
    +   │     is an evidence variable bound by a let, depending on: [irred]
    
    98
    +   │           with scope: LocalScope T25709.hs:32:1-16
    
    99
    +   │           bound at: T25709.hs:32:1-16
    
    100
    +   │     Defined at <no location info>
    
    101
    +
    
    102
    +   |
    
    103
    +   `- ┌
    
    104
    +      │ irred at T25709.hs:32:1-16, of type: c a
    
    105
    +      │     is an evidence variable bound by a HsWrapper
    
    106
    +      │           with scope: LocalScope T25709.hs:32:1-16
    
    107
    +      │           bound at: T25709.hs:32:1-16
    
    108
    +      │     Defined at <no location info>
    
    109
    +
    
    110
    +

  • testsuite/tests/hiefile/should_run/all.T
    ... ... @@ -8,4 +8,5 @@ test('HieVdq', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUti
    8 8
     test('T23540', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info'])
    
    9 9
     test('T23120', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info'])
    
    10 10
     test('T24544', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info'])
    
    11
    -test('HieGadtConSigs', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info'])
    \ No newline at end of file
    11
    +test('HieGadtConSigs', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info'])
    
    12
    +test('T25709', [extra_run_opts('"' + config.libdir + '"'), extra_files(['TestUtils.hs'])], compile_and_run, ['-package ghc -fwrite-ide-info'])