-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
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 ImplementationgenericsFeature: generic declarations and typesFeature: generic declarations and typestuplesFeature: tuplesFeature: tuplestype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis
Description
Previous ID | SR-4246 |
Radar | None |
Original Reporter | @palimondo |
Type | Bug |
Attachment: Download
Environment
Apple Swift version 3.0.2 (swiftlang-800.0.63 clang-800.0.42.1)
Target: x86_64-apple-macosx10.9
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug, DiagnosticsQoI, TypeChecker |
Assignee | None |
Priority | Medium |
md5: 1bda1dd32a2bee653ddb7117169bec0e
Issue Description:
Following code:
public struct ComposedSequence<Element, State> {
var _state: State
var _next: (inout State) -> Element?
}
func composePrefix<BaseIterator : IteratorProtocol>(_ prefix: Int, _ iterator: BaseIterator) -> ComposedSequence<BaseIterator.Element, (count: Int, iterator: BaseIterator)> {
func _prefix(state: inout (count: Int, iterator: BaseIterator)) -> BaseIterator.Element? {
return nil
}
// The first member in tuple is deliberatly of wrong type (String instead of Int) to force error
return ComposedSequence(_state: ("prefix", iterator), _next: _prefix)
}
produces following compiler error (scroll right for the interesting part):
GenericParameterMissingInVagueErrorMessage.swift:13:66: error: cannot convert value of type '(inout (count: Int, iterator: BaseIterator)) -> BaseIterator.Element?' to expected argument type '(inout (String, _)) -> _?'
return ComposedSequence(_state: ("prefix", iterator), _next: _prefix)
^~~~~~~
Notice how the generic parameter BaseIterator
is missing from the reported expected type:
(inout (String, _)) -> _?
That type should be (inout (String, BaseIterator)) -> BaseIterator.Element?
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 ImplementationgenericsFeature: generic declarations and typesFeature: generic declarations and typestuplesFeature: tuplesFeature: tuplestype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis