Skip to content
VIRAJ

Case OS · Open source / Swift

Swift Tools Protocols

A whole JSON number should still decode into a Double

  • SWIFT
  • LSP
  • MERGED

The issue

Whole JSON numbers (3, 3.0, 3000) decoded as .int, so a Double? field like SourceKitLSPOptions.debounce threw. try? swallowed that, and the entire options struct became `nil`. Tracked as sourcekit-lsp#2761.

The fix

LSPAnyDecoder now accepts .int on the float path and converts it to Double. Tests cover 3, 3.0, and 3000.

Technology

  • Swift
  • LSP
  • Codable
  • Swift Testing