diff options
| author | Yong He <yonghe@outlook.com> | 2022-10-27 11:06:14 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-27 11:06:14 -0700 |
| commit | 8e11063bfcec528e70f5e80e5db9fca7d4016737 (patch) | |
| tree | 60a4a492e732479bb1f72e76675b2b494c140b6b /source/slang/slang-check-impl.h | |
| parent | f7f0dcadd3b2aca4c0bcd03a96e11c617cf69fc2 (diff) | |
Auto synthesis of IDifferntial interface methods. (#2469)
* Auto synthesis of IDifferntial interface methods.
* Add comments.
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-check-impl.h')
| -rw-r--r-- | source/slang/slang-check-impl.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/source/slang/slang-check-impl.h b/source/slang/slang-check-impl.h index 2dc08262e..31075c3e8 100644 --- a/source/slang/slang-check-impl.h +++ b/source/slang/slang-check-impl.h @@ -630,10 +630,6 @@ namespace Slang Expr* base, SourceLoc loc); - Expr* maybeUseSynthesizedTypeDeclForLookupResult( - LookupResultItem const& item, - Expr* orignalExpr); - Expr* maybeUseSynthesizedDeclForLookupResult( LookupResultItem const& item, Expr* orignalExpr); @@ -1073,6 +1069,12 @@ namespace Slang Dictionary<DeclRef<InterfaceDecl>, RefPtr<WitnessTable>> mapInterfaceToWitnessTable; }; + FuncDecl* synthesizeMethodSignatureForRequirementWitness( + ConformanceCheckingContext* context, + DeclRef<FuncDecl> requiredMemberDeclRef, + List<Expr*>& synArgs, + ThisExpr*& synThis); + /// Attempt to synthesize a method that can satisfy `requiredMemberDeclRef` using `lookupResult`. /// /// On success, installs the syntethesized method in `witnessTable` and returns `true`. @@ -1104,6 +1106,15 @@ namespace Slang DeclRef<Decl> requiredMemberDeclRef, RefPtr<WitnessTable> witnessTable); + /// Attempt to synthesize `zero`, `dadd` and `dmul` methods for a type that conforms to + /// `IDifferentiable`. + /// On success, installs the syntethesized functions and returns `true`. + /// Otherwise, returns `false`. + bool trySynthesizeDifferentialMethodRequirementWitness( + ConformanceCheckingContext* context, + DeclRef<Decl> requirementDeclRef, + RefPtr<WitnessTable> witnessTable); + /// Attempt to synthesize an associated `Differential` type for a type that conforms to /// `IDifferentiable`. /// |
