Refactor type checking for functions and operators
This commit refactors the type checking logic for functions and operators to improve type safety and expressiveness. Key changes include: - Introduced `StaticType::FunctionOverloads` to represent functions with multiple possible signatures, enabling better handling of operator overloading. - Updated the `TypeChecker` to correctly infer function types and resolve calls with overloaded functions. - Modified the `Environment` to register standard library functions with specific `FunctionOverloads` signatures, replacing the previous `StaticType::Any` approach. - Enhanced the `StaticType::resolve_call` method to intelligently match argument types against expected parameters, including handling of overloaded functions. - Added new tests to verify the correctness of type inference for lambda returns and operator overloading.
This commit is contained in:
@@ -4,9 +4,7 @@
|
||||
* Das Ziel ist, die alte Delphi-Codebase nach Rust zu portieren.
|
||||
* Die alte Delphi-Codebase ist nicht zu verändern.
|
||||
|
||||
Wichtig: zentraler Einstiegspunkt ist
|
||||
@Delphi/Myc.Ast.Environment.pas
|
||||
und die dort referenzierten Units.
|
||||
Wichtig: zentraler Einstiegspunkt ist Delphi/Myc.Ast.Environment.pasund die dort referenzierten Units.
|
||||
|
||||
### Design
|
||||
|
||||
@@ -38,3 +36,8 @@ und die dort referenzierten Units.
|
||||
|
||||
* Ich kann Rust noch nicht so gut. Erkläre mir, was du machst und welche Konzepte du nutzt. Ich will was dazulernen.
|
||||
* Wenn clippy etwas vorschlägt, von dem du glaubst, dass es nicht stabil ist, dann überprüfe die aktuelle Version. Wahrscheinlich ist das Feature mittlerweile im trunk. Wir gehen immer davon aus, dass clippy recht hat.
|
||||
|
||||
## Testing
|
||||
|
||||
* Das Projekt enthält eine Testsuite für Skripte. Logik in src/utils/tester.rs. Diese Testes werden automatisch in "cargo test" eingebunden.
|
||||
* Nach Fertigstellung einer Aufgabe: Warnungen sind zu eliminieren. Tests müssen durchlaufen. Clippy auch.
|
||||
|
||||
Reference in New Issue
Block a user