{"id":21952,"date":"2018-06-27T14:08:28","date_gmt":"2018-06-27T18:08:28","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=21952"},"modified":"2018-06-27T14:09:55","modified_gmt":"2018-06-27T18:09:55","slug":"sr-7380-ambiguous-keypath","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2018\/06\/27\/sr-7380-ambiguous-keypath\/","title":{"rendered":"SR-7380, Ambiguous KeyPath"},"content":{"rendered":"<p><a href=\"http:\/\/matt.diephouse.com\/swift\/0\/\">Matt Diephouse<\/a>:<\/p>\n<blockquote cite=\"http:\/\/matt.diephouse.com\/swift\/0\/\">\n<p>Here&rsquo;s the bug I fixed (with a lot of help):<\/p>\n<pre>7380.swift:1:16: error: type of expression is ambiguous without more context\n\"str\"[keyPath: \\.count]\n               ^~~~~~~\n<\/pre>\n<p>That seems obviously broken. The value is a <code>String<\/code> literal. They <code>KeyPath<\/code> should obviously be <code>String.count<\/code>. So why doesn&rsquo;t this work?<\/p>\n<\/blockquote>\n<p>This is an interesting look at learning how to fix a bug in the Swift compiler.<\/p>","protected":false},"excerpt":{"rendered":"<p>Matt Diephouse: Here&rsquo;s the bug I fixed (with a lot of help): 7380.swift:1:16: error: type of expression is ambiguous without more context \"str\"[keyPath: \\.count] ^~~~~~~ That seems obviously broken. The value is a String literal. They KeyPath should obviously be String.count. So why doesn&rsquo;t this work? This is an interesting look at learning how to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2018-06-27T18:09:57Z","apple_news_api_id":"8aef0cf1-d87b-43f2-a92a-a6aea9a486e3","apple_news_api_modified_at":"2018-06-27T18:09:58Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAAAA==","apple_news_api_share_url":"https:\/\/apple.news\/Aiu8M8dh7Q_KpKqauqaSG4w","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[255,71,901],"class_list":["post-21952","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-compiler","tag-programming","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/21952","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=21952"}],"version-history":[{"count":2,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/21952\/revisions"}],"predecessor-version":[{"id":21962,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/21952\/revisions\/21962"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=21952"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=21952"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=21952"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}