Skip to content

Redefinition of a linear variable generates name-shadowing warning

Summary

Linear variable redefinition generates the name-shadowing warning. The check is useful only for variables of multiplicity m.

Steps to reproduce

{-# LANGUAGE LinearTypes #-}
module R where

g :: Int %1 -> Int
g x =
  let
    g' :: Int %1 -> Int
    g' x = x
  in g' x
    This binding for ‘x’ shadows the existing binding
      bound at src/R.hs:5:3
  |
8 |     g' x = x
  |        ^

Expected behavior

The warning should not be issued, because the type checker eliminates issues related to name-shadowing.

Environment

  • GHC version used: 9.10.1

Optional:

  • Operating System: Linux
  • System Architecture: x86_64
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information