Skip to content

`badOrigBinding` does outdated assumption

Summary

badOrigBinding assumes, that if RdrName isn't built-in, it comes from TH. This assumption is outdated since in commit 02279a9c as a part of Non-punning list and tuple syntax proposal were introduced punned names to lists (and will be introduced for tuples soon).

Steps to reproduce

This code

module T where

data []

producing this error

T.hs:3:1: error: [GHC-40027]
    Cannot redefine a Name retrieved by a Template Haskell quote: []
  |
3 | data []
  | ^^^^^^

Expected behavior

As we can't find out if List name comes from [] syntax or from a TH quote as ''List, I suggest to make single error for both cases like Illegal binding of an existing name: blah

Environment

  • GHC version used: master branch
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information