ConstraintReduction

File ConstraintReduction.str
Author Martin Bravenboer
Since unknown

15.12.2.7: Reduction of Constraints (the huge itemize in this section)




Statistics


General
Lines of code 236
Stratego
Module number 1 (100% documented)
Constructor number 0
Overlay number 0
Strategy number 10 (60% documented)
Rule number 5 (100% documented)
DynamicRule number 0



Strategy summary


reduce-constraint(ATerm typevars) Inference of type arguments begins with a set of initial constraints of the form A << F, A = F, or A >> F, where A is a type of an actual parameter, and F is a type of a formal parameter ConstraintReduction.str
reduce-equal-generic-constraint(Strategy rec, ATerm t) If F has the form G< ConstraintReduction.str
reduce-equal-generic-constraint(Strategy rec, ATerm t) n/a ConstraintReduction.str
reduce-left-right-generic-constraint(Strategy rec, ATerm t) If F has the form G< ConstraintReduction.str
reduce-left-right-generic-constraint(Strategy rec, ATerm t) n/a ConstraintReduction.str
reduce-left-right-prim-constraint(Strategy rec, ATerm t) If A is primitive type ConstraintReduction.str
reduce-real-constraint(Strategy rec, ATerm t) n/a ConstraintReduction.str
reduce-real-constraint(Strategy rec, ATerm t) n/a ConstraintReduction.str
reduce-real-constraint(Strategy rec, ATerm t) n/a ConstraintReduction.str

Rule summary


helper-reduce-generic-constraint(Strategy s, Strategy rec, ATerm a, ATerm t) Helper used for A << F and A = F ConstraintReduction.str
reduce-equal-array-constraint(Strategy rec, ATerm t) If F = U[] where the type U involves Tj, then if A is an array type V[], or a type variable with an upper bound that is an array type V[], where V is a reference type, this algorithm is applied recursively to the constraint V = U ConstraintReduction.str
reduce-equal-simple-constraint(Strategy rec, ATerm t) If F is Tj, then the constraint Tj = A is implied ConstraintReduction.str
reduce-left-right-array-constraint(Strategy rec, ATerm t) If F = U[] ConstraintReduction.str
reduce-left-right-simple-constraint(Strategy rec, ATerm t) If F is Tj ConstraintReduction.str



Strategy details


ATerm reduce-constraint(ATerm typevars)
File ConstraintReduction.str
Author unknown
Since unknown
 
Parameters
ATerm typevars List of type variables

Inference of type arguments begins with a set of initial constraints of the form A << F, A = F, or A >> F, where A is a type of an actual parameter, and Fis a type of a formal parameter.

These constraints are reduced to a set of simpler constraints of the forms T :> X, T = X or T <: X, where T is a type parameter of the method.

The result of this method is a list of these simpler constraints.


type Constraint -> List(Constraint)

 
ATerm reduce-equal-generic-constraint(Strategy rec, ATerm t)
File ConstraintReduction.str
Author unknown
Since unknown
 

If F has the form G< .... U .... >, where U is a type expression


type Constraint -> List(Constraint)

 
ATerm reduce-left-right-generic-constraint(Strategy rec, ATerm t)
File ConstraintReduction.str
Author unknown
Since unknown
 

If F has the form G< .... U .... >, where U is a type expression


type Constraint -> List(Constraint)

 
ATerm reduce-left-right-prim-constraint(Strategy rec, ATerm t)
File ConstraintReduction.str
Author unknown
Since unknown
 

If A is primitive type.


todo Recursive invocation of reduction or fixpoint strategy?
type Constraint -> List(Constraint)

 
ATerm reduce-real-constraint(Strategy rec, ATerm t)
File ConstraintReduction.str
Author unknown
Since unknown
 

No information available.


type Constraint -> List(Constraint)

 
ATerm reduce-real-constraint(Strategy rec, ATerm t)
File ConstraintReduction.str
Author unknown
Since unknown
 

No information available.


type Constraint -> List(Constraint)

 

Rule details


ATerm helper-reduce-generic-constraint(Strategy s, Strategy rec, ATerm a, ATerm t)
File ConstraintReduction.str
Author unknown
Since unknown
 

Helper used for A << F and A = F.


todo Check that u is a type expression.
todo Check that v is a type expression.
todo Should the fetch-elem be a retain-all?
type List(ActualTypeArg) -> List(Constraint)

 
ATerm reduce-equal-array-constraint(Strategy rec, ATerm t)
File ConstraintReduction.str
Author unknown
Since unknown
 

If F = U[] where the type U involves Tj, then if A is an arraytype V[], or a type variable with an upper bound that is an arraytype V[], where V is a reference type, this algorithm is appliedrecursively to the constraint V = U.


todo Primitive arrays introduce no constraints. Test this.
todo TypeVariable upper bound case.
type Constraint -> List(Constraint)

 
ATerm reduce-equal-simple-constraint(Strategy rec, ATerm t)
File ConstraintReduction.str
Author unknown
Since unknown
 

If F is Tj, then the constraint Tj = A is implied.


type Constraint -> List(Constraint)

 
ATerm reduce-left-right-array-constraint(Strategy rec, ATerm t)
File ConstraintReduction.str
Author unknown
Since unknown
 

If F = U[]


todo Primitive arrays introduce no constraints. Test this.
todo TypeVariable upper bound case.

 
ATerm reduce-left-right-simple-constraint(Strategy rec, ATerm t)
File ConstraintReduction.str
Author unknown
Since unknown
 

If F is Tj


type Constraint -> List(Constraint)