Skip to content
CCPEDIAby Unity Nodes
App Development

Error: defined but not used: 'this'

4 posts241 viewsLast activity Feb 2022

  1. gaborhOP

    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?

  2. cocreature

    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.

  3. gaborh

    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 #-}
    
  4. cocreature

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