Rework built-in and punned names (#25174, #25179, #25180, #25182)
This patch rewrites part of the logic for dealing with built-in and punned names, making it more principled and fixing a few bugs. * Kill off filterCTuple. Its purpose was to improve pretty-printing of constraint tuples, and the appropriate place for this is namePun_maybe. * Remove unitTyCon, unboxedUnitTyCon, and soloTyCon from wiredInTyCons. Their inclusion in the list was a workaround for shoddy logic in lookupOrigNameCache. Now we treat tuples of all arities uniformly. * In isBuiltInOcc_maybe, only match on actual built-in syntax, e.g. "FUN" shouldn't be there (#25174). Also take ListTuplePuns into account (#25179). * When matching OccNames, use the ShortByteString directly to avoid potentially costly conversions to ByteString and String. * Introduce isInfiniteFamilyOrigName_maybe, a purpose-built helper for looking up tuples/sums in the OrigNameCache. This clears up the previously convoluted relation between the orig name cache and built-in syntax. * Reuse isKnownOrigName_maybe to eliminate the need for isPunOcc_maybe. * Classify MkSolo and MkSolo# as UserSyntax, thus fixing whole-module reexports (#25182). * Teach valid-hole-fits about tuples, unboxed tuples, and unboxed sums, up to a certain arity (#25180). * Drop the unnecessary special case for unary constraint tuples in the type checker (finish_tuple). It was a workaround for the lack of CSolo. * Update Notes and other comments, add tests.
Showing
- compiler/GHC/Builtin/Names.hs 16 additions, 27 deletionscompiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Types.hs 495 additions, 262 deletionscompiler/GHC/Builtin/Types.hs
- compiler/GHC/Builtin/Uniques.hs 15 additions, 2 deletionscompiler/GHC/Builtin/Uniques.hs
- compiler/GHC/Driver/Main.hs 2 additions, 3 deletionscompiler/GHC/Driver/Main.hs
- compiler/GHC/Parser/Errors/Ppr.hs 2 additions, 8 deletionscompiler/GHC/Parser/Errors/Ppr.hs
- compiler/GHC/Plugins.hs 2 additions, 1 deletioncompiler/GHC/Plugins.hs
- compiler/GHC/Rename/Env.hs 1 addition, 1 deletioncompiler/GHC/Rename/Env.hs
- compiler/GHC/Tc/Errors/Hole.hs 30 additions, 3 deletionscompiler/GHC/Tc/Errors/Hole.hs
- compiler/GHC/Tc/Errors/Ppr.hs 2 additions, 2 deletionscompiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Gen/HsType.hs 4 additions, 50 deletionscompiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Tc/Gen/Splice.hs 15 additions, 9 deletionscompiler/GHC/Tc/Gen/Splice.hs
- compiler/GHC/ThToHs.hs 149 additions, 63 deletionscompiler/GHC/ThToHs.hs
- compiler/GHC/Types/Name.hs 10 additions, 6 deletionscompiler/GHC/Types/Name.hs
- compiler/GHC/Types/Name/Cache.hs 67 additions, 43 deletionscompiler/GHC/Types/Name/Cache.hs
- compiler/GHC/Types/Name/Ppr.hs 4 additions, 3 deletionscompiler/GHC/Types/Name/Ppr.hs
- libraries/base/src/GHC/Base.hs 1 addition, 1 deletionlibraries/base/src/GHC/Base.hs
- libraries/base/src/GHC/Exts.hs 1 addition, 1 deletionlibraries/base/src/GHC/Exts.hs
- testsuite/tests/core-to-stg/T24124.stderr 1 addition, 1 deletiontestsuite/tests/core-to-stg/T24124.stderr
- testsuite/tests/ghc-api/T18522-dbg-ppr.hs 3 additions, 2 deletionstestsuite/tests/ghc-api/T18522-dbg-ppr.hs
- testsuite/tests/interface-stability/ghc-experimental-exports.stdout 3 additions, 2 deletions...tests/interface-stability/ghc-experimental-exports.stdout
Loading
Please register or sign in to comment