From 7d8f1c7b2d62a85e6bbdb09ed659a30536415460 Mon Sep 17 00:00:00 2001 From: Jon Vanvik Date: Sun, 31 May 2026 16:58:56 +0200 Subject: [PATCH] Fix build: annotate list-VM merge locals so .sorted infers its element MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The generation-guard refactor moved the fetched.map{…}.sorted{…} chain into an untyped `let merged`, dropping the type anchor the property assignment used to provide. A multi-statement .map closure then leaves .sorted's $0 uninferred (error: cannot infer type of closure parameter). Annotate merged in OLTListViewModel and ONUListViewModel as [OLTStateDoc]/[ONUStateDoc]. Co-Authored-By: Claude Opus 4.8 (1M context) --- OLTListViewModel.swift | 2 +- ONUListViewModel.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OLTListViewModel.swift b/OLTListViewModel.swift index faadd4e..e428d85 100644 --- a/OLTListViewModel.swift +++ b/OLTListViewModel.swift @@ -29,7 +29,7 @@ final class OLTListViewModel { do { let fetched = try await connection.olt.allStates() let names = (try? await connection.olt.nameMap()) ?? [:] - let merged = fetched + let merged: [OLTStateDoc] = fetched .map { olt in var olt = olt; olt.resolvedName = names[olt.id]; return olt } .sorted { $0.displayName.localizedCaseInsensitiveCompare($1.displayName) == .orderedAscending } guard gen == loadGeneration, !Task.isCancelled else { return } diff --git a/ONUListViewModel.swift b/ONUListViewModel.swift index f69371c..e0f1c43 100644 --- a/ONUListViewModel.swift +++ b/ONUListViewModel.swift @@ -42,7 +42,7 @@ final class ONUListViewModel { // Registration lives on OLT-STATE, operator names on ONU-CFG. Both best-effort. let registration = (try? await connection.olt.registrationMap()) ?? [:] let names = (try? await connection.onu.nameMap()) ?? [:] - let merged = fetched + let merged: [ONUStateDoc] = fetched .map { onu in var onu = onu onu.resolvedLifecycle = registration[onu.id]