Skip to content

Remove not used code#6064

Merged
SteffenDE merged 1 commit intophoenixframework:mainfrom
lukaszsamson:ls-fix-type-warn
Jan 26, 2025
Merged

Remove not used code#6064
SteffenDE merged 1 commit intophoenixframework:mainfrom
lukaszsamson:ls-fix-type-warn

Conversation

@lukaszsamson
Copy link
Contributor

Found by 1.19 typesystem. The build_params() call returns a non empty list so merge_all = merge_params ++ merge_private ++ merge_assigns is non empty as well.

     warning: comparison between distinct types found:

         merge_all != []

     given types:

         dynamic(non_empty_list(term(), term())) != empty_list()

     where "merge_all" was given the type:

         # type: dynamic(non_empty_list(term(), term()))
         # from: lib/phoenix/router/route.ex:178:15
         merge_all = merge_params ++ merge_private ++ merge_assigns

     While Elixir can compare across all types, you are comparing across types which are always disjoint, and the result is either always true or always false

     typing violation found at:
     │
 180 │     if merge_all != [] do
     │                  ~
     │
     └─ lib/phoenix/router/route.ex:180:18: Phoenix.Router.Route.build_prepare/1

@SteffenDE SteffenDE merged commit 1934500 into phoenixframework:main Jan 26, 2025
4 of 5 checks passed
@SteffenDE
Copy link
Contributor

Thank you! 🙌🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants