§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:

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

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