Skip to content

Conversation

@bruschke
Copy link
Contributor

Summary

  • Fixes Elixir 1.18 deprecation warning in parse_udp/2
  • Replaces deprecated Enum.slice(0..-2//-1) with Enum.slice(0..-2//1)

Issue

When connecting to SQL Server instances via UDP for instance discovery, users see this warning in Elixir 1.18:

warning: negative steps are not supported in Enum.slice/2, pass 0..-2//1 instead
  (elixir 1.18.4) lib/enum.ex:3015: Enum.slice/2
  (tds 2.3.5) lib/tds/protocol.ex:394: Tds.Protocol.parse_udp/2

Changes

  • Updated line 394 in lib/tds/protocol.ex to use the correct range syntax
  • The behavior remains identical (slicing all elements except the last one)
  • No functional changes, only syntax update for Elixir 1.18 compatibility

Test plan

  • Existing tests should pass
  • The warning will no longer appear when connecting to SQL Server instances

🤖 Generated with Claude Code

Replace deprecated Enum.slice(0..-2//-1) syntax with Enum.slice(0..-2//1)
to fix warning in Elixir 1.18:

  warning: negative steps are not supported in Enum.slice/2,
  pass 0..-2//1 instead

This warning appears in lib/tds/protocol.ex:394 when connecting to
SQL Server instances via UDP for instance discovery.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@josevalim josevalim merged commit 1846678 into elixir-ecto:master Nov 24, 2025
4 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

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