// RUN: %target-swift-ide-test -code-completion -source-filename %s -F %S/Inputs/mock-sdk -code-completion-token=COMPLETE | %FileCheck %s enum Encoding { case utf8 } func foo(bytes: ArraySlice, encoding: Encoding) { fatalError() } extension Array { func bar(r: R) -> ArraySlice where R : RangeExpression, Int == R.Bound { fatalError() } } /// The issue, that caused this to fail was that type checking `start` caused /// the entire `if` condition to be type-checked, thus also type-checking `end` /// which depends on `start`, thus creating a dependency cycle in the request /// evaluator. /// Thus `end` would get assigned an error type, causing `a` to be an error /// type and thus the completion on `encoding` fails. /// We need a particular order of type check requests to hit this behaviour, /// that's why the test case feels over-complicated. func deserializeName(_ data: Array, flag: Bool) { if flag, let start = Optional(Array.Index()), let end = Optional(start) { let range = start..