Skip to content

tcExpr: Push expected types for untyped TH splices inwards

Ryan Scott requested to merge wip/T23796 into master

In !10911 (closed), I deleted a tcExpr case for HsUntypedSplice in favor of a much simpler case that simply delegates to tcApp. Although this passed the test suite at the time, this was actually an error, as the previous tcExpr case was critically pushing the expected type inwards. This actually matters for programs like the one in #23796 (closed), which GHC would not accept with type inference alone—we need full-blown type checking to accept these.

I have added back the previous tcExpr case for HsUntypedSplice and now explain why we have two different HsUntypedSplice cases (one in tcExpr and another in splitHsApps) in Note [Looking through Template Haskell splices in splitHsApps] in GHC.Tc.Gen.Head.

Fixes #23796 (closed).

Merge request reports