[Chapel Merge] CG: Implement associated types, constraints

Branch: refs/heads/master
Revision: 4b494ed
Author: vasslitvinov
Log Message:

Merge pull request #17114 from vasslitvinov/cg-assoc-types

CG: Implement associated types, constraints

With this PR, users can declare associated types and impose constraints
on them. An associated type can be implemented with either a type field
or a type method.
Associated types are disallowed on interfaces with >1 formal,
pending resolution of #17008.

For example:

interface IFC {
  type AT;
  AT implements Helper;
  ......
}

interface Helper { ...... }

record R1 {
  type AT;   // could also be 'proc AT type ...'
  ......
}

int implements Helper;
implements IFC(R1(int));  // AT = int

While there, improve debugging support.

Futurized one test that now fails while passing a ref formal of one
CG function to a default-intent formal of another CG function,
where both formals are of the same interface type.

Next steps: allow calling functions defined in the interface like Helper
from CG functions constrained by interface IFC.

r: @mppf

Modified Files:
A test/constrained-generics/basic/associated/associated-constraint-empty.chpl
A test/constrained-generics/basic/associated/associated-constraint-empty.good
A test/constrained-generics/basic/associated/associated-constraint-used.bad
A test/constrained-generics/basic/associated/associated-constraint-used.chpl
A test/constrained-generics/basic/associated/associated-constraint-used.future
A test/constrained-generics/basic/associated/associated-constraint-used.good
A test/constrained-generics/basic/associated/associated-type-query.chpl
A test/constrained-generics/basic/associated/associated-type-query.good
A test/constrained-generics/basic/associated/associated-type-three.chpl
A test/constrained-generics/basic/associated/associated-type-three.good
A test/constrained-generics/basic/associated/error-acons-not-sat.chpl
A test/constrained-generics/basic/associated/error-acons-not-sat.good
A test/constrained-generics/basic/associated/error-actual-mismatch.chpl
A test/constrained-generics/basic/associated/error-actual-mismatch.good
A test/constrained-generics/basic/associated/error-atype-not-impl.chpl
A test/constrained-generics/basic/associated/error-atype-not-impl.good
A test/constrained-generics/basic/set1/basic-ref-args.bad
A test/constrained-generics/basic/set1/basic-ref-args.future
M compiler/AST/AggregateType.cpp
M compiler/AST/FnSymbol.cpp
M compiler/AST/flags.cpp
M compiler/AST/interfaces.cpp
M compiler/AST/type.cpp
M compiler/include/AggregateType.h
M compiler/include/FnSymbol.h
M compiler/include/resolution.h
M compiler/include/stmt.h
M compiler/include/symbol.h
M compiler/include/type.h
M compiler/resolution/ResolutionCandidate.cpp
M compiler/resolution/interfaceResolution.cpp
M compiler/resolution/preFold.cpp
M test/constrained-generics/basic/set1/error-implements-stmt.good

Compare: Comparing 3f4f122d9265...4b494edf4a08 · chapel-lang/chapel · GitHub