-
Couldn't load subscription status.
- Fork 10.6k
Closed as not planned
Closed as not planned
Copy link
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfnot a bugResolution → not a bug: Reported as a bug but turned out to be expected behavior or programmer errorResolution → not a bug: Reported as a bug but turned out to be expected behavior or programmer erroropaque result typesFeature → types → opaque types: opaque result typesFeature → types → opaque types: opaque result typesopaque typesFeature → types: opaque typesFeature → types: opaque typespropertiesFeature: propertiesFeature: propertiesswift 6.0type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysisunexpected errorBug: Unexpected errorBug: Unexpected error
Description
Description
This looks similar to #69241.
struct S1 {
let w1 = Wrapper(getProto())
// Error: Property definition has inferred type 'Wrapper<some Proto>', involving the 'some' return type of another declaration
let w2 = Wrapper(value)
// Error: Property definition has inferred type 'Wrapper<some Proto>', involving the 'some' return type of another declaration
}Reproduction
protocol Proto {}
struct Concrete: Proto {}
func getProto() -> some Proto { Concrete() }
let value = getProto()
struct Wrapper<P: Proto> {
let value: P
init(_ wrappedValue: P) {
self.value = wrappedValue
}
var wrappedValue: P {
self.value
}
}
let w1 = Wrapper(getProto())
let w2 = Wrapper(value)
struct S1 {
let w1 = Wrapper(getProto())
// Error: Property definition has inferred type 'Wrapper<some Proto>', involving the 'some' return type of another declaration
let w2 = Wrapper(value)
// Error: Property definition has inferred type 'Wrapper<some Proto>', involving the 'some' return type of another declaration
}Expected behavior
Compiles with no errors.
Environment
Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Apple Swift version 6.0-dev (LLVM 5b202efbc95a8bf, Swift a17d360d1cc66ab)
Apple Swift version 6.0-dev (LLVM 3417addab6ff197, Swift d677b7c23fd6355)
Additional information
No response
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfnot a bugResolution → not a bug: Reported as a bug but turned out to be expected behavior or programmer errorResolution → not a bug: Reported as a bug but turned out to be expected behavior or programmer erroropaque result typesFeature → types → opaque types: opaque result typesFeature → types → opaque types: opaque result typesopaque typesFeature → types: opaque typesFeature → types: opaque typespropertiesFeature: propertiesFeature: propertiesswift 6.0type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysisunexpected errorBug: Unexpected errorBug: Unexpected error