#### §2.2.(b) Places of lowering

The lowering translation is not meant to be invoked by client code, but implicit translations are inserted by the compiler at all places where a role type is provided while the corresponding base type (or a super type) was expected.
In other words: lowering translations are inserted by the compiler at all places in a program which would otherwise not be type correct and which using lowering are statically type correct. This may concern:

- the right hand side of an assignment wrt. the static type of the left hand side,
- the argument values of a method or constructor call wrt. the static type of the corresponding formal parameter,
- the return value of a method compared to the declared return type of the method.
- a role parameter in a callout binding (§3.3.(d))
- or the return value in a callin binding (§4.5.(d))

1

    public team class MyTeamA {

2

      public class MyRole playedBy MyBase { ... }

3

      void useMyBase(MyBase myb) {...}

4

      MyRole returnMyRole() {...}

5

      public void doSomething() {

6

        MyRole r = new MyRole(new MyBase());

7

        MyBase b = r;

8

        useMyBase(r);

9

        MyBase b2 = returnMyRole();

10

      }

11

    }

##### Effects:

An instance of type `MyRole` is lowered to type `MyBase` when

- assigning it to `b` (line 7)
- passing it as argument to a method with formal parameter of type `MyBase` (line 8)
- assigning the return value to a variable of type `MyBase` (line 9)

Note: The constructor call in line 6 uses the lifting constructor as defined in §2.4.1

Lowering translations are not inserted for

- reference comparison (using `==` or `!=`)
- `instanceof` checks
- cast expressions
- return values in callout bindings §3.3.(d))
- parameters in callin bindings (§4.5.(d))

For cases where lowering shall be forced see §2.2.(d) below.