Illegal code, or compiler limitation?

This compiles:

   typealias AnyDict = [String : Any]

   extension URLSession {
      func httpQuery<T>(_ url: URL) async throws -> T {
          ...
       }
    }

   struct TVInfo {
        init(data: AnyDict)  throws { ... }
        ...
    }

    func queryForTVs() async throws -> [TVInfo] {
        let deviceData: [AnyDict] = try await urlSession.httpQuery(url)
        return try deviceData.map { try TVInfo(data: $0) }
    }

This does not:

    func queryForTVs() async throws -> [TVInfo] {
        try await urlSession.httpQuery(url).map { try TVInfo(data: $0) }
    }

I would expect the second example to work via type inference: it is clear that map is taking an AnyDict, so the generic variable for httpQuery is clear. But I get an error like:

Invalid conversion from throwing function of type '(AnyDict) throws ->TVInfo' (aka '(Dictionary<String, Any>) throws -> TVInfo') to non-throwing function type '(AnyDict) -> AppleTVInfo' (aka '(Dictionary<String, Any>) -> TVInfo')

In the second case, if you add another try does it work? try (try await urlSession.httpQuery(url)).map { try TVInfo(data: $0) } If so it would appear to be a bug in the try coalescing, but I'm not sure.

A second try does not make any difference.

Actually, there is an overload on the function httpQuery() which may be confusing things. I removed the overload, and now I get a simpler "Cannot infer generic parameter T" which I understand (but am a bit disappointed by).