9.15.20260113 and 9.14.1: linting error "From-type of Cast differs from type of enclosed expression"
## Summary
This is the linting error part of the rambling #26713. It's reproduced with today's HEAD built with `hadrian/build -j5 --flavour=perf+ipe` and GHC 9.14.1 built in the same way (the `ipe` bit is probably crucial).
## Steps to reproduce
```
git clone git@github.com:Mikolaj/horde-ad.git
cd horde-ad
git checkout late-specialise
cabal update
cabal build --constraint=ghc-typelits-natnormalise==0.9.1 --allow-newer -w /home/mikolaj/r/ghc.15208/ghc/_build/stage1/bin/ghc --ghc-options='-finfo-table-map' --ghc-options="-dcore-lint -dstg-lint -dcmm-lint -dtag-inference-checks"
```
This results (after a long time) in
```
[...]
[16 of 17] Compiling Data.Array.Nested.Ranked ( src/Data/Array/Nested/Ranked.hs, /home/mikolaj/r/repros/late-specialise2/horde-ad/dist-newstyle/build/x86_64-linux/ghc-9.15.20260113/ox-arrays-0.1.0.0/build/Data/Array/Nested/Ranked.o, /home/mikolaj/r/repros/late-specialise2/horde-ad/dist-newstyle/build/x86_64-linux/ghc-9.15.20260113/ox-arrays-0.1.0.0/build/Data/Array/Nested/Ranked.dyn_o ) [Flags changed]
*** Core Lint errors : in result of Simplifier ***
src/Data/Array/Nested/Ranked.hs:106:1: warning:
From-type of Cast differs from type of enclosed expression
From-type: Ranked n_a2ywr (Primitive a_a2yws)
Type of enclosed expression: Mixed
(Replicate n_a2ywr 'Nothing) (Primitive a_a2yws)
Actual enclosed expression: (case unsafeEqualityProof
@(*)
@(ZonkAny 1 :~: ZonkAny 1)
@(('Nothing : Replicate n_a2ywr 'Nothing)
:~: Replicate (n_a2ywr + 1) 'Nothing)
of
{ UnsafeRefl co_icMl ->
(src<src/Data/Array/Nested/Ranked.hs:372:53-55>
[...]
```
The repro is somewhat minimized, but very far from minimal. It has `-fpolymorphic-specialisation` disabled, because it's not needed for the reproduction.
## Expected behavior
No linter errors.
## Environment
* GHC version used: 9.15.20260113 and 9.14.1
Optional:
* Operating System: Ubuntu
* System Architecture: amd64
issue