added a comment - - edited
Type inference is done by executing a TypeCheckReturnTypeGoal. This goal is set up for the operator this(i:Int) declaration with the wrong context. The context does not contain the outer guard (for the sequence() declaration).
Igor believes that during type-check preparation phase the outer guard is pushed into the context correctly. However, the code currently evaluates the constraint. Likely this is null at the time that it is evaluated. So Igor suggests we should put ref 's into the context for the constraints. So we would change the API of Context so that to specify a pushAdditionalConstraint takes a Ref<CConstraint>.rather than a CConstraint. Similarly for type constraints.
In this way, the links are put in place correctly. Now during type-checking time when the current constraint needs to be assembled from the current context, these ref's will be evaluated, and All Will Be Well™.