6

When compiling supplied code for Plutus Pioneer Program, the haskell extension for VSCode IDE reports a compilation error. This prevents a lot of useful IDE functions from working, because the IDE doesn't analyze an uncompilable file. The code compiles correctly in ghci (cabal repl) and using command line "cabal build"

The error is related to the template Haskell code that is required to write Plutus validators. Error states that a name is not INLINABLE, but it is. I have verified that ghc and haskell-language-server are both using same Haskell compiler (8.10.4.20210212). Does anyone know how to eliminate the error while using VSCode?

related (unanswered) Stack Exchange question: related issue

VSCode screen showing reported error

VSCode screen showing code compiling without in ghc1

Error when running haskell-language-server from command line

source code here

3

I found a workaround that is sufficient to get my IDE usable.

**WORKAROUND: ** By comparing the cabal files for Plutus week10 (which compiles OK in IDE) with week07 (error), I discovered that adding the GHC argument -fplugin-opt PlutusTx.Plugin:defer-errors into the ".cabal" file suppressed the error and allowed IDE functions like code completion to work. With this insight, I discovered that this issue had been reported in Plutus Issue 3454 and this workaround described in a Plutus Pull Request.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.