[GHC] #14969: panic on incorrect syntax

#14969: panic on incorrect syntax -------------------------------------+------------------------------------- Reporter: johnleo | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.5 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- With a fresh build of 8.5: {{{ GHCi, version 8.5.20180323: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /Users/leo/.ghci Prelude> 3 _ 4 ghc-stage2: panic! (the 'impossible' happened) (GHC version 8.5.20180323 for x86_64-apple-darwin): ASSERT failed! 2 1 t_a4j6[tau:1] Maybe a_a4j7[tau:2] Call stack: CallStack (from HasCallStack): callStackDoc, called at compiler/utils/Outputable.hs:1157:37 in ghc:Outputable pprPanic, called at compiler/utils/Outputable.hs:1213:5 in ghc:Outputable assertPprPanic, called at compiler/typecheck/TcMType.hs:720:54 in ghc:TcMType }}} I believe this fails in earlier versions as well, but I haven't tested it. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14969 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14969: panic on incorrect syntax -------------------------------------+------------------------------------- Reporter: johnleo | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.5 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by sighingnow): This panic is caused by the bad `TcLevel` when checking the `TcLevel` invariants, maybe related to ticket:14884. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14969#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14969: panic on incorrect syntax -------------------------------------+------------------------------------- Reporter: johnleo | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.5 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): Does not happen on 8.4.1. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14969#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14969: panic on incorrect syntax -------------------------------------+------------------------------------- Reporter: johnleo | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.5 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): To be clear, in comment:2, do you mean that it doesn't build with a standard 8.4.1 bindist, or with 8.4.1 built from source with `ASSERT`ions enabled? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14969#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14969: panic on incorrect syntax -------------------------------------+------------------------------------- Reporter: johnleo | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.5 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * cc: pallm@… (added) Comment: I think this is a variant of #14884. The machinery that Mathias Gissurarson (cc'd) has implemented for reporting typed holes, does not set type-variable level numbers properly. In that context it doesn't matter much; but it's very unsatisfactory. I recently had a long conversation with Mathias about various improvements to the type-hole-reporting mechanism. So we can expect improvements here. Here is the [wiki:Holes main wiki page about typed holes] which summarises the state of play -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14969#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14969: panic on incorrect syntax
-------------------------------------+-------------------------------------
Reporter: johnleo | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.5
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Richard Eisenberg

