Skip to content
CCPEDIAby Unity Nodes
Discussions/App Development/Error: defined but not used: 'this'Forum ↗

Error: defined but not used: 'this'

App Development4 posts224 viewsLast activity Feb 2022
GA
gaborhOP
Feb 2022

I get the following error:

error: defined but not used: ‘this’

With a module very similar to this:

module Main.Excp where

import Main.ErrorCode
import DA.Exception

exception Excp
  with
    errorCode: ErrorCode
  where
    message "Excp Exception: " <> show errorCode

What does this mean?

CO
cocreature
Feb 2022

This comes from a warning that is not turned on by default, specifically -Wunused-matches (or a slightly different flag that also ends up enabling this one).

It’s a false positive here. this is in implicitly in scope in message (just like for templates) and you’re not using it so you get the warning. I’ll open an issue to fix that.

GA
gaborh
Feb 2022

What I have found is:
The following pragma is needed until upstream issue gets resolved:
https://github.com/digital-asset/daml/issues/11004

{-# OPTIONS -Wno-unused-matches #-}
CO
cocreature
Feb 2022

Oh good catch, I forgot we already had that issue.

← Back to Discussions