Skip to content

LRUCache does not compile with newer Swift #964

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
rainbowcardiod opened this issue Feb 22, 2021 · 1 comment
Open

LRUCache does not compile with newer Swift #964

rainbowcardiod opened this issue Feb 22, 2021 · 1 comment

Comments

@rainbowcardiod
Copy link

The compiler is complaining about type mismatches, priority.first is returning the element of the node, while key2node is expecting the node:
Cannot assign value of type 'KeyType?' to subscript of type 'LinkedList<KeyType>.LinkedListNode<KeyType>?'
at line [1]

My solution is to change key2node[key] = first of insert() [1]
with key2node[key] = priority.node(at: 0).

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@rainbowcardiod and others