Fix several oversights in hsExprType
Ticket: #26910 (closed)
This MR fixes several oversights in GHC.Hs.Syn.Type.hsExprType:
- The
RecordConcase was returning the type of the constructor, instead of the constructor application. This is fixed by usingsplitFunTys. - The
ExplicitTuplecase failed to take into account tuple sections, and was also incorrectly handling 1-tuples (e.g.Solo) which can be constructed using Template Haskell. - The
NegAppcase was returning the type of the negation operator, again failing to apply it to the argument. Fixed by usingfunResultTy. - The
HsProccase was computing the result type of the arrow proc block, without taking into account the argument type. Fix that by adding a new field toCmdTopTcthat stores the arrow type, so that we can construct the correct result typearr a bforproc (pat :: a) -> (cmd :: b). - The
ArithSeqandNegAppcases were failing to take into account the resultHsWrapper, which could e.g. silently drop casts. This is fixed by introducingsyntaxExpr_wrappedFunResTywhich, on top of taking the result type, applies the resultHsWrapper.
These fixes are validated by the new GHC API test T26910.