Skip to content

Fix LRUCache Swift 6 typecheck#2048

Open
AbodiDawoud wants to merge 1 commit into
kodecocodes:masterfrom
AbodiDawoud:codex/fix-lru-cache-swift-6
Open

Fix LRUCache Swift 6 typecheck#2048
AbodiDawoud wants to merge 1 commit into
kodecocodes:masterfrom
AbodiDawoud:codex/fix-lru-cache-swift-6

Conversation

@AbodiDawoud

Copy link
Copy Markdown

I fixed the LRU cache playground helper so it typechecks in Swift 6 language mode.

The nested LinkedListNode<T> generic parameter shadowed the outer LinkedList<T> generic parameter. Newer Swift treats that as an error, so this renames the nested parameter to Value without changing behavior.

Fixes #964

Checklist

Validation

  • swiftc -swift-version 6 -typecheck "LRU Cache/LRUCache.playground/Sources/LinkedList.swift" "LRU Cache/LRUCache.swift"
  • swiftc -swift-version 6 -typecheck "LRU Cache/LRUCache.playground/Sources/LinkedList.swift" "LRU Cache/LRUCache.playground/Sources/LRUCache.swift"
  • git diff --check

swiftlint was not available locally.

@iiicey

iiicey commented Jun 3, 2026 via email

Copy link
Copy Markdown

@ranahammad ranahammad left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

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.

LRUCache does not compile with newer Swift

3 participants