roc-lang / roc

A fast, friendly, functional language.
https://roc-lang.org
Universal Permissive License v1.0
4.17k stars 297 forks source link

Warning for unused definition that is used only in a test #6839

Closed lukewilliamboswell closed 3 months ago

lukewilliamboswell commented 3 months ago
── DEFINITION ONLY USED IN RECURSION in ListComparison.roc ─────────────────────

This definition is only used in recursion with itself:

 9│>  headingsMatch = \headingA, headingB ->
10│>      when T headingA headingB is
11│>          T [] [] -> Bool.true
12│>          T [a, .. as restA] [b, .. as restB] if a == b -> headingsMatch restA restB
13│>          _ -> Bool.false

If you don't intend to use or export this definition, it should be
removed!
module []

first : List U8
first = ['a']

second : List U8
second = ['b']

headingsMatch = \headingA, headingB ->
    when T headingA headingB is
        T [] [] -> Bool.true
        T [a, .. as restA] [b, .. as restB] if a == b -> headingsMatch restA restB
        _ -> Bool.false

expect !(headingsMatch first second)
lukewilliamboswell commented 3 months ago

Closing this as this is intended behaviour. The definition is used only in a test, and isn't exposed or used elsewhere.