Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,326
    • Issues 4,326
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 390
    • Merge Requests 390
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #17060

Closed
Open
Opened Aug 14, 2019 by Robert Peszek@rpeszek

Compiler ignores Typeable constraint

Summary

Compiler allows passing types with no Typeable instance to functions declared with Typeable constraint.

Steps to reproduce

The following compiles (no pragmas needed)

import Data.Typeable 

brokenGhc :: Typeable a => a -> a 
brokenGhc = id  

tst = brokenGhc (Foo "bar") 

brokenGhc2 :: (Typeable a) => a -> String
brokenGhc2 = show . typeOf

tst2 = brokenGhc2 (Foo "Bar")
-- ghci> tst2
-- "Foo"

data Foo = Foo String

Possibly related to #10770?

Expected behavior

tst and tst2 should not compile. Note Foo has no instances!

Environment

  • GHC version used: Tested with ghc-8.6.5/lts-14.0, ghc-8.2.2/lts-12.22

Optional:

  • Operating System: Ubuntu 18.04 and Ubuntu 18.10

  • System Architecture:

Suggested Labels:

Typeable bug program incorrectly accepted

Edited Aug 14, 2019 by Robert Peszek
Assignee
Assign to
8.10.1
Milestone
8.10.1 (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#17060