Hello! My name is Tomoaki Kobayashi and I am an undergraduate student in Japan. I am interested in the project and started to read the related codes like TypeCheckConstraints, ConstraintSystem, and CSSolver a little bit.

@hborla @xedin

Do you have a typical example where a confusing type is inferred?

If we also consider type errors in that case, one of the cases which I guess is the mistaken use of foldr as foldl’s interface:

```
extension Array {
func foldl<A>(f: ((A, Element) -> A), z:A) -> A {
var z = z
for x in self {
z = f(z,x)
}
return z
}
func foldr<A>(f: ((Element, A) -> A), z:A) -> A {
var z = z
for x in self.reversed() {
z = f(x,z)
}
return z
}
}
let a = [1,2,3]
let b = [4,5,6]
print(a.foldr(f:{x,y in [y] + x}, z:b))
// ^ error: cannot convert value of type '[Any]' to expected argument type 'Int'
```

Now, my idea is to allow users to add an annotation to an expression of which they want to trace its typing like `a.foldr(f:{(x, y:@trace-type) in [y] + x}, z:b)`

. Then, if we are no need to handle type errors, what the tool should do there is really similar to what `swift -frontend -typecheck -debug-constraints`

do: just displays only the actually adopted solution for the expression by omitting the dump of failed attempts of disjunction choices, bindings and so on in the above debugging command.