Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC

Commits:

5 changed files:

Changes:

  • compiler/GHC/Tc/Module.hs
    ... ... @@ -2367,8 +2367,9 @@ tcUserStmt (L loc (BodyStmt _ expr _ _))
    2367 2367
                             -- The two-step process avoids getting two errors: one from
    
    2368 2368
                             -- the expression itself, and one from the 'print it' part
    
    2369 2369
                             -- This two-step story is very clunky, alas
    
    2370
    -                  , do { _ <- checkNoErrs (tcGhciStmts [let_stmt])
    
    2370
    +                  , do { _ <- checkNoErrs (discardWarnings (tcGhciStmts [let_stmt]))
    
    2371 2371
                                     --- checkNoErrs defeats the error recovery of let-bindings
    
    2372
    +                                --- discardWarnings: warnings come from the second typecheck
    
    2372 2373
                            ; tcGhciStmts [let_stmt, print_it] } ]
    
    2373 2374
     
    
    2374 2375
                   -- Plans where we don't bind "it"
    

  • testsuite/tests/ghci/scripts/T26233.script
    1
    +:set -Wall
    
    2
    +truncate pi

  • testsuite/tests/ghci/scripts/T26233.stderr
    1
    +<interactive>:2:1: warning: [GHC-18042] [-Wtype-defaults (in -Wall)]
    
    2
    +    • Defaulting the type variable ‘a0’ to type ‘Double’ in the following constraints
    
    3
    +        (RealFrac a0)
    
    4
    +          arising from a use of ‘truncate’ at <interactive>:2:1-8
    
    5
    +        (Floating a0) arising from a use of ‘pi’ at <interactive>:2:10-11
    
    6
    +    • In the expression: truncate pi
    
    7
    +      In an equation for ‘it’: it = truncate pi
    
    8
    +
    
    9
    +<interactive>:2:1: warning: [GHC-18042] [-Wtype-defaults (in -Wall)]
    
    10
    +    • Defaulting the type variable ‘a0’ to type ‘Integer’ in the following constraints
    
    11
    +        (Show a0) arising from a use of ‘print’ at <interactive>:2:1-11
    
    12
    +        (Integral a0) arising from a use of ‘it’ at <interactive>:2:1-11
    
    13
    +    • In a stmt of an interactive GHCi command: print it
    
    14
    +

  • testsuite/tests/ghci/scripts/T26233.stdout
    1
    +3

  • testsuite/tests/ghci/scripts/all.T
    ... ... @@ -391,3 +391,4 @@ test('GhciPackageRename',
    391 391
          [extra_hc_opts("-hide-all-packages -package 'containers (Data.Map as Prelude)'")],
    
    392 392
          ghci_script,
    
    393 393
          ['GhciPackageRename.script'])
    
    394
    +test('T26233', normal, ghci_script, ['T26233.script'])