#14969: panic on incorrect syntax -------------------------------------+------------------------------------- Reporter: johnleo | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.5 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | ghci/scripts/T14969 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by goldfire): * status: new => closed * testcase: => ghci/scripts/T14969 * resolution: => fixed Comment: I nabbed this one by accident. :) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14969#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14969: panic on incorrect syntax -------------------------------------+------------------------------------- Reporter: johnleo | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.5 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | ghci/scripts/T14969 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Tritlo): Yes, I've hit this recently during my work on improving the implementation of the suggestions, and now I've become more familiar with how to properly set the tcLevel. I'll submit the patch soon (hopefully), after I manage to iron out a few more kinks. Thanks for the nab goldfire, hopefully there won't be any more to nab :) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14969#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14969: panic on incorrect syntax -------------------------------------+------------------------------------- Reporter: johnleo | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.5 Resolution: fixed | Keywords: TypedHoles Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | ghci/scripts/T14969 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * keywords: => TypedHoles -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14969#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14969: panic on incorrect syntax -------------------------------------+------------------------------------- Reporter: johnleo | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.5 Resolution: fixed | Keywords: TypedHoles Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | ghci/scripts/T14969 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by johnleo): The latest behavior using 8.5.20180413 on my Mac is that if I type `3 _ 4` or `3 _` GHCI now hangs, which I do not consider an improvement over the panic. I have to type `^C` to break. If I type something like `_` or `_ 3` I get a `Found hole` message as expected. Reopening, but if it makes more sense to file a new bug instead I can do that. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14969#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14969: panic on incorrect syntax -------------------------------------+------------------------------------- Reporter: johnleo | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.5 Resolution: | Keywords: TypedHoles Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | ghci/scripts/T14969 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by johnleo): * status: closed => new * resolution: fixed => -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14969#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14969: Underconstrained typed holes are non-performant -------------------------------------+------------------------------------- Reporter: johnleo | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.5 Resolution: | Keywords: TypedHoles Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Compile-time | Test Case: performance bug | ghci/scripts/T14969 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * failure: None/Unknown => Compile-time performance bug Comment: Note that it doesn't loop infinitely, but rather takes a very long time to compute: {{{ $ time ghc/inplace/bin/ghc-stage2 -XFlexibleContexts -e "3 _ 4" <interactive>:0:1: error: • Could not deduce (Num t1) from the context: (Num t, Num (t2 -> t -> t3)) bound by the inferred type for ‘it’: forall t t2 t3. (Num t, Num (t2 -> t -> t3)) => t3 at <interactive>:0:1-5 The type variable ‘t1’ is ambiguous • In the ambiguity check for the inferred type for ‘it’ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes When checking the inferred type it :: forall t1 t2 t3. (Num t1, Num (t2 -> t1 -> t3)) => t3 real 0m32.219s user 0m32.176s sys 0m0.084s }}} In other words, this is the same problem observed in https://ghc.haskell.org/trac/ghc/ticket/10946#comment:9. This is good home for this particular bug. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14969#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14969: Underconstrained typed holes are non-performant -------------------------------------+------------------------------------- Reporter: johnleo | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.5 Resolution: | Keywords: TypedHoles Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Compile-time | Test Case: performance bug | ghci/scripts/T14969 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Tritlo): I've reworked the substitution suggestions a lot over the past few weeks, and I've updated the sorting to be based on sizes of matches rather than by subsumption (though sorting by subsumption is still available via a flag). I hope to submit the patch this weekend, after I've updated the documentation. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14969#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14969: Underconstrained typed holes are non-performant -------------------------------------+------------------------------------- Reporter: johnleo | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.5 Resolution: | Keywords: TypedHoles Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Compile-time | Test Case: performance bug | ghci/scripts/T14969 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by Tritlo): * status: new => patch Comment: A fix for this is included in https://phabricator.haskell.org/D4444, where we change the default sorting algorithm to one based on comparing sizes of types rather than subsumption, which is much faster and gives comparable results. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14969#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14969: Underconstrained typed holes are non-performant -------------------------------------+------------------------------------- Reporter: johnleo | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.5 Resolution: | Keywords: TypedHoles Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Compile-time | Test Case: performance bug | ghci/scripts/T14969 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4444 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * differential: => Phab:D4444 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14969#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14969: Underconstrained typed holes are non-performant -------------------------------------+------------------------------------- Reporter: johnleo | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.5 Resolution: | Keywords: TypedHoles Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Compile-time | Test Case: performance bug | ghci/scripts/T14969 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4444 Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): It would be good to get this done. e.g #13499 is another example of the typed-hole perf problem. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14969#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14969: Underconstrained typed holes are non-performant -------------------------------------+------------------------------------- Reporter: johnleo | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.5 Resolution: | Keywords: TypedHoles Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Compile-time | Test Case: performance bug | ghci/scripts/T14969 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4444 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Tritlo): Yes! I'll try to get the patch ready for inclusion this weekend. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14969#comment:16 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14969: Underconstrained typed holes are non-performant
-------------------------------------+-------------------------------------
Reporter: johnleo | Owner: (none)
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Compiler | Version: 8.5
Resolution: | Keywords: TypedHoles
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: Compile-time | Test Case:
performance bug | ghci/scripts/T14969
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D4444
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#14969: Underconstrained typed holes are non-performant -------------------------------------+------------------------------------- Reporter: johnleo | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.5 Resolution: fixed | Keywords: TypedHoles Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Compile-time | Test Case: performance bug | ghci/scripts/T14969 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4444 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed * milestone: => 8.6.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14969#comment:18 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC