Get rid of FUNCTOR slice, use lazy value in ContractDecription instead

Functor is an imperative representation of function's contract (contrary
to ContractDescription, which is a declarative one). ContractDescription
is convenient when we deal with sources of contracts declarations
(binaries, source), while Functors are convenient for analyzing code
with contracts.

It means that we have to convert ContractDescription into Functor when
we start working with contracts. This computation isn't trivial, and
Functor and ContractDescription are in 1-1 correspondence, so we would
like to cache Functor for each ContractDescription somewhere.

We used to do this in binding trace, in slice FUNCTOR.

Now, it turns out that this approach causes "Rewrite at slice"
exception, see KT-28847. We won't go into details of why that happens
here, you can see the issue comments for details (but be prepared for the
very long and nitty-gritty story)

This commit removes the problematic slice and introduces another
approach, where Functor is attached to the ContractDescription, computed
lazily and cached here.

^KT-28847 Fixed
This commit is contained in:
Dmitry Savvinov
2018-12-20 13:00:00 +03:00
parent 594a6588f9
commit a4d1a8f60a
11 changed files with 43 additions and 29 deletions
@@ -1,10 +1,10 @@
package
public final class Foo {
public constructor Foo()
private final val foo: Foo.foo.<no name provided>
public final var property: kotlin.String?
public final inline fun </*0*/ T> equalVetoingObservable(/*0*/ initialValue: T, /*1*/ crossinline onChange: (newValue: T) -> kotlin.Unit): kotlin.properties.ObservableProperty<T>
public constructor Foo(/*0*/ str: kotlin.String?)
public final val first: kotlin.Boolean
public final val second: kotlin.Boolean
public final val str: kotlin.String?
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String