Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dyno: initial implementation of checking (explicit) interface constraints #26396

Open
wants to merge 72 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
36a7395
Add a class for interface types
DanilaFe Dec 3, 2024
48de29d
Allow empty substitutions
DanilaFe Dec 3, 2024
aba8332
Resolve generic types for interface names
DanilaFe Dec 4, 2024
7c312ef
Expose interface type fields via getters
DanilaFe Dec 4, 2024
e157006
Allow type constructors for interfaces
DanilaFe Dec 4, 2024
cfa3b26
Enable resolving type constructors for interfaces
DanilaFe Dec 4, 2024
453c41f
Factor out some code to help compute implemented interfaces
DanilaFe Dec 5, 2024
536bd0e
Expose inheritance expression computation in header
DanilaFe Dec 5, 2024
c53c55c
Use a specific type for implementation points
DanilaFe Dec 5, 2024
d7bfb3a
Store formals in ImplementationPoints
DanilaFe Dec 5, 2024
550db2c
Add initial implementation of handling Implements statements
DanilaFe Dec 5, 2024
7aaea4a
Collect implementation points for an interface
DanilaFe Dec 5, 2024
9f300f0
Add a basic algorithm for looking for instantiation points
DanilaFe Dec 6, 2024
f5c7c58
Allow constructing an interface with a list of types.
DanilaFe Dec 5, 2024
8a1c629
[WIP] Start on 'primImplementsInterface'
DanilaFe Dec 5, 2024
56db98b
Fix quirks in implementation point search
DanilaFe Dec 6, 2024
c3a2168
Ensure unary `implements` statements work
DanilaFe Dec 6, 2024
f3f7798
Remove type query logic
DanilaFe Dec 6, 2024
cd328c1
Add a comment about disambiguation
DanilaFe Dec 6, 2024
5325061
Add some ID predicates
DanilaFe Dec 6, 2024
a60249b
Add interface frames for outer variable lookup
DanilaFe Dec 6, 2024
b980819
Allow ImplementationPoint to be used in queries
DanilaFe Dec 6, 2024
df6dc9b
Resolve outer variables from interfaces
DanilaFe Dec 6, 2024
49b16d9
Add initial sketch of checking interface constraints
DanilaFe Dec 6, 2024
c107940
Use typedSignatureInitial for interface resolution
DanilaFe Dec 6, 2024
295814f
Add an 'implementation witness' type to contain witness information
DanilaFe Dec 9, 2024
189aad6
Avoid caching unstable frames for interfaces
DanilaFe Dec 9, 2024
b8712e8
Switch to using witnesses for constraint satisfaction
DanilaFe Dec 9, 2024
73f6663
Add a 'placeholder type'
DanilaFe Dec 10, 2024
dc829c8
Use placeholders when resolving interface function signatures
DanilaFe Dec 10, 2024
549ea69
Implement substituting placeholders
DanilaFe Dec 10, 2024
2aba152
Use placeholder to improve checking interface signatures
DanilaFe Dec 10, 2024
b26f9c8
Insert placeholders for type queries
DanilaFe Dec 10, 2024
52254c7
Add stringify implementation
DanilaFe Dec 10, 2024
43c6c2f
Fix hashing unordered maps
DanilaFe Dec 11, 2024
ee5c308
Allow partial substitutions for 'canInstantiate'
DanilaFe Dec 11, 2024
8d5fa96
Use placeholders for AnyType in more cases.
DanilaFe Dec 11, 2024
e5c0f52
Change instantiation search to use the implementation point's scope
DanilaFe Dec 11, 2024
a746226
Remove comment intended for copilot
DanilaFe Dec 11, 2024
371cbb6
Remove debugger breaks
DanilaFe Dec 11, 2024
980e4bc
Resolve some TODOs
DanilaFe Dec 11, 2024
b419108
Emit error messages when unable to find candidate function
DanilaFe Dec 11, 2024
bee49a8
Emit errors for missing associated types
DanilaFe Dec 11, 2024
99ef2a8
Tweak comment
DanilaFe Dec 11, 2024
8843368
Add some tests of interfaces
DanilaFe Dec 12, 2024
abc0b43
Add a test for formal naming
DanilaFe Dec 12, 2024
4ef48b9
Add a test for formal naming
DanilaFe Dec 12, 2024
822644d
Ensure compiler itself builds
DanilaFe Dec 12, 2024
174ec73
Use compatible return values to primitives in production
DanilaFe Dec 12, 2024
19d5142
Fixed signedness mismatches
DanilaFe Dec 12, 2024
449efe3
Use a type map instead of a qualified type map for placeholders
DanilaFe Dec 12, 2024
8f6ccee
Stop iterating over the map for some reason
DanilaFe Dec 12, 2024
82e0d4f
Emit an error when associated type does not return type
DanilaFe Dec 12, 2024
811eee9
Don't store intents for associated types
DanilaFe Dec 12, 2024
7ae8a90
Remove unnecessary qualifier
DanilaFe Dec 12, 2024
47e542f
Compute interface genericity from its substitutions
DanilaFe Dec 12, 2024
1ebf335
Store implementation point types directly instead of re-typing them
DanilaFe Dec 12, 2024
23e8071
Change 'resolveImplementsStmt' to match 'resolveModuleStmt'
DanilaFe Dec 13, 2024
2563cca
Piggyback 'resolveImplementsStmt' off 'resolveModuleStmt'
DanilaFe Dec 13, 2024
8c45d2e
Store interface types in ImplementationPoint and use canPass
DanilaFe Dec 13, 2024
506ffd7
Add initial checking of implementation points in module scope
DanilaFe Dec 13, 2024
9002230
Check all implementation points (including from aggregate decls.)
DanilaFe Dec 13, 2024
ee23b3c
Check for auto-implemented constraints
DanilaFe Dec 13, 2024
b9c1b0c
Define new errors
DanilaFe Dec 13, 2024
aae49da
Fix incorrect bounds check in interface
DanilaFe Dec 13, 2024
be9092f
Emit newly-defined errors when handling interfaces
DanilaFe Dec 13, 2024
8a5a323
Lock down more error cases
DanilaFe Dec 13, 2024
b9c5ba9
Resolve TODO
DanilaFe Dec 13, 2024
3a2ad58
Improve stringify function for interfaces
DanilaFe Dec 13, 2024
c35a956
Move interface types into their own header
DanilaFe Dec 13, 2024
65a4090
Add some comments
DanilaFe Dec 13, 2024
140d6e0
Fix some bugs in the way of normal usage of stdlib interfaces
DanilaFe Dec 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Stop iterating over the map for some reason
Signed-off-by: Danila Fedorin <[email protected]>
  • Loading branch information
DanilaFe committed Dec 12, 2024
commit 8f6cceee0c4585eb237917db6552a9c615100b76
7 changes: 3 additions & 4 deletions frontend/include/chpl/types/PlaceholderType.h
Original file line number Diff line number Diff line change
@@ -56,10 +56,9 @@ class PlaceholderType final : public Type {

const Type* substitute(Context* context,
const PlaceholderMap& subs) const override {
for (auto& [id, t] : subs) {
if (id == id_) {
return t;
}
auto it = subs.find(id_);
if (it != subs.end()) {
return it->second;
}
return this;
}