[GHC] #7748: Runtime <<loop>> due to incorrect inferred type

#7748: Runtime <<loop>> due to incorrect inferred type ----------------------------------------+----------------------------------- Reporter: jbransen | Owner: Type: bug | Status: new Priority: normal | Component: Compiler (Type checker) Version: 7.6.2 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: GHC accepts invalid program | Blockedby: Blocking: | Related: ----------------------------------------+----------------------------------- There is a bug in the type checker of 7.6.1 and 7.6.2, which accepts an incorrect type resulting in <<loop>> at runtime. Furthermore, 7.6.2 even automatically infers this incorrect type. Hence, the attached code has the following behavior: - No explicit type: Code works in 7.6.1, loops in 7.6.2 - Correct explicit type: Code works fine in 7.6.1 and 7.6.2 - Incorrect explicit type: Code loops in 7.6.1 and 7.6.2 The incorrect type has a parameter that is too polymorphic, i.e. an "a" type is accepted while the function does a pattern match on the parameter from which it is clear that it should be a Maybe type. In 7.4.* versions this incorrect type is not accepted. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7748 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7748: Runtime <<loop>> due to incorrect inferred type ----------------------------------------+----------------------------------- Reporter: jbransen | Owner: Type: bug | Status: new Priority: normal | Component: Compiler (Type checker) Version: 7.6.2 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: GHC accepts invalid program | Blockedby: Blocking: | Related: ----------------------------------------+----------------------------------- Comment(by dreixel): The "incorrect type" is rejected by GHC HEAD with the error message: {{{ Couldn't match expected type ‛a’ with actual type ‛Maybe (Maybe (r -> ()))’ ‛a’ is a rigid type variable bound by the type signature for test :: a -> r -> () at Test.hs:7:9 Relevant bindings include test :: a -> r -> () (bound at Test.hs:8:1) zd :: a (bound at Test.hs:8:6) f :: r -> () (bound at Test.hs:9:8) g :: r -> () (bound at Test.hs:9:16) In the pattern: Nothing In a case alternative: Nothing -> const () In the expression: case zd of { Nothing -> const () Just Nothing -> const () Just (Just p) -> p } }}} The "correct type" is accepted, and the program runs and terminates. It is also the type inferred by HEAD. So, it seems like whatever it was, it has been fixed. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7748#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7748: Runtime <<loop>> due to incorrect inferred type -----------------------------------------------------------------------+---- Reporter: jbransen | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler (Type checker) | Version: 7.6.2 Resolution: fixed | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: GHC accepts invalid program | Difficulty: Unknown Testcase: typecheck/should_fail/T7748a, typecheck/should_run/T7748 | Blockedby: Blocking: | Related: -----------------------------------------------------------------------+---- Changes (by simonpj): * status: new => closed * difficulty: => Unknown * resolution: => fixed * testcase: => typecheck/should_fail/T7748a, typecheck/should_run/T7748 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7748#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7748: Runtime <<loop>> due to incorrect inferred type -----------------------------------------------------------------------+---- Reporter: jbransen | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler (Type checker) | Version: 7.6.2 Resolution: fixed | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: GHC accepts invalid program | Difficulty: Unknown Testcase: typecheck/should_fail/T7748a, typecheck/should_run/T7748 | Blockedby: Blocking: | Related: -----------------------------------------------------------------------+---- Comment(by maeder): I've attached a run of {{{ #!/bin/bash -x ghc --version svn up svn st -q svn up -r 17856 Proofs/AbstractState.hs cabal clean cabal install -f "-programatica -server -gtkglade -haskeline -tar -hexpat" which hets hets ../Hets-lib/Datatypes.hpf export PATH=/local/maeder/ghc-7.6/bin:$PATH ghc-pkg list cabal install -f "-programatica -server -gtkglade -haskeline -tar -hexpat" hets ../Hets-lib/Datatypes.hpf }}} where /local/maeder/ghc-7.6 contains a local installation of ghc-7.6.2.20130416 The <<loop>> only happens with ghc-7.6.2 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7748#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC