I copied the Plutus starter template, Plutus Platform starter project, and created a file, BasicPlutusTx.hs (and added it under exposed-modules in the .cabal file).

Then I started copying over all the code from the introductory tutorial, Using Plutus Tx.

When I added the code,

functions :: CompiledCode Integer
functions = $$(compile [|| myProgram ||])

it caused Visual Studio Code to complain, giving an error at the top of the file:

Program error: GHC Core to PLC plugin: E043:Error: Reference to a name which is not a local, a builtin, or an external INLINABLE function: Variable PlutusTx.Builtins.addInteger
            No unfolding
Context: Compiling expr: PlutusTx.Builtins.addInteger
Context: Compiling expr: PlutusTx.Builtins.addInteger
                           (PlutusTx.Builtins.addInteger 1 1)
Context: Compiling expr: PlutusTx.Builtins.addInteger
                           (PlutusTx.Builtins.addInteger 1 1) (BasicPlutusTx.plusOne 1)
Context: Compiling definition of: BasicPlutusTx.myProgram
Context: Compiling expr: BasicPlutusTx.myProgram
Context: Compiling expr at "main:BasicPlutusTx:(76,16)-(76,41)"compile

However, cabal build still works.

  • If I recall correctly, this error can happen during the first evaluation, but will be gone during subsequent ones. This is due to unfolding not be available from the start, but only once the module has been compiled for the first time.
    – angerman
    Jan 17, 2022 at 5:32
  • @angerman Am I running VSCode wrong? I'm starting nix-shell and then calling code from there
    – dspyz
    Jan 19, 2022 at 3:02
  • I see there's a flag in the project which enables the fix, but I don't see how or why VSCode would enable this flag
    – dspyz
    Jan 19, 2022 at 3:25
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Jan 22, 2022 at 12:00


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.