Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • C curry-frontend
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 71
    • Issues 71
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 3
    • Merge requests 3
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • curry
  • curry-frontend
  • Merge requests
  • !54

Implement warning for shadowed imported names (-Wimport-name-shadowing)

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Fredrik Wieczerkowski requested to merge import-name-shadowing into master Mar 03, 2022
  • Overview 1
  • Commits 7
  • Pipelines 0
  • Changes 5

Fixes #133 (closed)

Consider the module:

import Data.List (last)

f :: a -> a
f failed = failed

g :: a -> a
g f = f

h :: a -> a
h last = last

local :: a -> a
local x = let y = x in let x = y in x

Currently we get:

src/Shadow.curry:9:3 Warning:
    Shadowing symbol `f', bound at: src/Shadow.curry, line 6.1
   | 
 9 | g f = f
   |   ^

src/Shadow.curry:15:28 Warning:
    Shadowing symbol `x', bound at: src/Shadow.curry, line 15.7
    | 
 15 | local x = let y = x in let x = y in x
    |

With -Wimport-name-shadowing as implemented in this branch (or -Wall) we now additionally get:

src/Shadow.curry:6:3-6:8 Warning:
    Shadowing symbol `failed', bound at: /Users/fredrik/git/kics2/lib/.curry/Prelude.icurry, line 227.1
   | 
 6 | f failed = failed
   |   ^^^^^^

src/Shadow.curry:12:3-12:6 Warning:
    Shadowing symbol `last', bound at: /Users/fredrik/git/kics2/lib/.curry/Data/List.icurry, line 32.1
    | 
 12 | h last = last
    |   ^^^^

To do:

  • Add flag
  • Implement warning in WarnCheck
  • Add test case

This warning is currently disabled by default, is this okay? (I'd argue that it's useful enough to be enabled in general, but would be fine either way)

Edited Mar 03, 2022 by Fredrik Wieczerkowski
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: import-name-shadowing