Simon Peyton Jones pushed to branch wip/T23162-spj at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • compiler/GHC/Tc/Solver/FunDeps.hs
    ... ... @@ -256,12 +256,12 @@ Consider T4254b:
    256 256
       From the ambiguity check on the type signature we get
    
    257 257
         [G] FD Int b
    
    258 258
         [W] FD Int beta
    
    259
    -  If we ineract that Wanted with /both/ the t0p-level instance, /and/ the
    
    259
    +  If we interact that Wanted with /both/ the top-level instance, /and/ the
    
    260 260
       local Given, we'll get
    
    261 261
           beta ~ Int   and     beta ~ b
    
    262 262
       respectively.  That would generate (b~Bool), which would fai.  I think
    
    263 263
       it doesn't matter which of the two we pick, but historically we have
    
    264
    -  picked teh local-fundeps firs.
    
    264
    +  picked the local-fundeps first.
    
    265 265
     
    
    266 266
     (DFL2) Try solving from top-level instances before fundeps.
    
    267 267
       From the definition `foo = op` we get
    

  • testsuite/tests/typecheck/should_compile/tc126.hs
    ... ... @@ -35,3 +35,50 @@ g2 = f (f (f [0::Int]))
    35 35
     -- The outer f repeats the exercise, so g2::Int
    
    36 36
     -- This is the definition that Hugs rejects
    
    37 37
     
    
    38
    +
    
    39
    +{-
    
    40
    +start iteration=0
    
    41
    +        [W] $dBug_aET {0} :: Bug (Int -> Int) a_aER[tau:1] r_aES[tau:1] (CDictCan)
    
    42
    +        [W] $dBug_aEW {0} :: Bug (Int -> Int) [r_aFd[tau:1]] a_aER[tau:1] (CDictCan)
    
    43
    +        [W] $dBug_aF0 {0} :: Bug (Int -> Int) [Int] [r_aFd[tau:1]] (CDictCan)}
    
    44
    +-->
    
    45
    +        [W] $dBug_aET {0} :: Bug (Int -> Int) a_aER[tau:1] r_aES[tau:1] (CDictCan)
    
    46
    +        [W] $dBug_aEW {0} :: Bug (Int -> Int) [r_aFd[tau:1]] a_aER[tau:1] (CDictCan)
    
    47
    +        [W] $dBug_aF0 {0} :: Bug (Int -> Int) Int r_aFd[tau:1] (CDictCan)}
    
    48
    +--> fds
    
    49
    +  a_aER := [r_aFf]
    
    50
    +  r_fD  := Int
    
    51
    +
    
    52
    +start iteration=1
    
    53
    +        [W] $dBug_aET {0} :: Bug (Int -> Int) [r_aFf[tau:1]] r_aES[tau:1] (CDictCan)
    
    54
    +        [W] $dBug_aEW {0} :: Bug (Int -> Int) [r_aFd[tau:1]] [r_aFf][tau:1]] (CDictCan)
    
    55
    +        [W] $dBug_aF0 {0} :: Bug (Int -> Int) Int Int (CDictCan)}
    
    56
    +--> (solve aF0, instance for aEW)
    
    57
    +        [W] $dBug_aET {0} :: Bug (Int -> Int) [r_aFf[tau:1]] r_aES[tau:1] (CDictCan)
    
    58
    +        [W] $dBug_aFg {1} :: Bug (Int -> Int) Int r_aFf[tau:1] (CDictCan)}
    
    59
    +--> fds
    
    60
    +  r_aES := [r_aFh]    -- fresh r_aFh
    
    61
    +  r_aFf := Int
    
    62
    +
    
    63
    +start iteration=2
    
    64
    +        [W] $dBug_aET {0} :: Bug (Int -> Int) [Int] [r_afH[tau:1]] (CDictCan)
    
    65
    +        [W] $dBug_aFg {1} :: Bug (Int -> Int) Int Int  (CDictCan)}
    
    66
    +--> (solve afG instance for aET
    
    67
    +        [W] $dBug_aFi {1} :: Bug (Int -> Int) Int r_aFh[tau:1] (CDictCan)}
    
    68
    +--> fds
    
    69
    +   f_afH := Int
    
    70
    +
    
    71
    +start iteration 3
    
    72
    +        [W] $dBug_aFi {1} :: Bug (Int -> Int) Int Int (CDictCan)}
    
    73
    +--> solve
    
    74
    +
    
    75
    +
    
    76
    +
    
    77
    +                   [W] $dBug_aCv {0} :: Bug (Int -> Int) [r_aCL[tau:1]] r_aCu[tau:1] (CDictCan)
    
    78
    +                   [W] $dBug_aEI {1} :: Bug (Int -> Int) Int            r_aCL[tau:1] (CDictCan)}
    
    79
    +-->
    
    80
    +  r_aCL := Int
    
    81
    +  r_aCu := [ r_new ]   -- r_aEJ
    
    82
    +
    
    83
    +  [W] Bug (Int -> Int) Int r_new
    
    84
    +-}