Skip to content

TypeApplication on a TH-splice gets AST-clobbered #613

@infinity0

Description

@infinity0
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}

import           Language.Haskell.TH

symFQN :: Name -> Q Type
symFQN n = do
  loc <- location
  pure $ LitT $ StrTyLit $ loc_module loc ++ "." ++ nameBase n

staticKey :: Name -> Q Exp
staticKey name = [| sing @ $(symFQN name) |]

main = pure ()
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.10.1
$ ghc Test.hs
Loaded package environment from $PWD/.ghc.environment.x86_64-linux-8.10.1
[1 of 1] Compiling Main             ( Test.hs, Test.o, Test.dyn_o )
Linking Test ...
$ ormolu --version
ormolu 0.1.0.0 UNKNOWN UNKNOWN
using ghc-lib-parser 8.10.1.20200523
$ ormolu -d -minplace Test.hs
warnings:


parse result:
  comment stream:


AST of input and AST of formatted code differ.
  at Test.hs:12:21-41
Please, consider reporting the bug.

5

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions