apply-refact icon indicating copy to clipboard operation
apply-refact copied to clipboard

Failure on applying refactors to cpp file

Open joyfulmantis opened this issue 1 year ago • 0 comments

I am getting failures to apply refactoring via hls and hlint --refactor with the latest version of apply-refact and ghc 9.2.7 on hls-hlint-plugin's plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs because of CPP.

The relevant logs are

plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs:105:0: error:
     錯誤:missing binary operator before token "("
      105 | #if MIN_GHC_API_VERSION(9,2,0)
          | 
    |
105 | #if MIN_GHC_API_VERSION(9,2,0)
    | ^

plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs:143:0: error:
     錯誤:missing binary operator before token "("
      143 | #if MIN_VERSION_apply_refact(0,12,0)
          | 
    |
143 | #if MIN_VERSION_apply_refact(0,12,0)
    | ^

plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs:183:0: error:
     錯誤:missing binary operator before token "("
      183 | #if MIN_GHC_API_VERSION(9,4,0)
          | 
    |
183 | #if MIN_GHC_API_VERSION(9,4,0)
    | ^

plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs:686:0: error:
     錯誤:missing binary operator before token "("
      686 | #if MIN_VERSION_apply_refact(0,12,0)
          | 
    |
686 | #if MIN_VERSION_apply_refact(0,12,0)
    | ^
refactor: panic! (the 'impossible' happened)
  (GHC version 9.2.7:
	`gcc' failed in phase `C pre-processor'. (Exit code: 1)
CallStack (from HasCallStack):
  error, called at src/Language/Haskell/GHC/ExactPrint/Preprocess.hs:222:17 in ghc-exactprint-1.5.0-c9ae01b987437b6e946b3b447b2150e3db4a0cbdded29587a2e9ab4b1d171e06:Language.Haskell.GHC.ExactPrint.Preprocess

Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug

joyfulmantis avatar Jun 26 '23 11:06 joyfulmantis