You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
main.swift:16:31: error: type alias 'Bar' is not a member type of 'Foo'
public typealias FooBar = Foo.Bar
~~~ ^
main.swift:25:22: error: cannot convert value of type 'Dictionary<Key, Value>' to expected argument type 'Foo.Bar' (aka 'Dictionary<String, Int>')
take(fooBar: self)
^~~~
as! Foo.Bar
However, the following compiles and runs with no warnings or errors:
// MARK: BasispublicclassFoo{publictypealiasBar=[String:Int]}func take(fooBar:Foo.Bar){print(fooBar)}// MARK: No ProblemspublictypealiasFooBar=Foo.Barletfb=FooBar()extensionDictionarywhere Key ==FooBar.Key,
Value ==FooBar.Value{func baz(){take(fooBar:self)}}// MARK: Usages
fb.baz()take(fooBar:[:])
Tested and verified in Xcode 10.2.1 (10E1001) and 11.0 beta (11M336w). The described problem doesn't exist, and both snippets compile successfully and run identically.
Environment
macOS Sierra 10.12.6 (16G29)
Xcode Version 8.3.3 (8E3004b)
Xcode Version 9.0.1 (9A1004)
Swift 3.2
Swift 4.0
Additional Detail from JIRA
md5: 50944bc48fdef42021aa45761bcee0ab
relates to:
Issue Description:
Observed behavior:
The following fails to compile in the same way for Swift 3.0, 3.2, and 4.0:
The above code emits the following errors:
However, the following compiles and runs with no warnings or errors:
Expected behavior:
Both compile and run identically.
Original discovery and discussion: https://stackoverflow.com/q/46816925/3939277
The text was updated successfully, but these errors were encountered: