{"id":387,"date":"2025-05-15T12:14:31","date_gmt":"2025-05-15T04:14:31","guid":{"rendered":"https:\/\/cliyr.cn\/?p=387"},"modified":"2025-05-15T12:14:31","modified_gmt":"2025-05-15T04:14:31","slug":"expression-is-ambiguous-for-type-lookup-in-this-context","status":"publish","type":"post","link":"https:\/\/cliyr.cn\/?p=387","title":{"rendered":"&#8216;Expression&#8217; is ambiguous for type lookup in this context"},"content":{"rendered":"\n<p>\u65e7iOS\u9879\u76ee\u6253\u5f00\u62a5\u9519\uff1a&#8217;Expression&#8217; is ambiguous for type lookup in this context<\/p>\n\n\n\n<p><strong>import<\/strong> SQLite<\/p>\n\n\n\n<p>filter: Expression&lt;Bool>? = <strong>nil<\/strong>, select: [Expressible] =\u00a0<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u539f\u56e0\uff1a<\/p>\n\n\n\n<p>The iOS 18\/macOS 15 SDK now includes a new type called\u00a0<a href=\"https:\/\/developer.apple.com\/documentation\/foundation\/expression\"><code>Expression<\/code><\/a>\u00a0in\u00a0<code>Foundation<\/code>. This seems to just be a version of\u00a0<a href=\"https:\/\/developer.apple.com\/documentation\/foundation\/predicate\"><code>Predicate<\/code><\/a>, except it can output any type, not just\u00a0<code>Bool<\/code>.<\/p>\n\n\n\n<p>\u5904\u7406\uff1a<\/p>\n\n\n\n<p>This causes a name conflict with the\u00a0<code>Expression<\/code>\u00a0type declared in\u00a0<code>SQLite<\/code>. You need to write\u00a0<code>SQLite.Expression<\/code>\u00a0to clarify. Or you can declare a type alias:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>typealias SQLExpression = SQLite.Expression<\/code><\/pre>\n\n\n\n<p>filter: <code>SQLite<\/code>.Expression&lt;Bool>? = <strong>nil<\/strong>, select: [Expressible] =<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u65e7iOS\u9879\u76ee\u6253\u5f00\u62a5\u9519\uff1a&#8217;Expression&#8217; is ambiguous for ty&hellip; <a class=\"more-link\" href=\"https:\/\/cliyr.cn\/?p=387\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">&#8216;Expression&#8217; is ambiguous for type lookup in this context<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[12],"_links":{"self":[{"href":"https:\/\/cliyr.cn\/index.php?rest_route=\/wp\/v2\/posts\/387"}],"collection":[{"href":"https:\/\/cliyr.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cliyr.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cliyr.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cliyr.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=387"}],"version-history":[{"count":1,"href":"https:\/\/cliyr.cn\/index.php?rest_route=\/wp\/v2\/posts\/387\/revisions"}],"predecessor-version":[{"id":388,"href":"https:\/\/cliyr.cn\/index.php?rest_route=\/wp\/v2\/posts\/387\/revisions\/388"}],"wp:attachment":[{"href":"https:\/\/cliyr.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=387"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cliyr.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=387"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cliyr.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}