Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,830
    • Issues 4,830
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 447
    • Merge requests 447
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #16404

Closed
Open
Created Mar 07, 2019 by Simon Peyton Jones@simonpjDeveloper

Type error recovery crash

This program is derived from #16376 (closed):

{-# LANGUAGE TypeApplications #-}
module Bug where

h x = let f = id @Maybe
      in Just f

If you compile with -fdefer-type-errors -dcore-lint you'll get

*** Core Lint errors : in result of Desugar (before optimization) ***
<no location info>: warning:
    In the expression: f_arZ @ a_at1
    Out of scope: f_arZ :: forall a. a
                  [LclId]
*** Offending Program ***
Rec {
$trModule :: Module
[LclIdX]
$trModule = Module (TrNameS "main"#) (TrNameS "T16376"#)

h :: forall p a. p -> Maybe a
[LclIdX]
h = \ (@ p_asV) (@ a_at1) ->
      case typeError
             @ ('TupleRep '[])
             @ ((* -> *) ~# *)
             "T16376.hs:4:19: error:\n\
             \    \\226\\128\\162 Expecting one more argument to \\226\\128\\152Maybe\\226\\128\\153\n\
             \      Expected a type, but \\226\\128\\152Maybe\\226\\128\\153 has kind \\226\\128\\152* -> *\\226\\128\\153\n\
             \    \\226\\128\\162 In the type \\226\\128\\152Maybe\\226\\128\\153\n\
             \      In the expression: id @Maybe\n\
             \      In an equation for \\226\\128\\152f\\226\\128\\153: f = id @Maybe\n\
             \(deferred type error)"#
      of co_asZ
      { __DEFAULT ->
      letrec {
        h_at5 :: p_asV -> Maybe a_at1
        [LclId]
        h_at5 = \ (x_arY :: p_asV) -> Just @ a_at1 (f_arZ @ a_at1); } in
      h_at5
      }
end Rec }

Without Lint it just squeezes by, because that `case typeError of ..." discards the "..." since it is unreachable

Edited Mar 10, 2019 by Simon Peyton Jones
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking