swift
swift copied to clipboard
[SR-286] Compiler thinks associated type with default value is undeclared
| Previous ID | SR-286 |
| Radar | rdar://23671447 |
| Original Reporter | @jepers |
| Type | Bug |
| Status | Closed |
| Resolution | Done |
Environment
OS X 10.11.2, Swift version 2.2-dev (LLVM 3ebdbb2c7e, Clang f66c5bb67b, Swift 69940d166c)
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler |
| Labels | Bug |
| Assignee | None |
| Priority | Medium |
md5: ee1e6ca6cf758c07bfe9960a185ff8da
Issue Description:
protocol P { typealias A = Int }
struct X : P {} // OK
struct Y : P { var a: Y.A } // OK
struct Z : P { var a: A } // Error: Use of undeclared type 'A' (What/why?)
Same result when modified for Swift 3 (tested in Xcode 8 beta 3):
protocol P { associatedtype A = Int } // A has default type Int
struct X : P {} // OK
struct Y : P { var a: Y.A } // OK
struct Z : P { var a: A } // Error: Use of undeclared type 'A' (Why?)
Fixed in Swift 3.1.