-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
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 itselfdiagnostics QoIBug: Diagnostics Quality of ImplementationBug: Diagnostics Quality of ImplementationexpressionsFeature: expressionsFeature: expressionsgood first issueGood for newcomersGood for newcomersoptional chainingFeature → expressions: optional chainingFeature → expressions: optional chainingswift 5.9type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysistype inferenceFeature: type inferenceFeature: type inference
Description
Previous ID | SR-15111 |
Radar | rdar://problem/82407752 |
Original Reporter | elidy (JIRA User) |
Type | Bug |
Environment
Xcode Version 13.0 beta 4 (13A5201i)
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug, DiagnosticsQoI, StarterBug, TypeChecker |
Assignee | elidy (JIRA) |
Priority | Medium |
md5: 37c1160eb7b2424ea42b3ec849906fef
Issue Description:
When a class is initialized, passing an argument as a property of an optional class instance of incorrect type results in “Type of expression is ambiguous” error.
class IntClass {
var int: Int?
init(int: Int?) {
self.int = int
}
}
class StringClass {
var string: String? = "hello"
}
var stringClass: StringClass? = StringClass()
IntClass(int: stringClass?.string)
//Type of expression is ambiguous without more context
//Expected error: Cannot convert value of type 'String?' to expected argument type 'Int?'
var stringValue = stringClass?.string
IntClass(int: stringValue)
//Cannot convert value of type 'String?' to expected argument type 'Int?'
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 itselfdiagnostics QoIBug: Diagnostics Quality of ImplementationBug: Diagnostics Quality of ImplementationexpressionsFeature: expressionsFeature: expressionsgood first issueGood for newcomersGood for newcomersoptional chainingFeature → expressions: optional chainingFeature → expressions: optional chainingswift 5.9type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysistype inferenceFeature: type inferenceFeature: type inference