Ticket #292 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

Generic callin to generic base method

Reported by: stephan Owned by: stephan
Priority: major Milestone: OTDT_1.4.0_M3
Component: language Version: 1.3.1
Keywords: Cc:

Description

Currently, type parameters for callin methods are only intended for capturing covariant base method returns. This should be extended to also allow propagating base method type parameters like in

class MyBase {
  <T> T getIt(T it) { return it; }
}
team class MyTeam {
  protected class MyRole playedBy MyBase {
    callin <T> T rm(T it) { return base.rm(it); }
    <T> T rm(T it) <- replace <T> T getIt(T it);
  }
}

Here the type parameters <T> of both sides of the callin binding should be identified.

This requires the following changes (otjld and compiler):

  • type parameters of callin method must be discriminated into free parameters (capturing covariant return) and propagating parameters
  • type parameters of role and base method specs need to be checked against each other
  • rule OTJLD §4.1(a) can not be checked inspecting only the callin method but requires the callin binding, too. Thus, the mentioned paragraph must be rephrased.
  • Also propagating type parameters should be mentioned in the rules.

The disabled test A.1.1-otjld_generic-feature-in-base-3ci serves as a witness.

Change History

Changed 2 years ago by stephan

Thinking more about it appears that there is no use in specifying type parameters in a callin RHS. Thus the above example must be updated to

class MyBase {
  <T> T getIt(T it) { return it; }
}
team class MyTeam {
  protected class MyRole playedBy MyBase {
    callin <T> T rm(T it) { return base.rm(it); }
    <T> T rm(T it) <- replace T getIt(T it);
  }
}

As a consequence bullet 2 of above list is obsolete.

r22413 implements the new syntax error message -- tested by A.1.1-otjld-generic-feature-in-base-3cif.

A.1.1-otjld-generic-feature-in-base-3cig additionally tests plainly unresolved type in this kind of callin.

Changed 2 years ago by stephan

The OTJLD is updated in r22415.

Changed 2 years ago by stephan

Eugene Hutorny reported similar problems, see new (disabled) tests A.1.1-otjld_generic-feature-in-base-3cib and A.1.1-otjld_generic-feature-in-base-3cibf.

Changed 2 years ago by stephan

  • milestone set to OTDT_1.4.0_M3

Changed 2 years ago by stephan

r23201 (implementation) and r23202 (tests) should solve this issue, full test run pending.

Changed 2 years ago by stephan

  • status changed from new to closed
  • resolution set to fixed

Tests passed. Closing.

Note: See TracTickets for help on using tickets.