summaryrefslogtreecommitdiffstats
path: root/tests/cpu-program
diff options
context:
space:
mode:
authorsricker-nvidia <115114531+sricker-nvidia@users.noreply.github.com>2025-07-08 16:15:51 -0700
committerGitHub <noreply@github.com>2025-07-08 23:15:51 +0000
commit2c4bfce49d9af2414f6a3f70f7221d6890a017e7 (patch)
treef92644117c10e6d7a34f56b0499b0365e881d6f1 /tests/cpu-program
parent0ab515159e9da15e0077d55c761ca0f326361257 (diff)
Add error for forward references in generic constraints (#7615)
* Add error for forward references in generic constraints Change addresses issue #6545. The slang compiler's type checker is unable to support cases where a generic type parameter is referenced as a constraint before it is declared. For example code like: ```` interface IFoo<T : IFloat> { } void bar<Foo : IFoo<T>, T : IFloat>() { } ```` Is not supported, but will currently report a generic error like, "(0): error 99999: Slang compilation aborted due to an exception of class Slang::InternalError: unexpected: generic type constraint during lowering" This change adds a new check for this kind of code and reports an error like, "error 30117: generic constraint for parameter 'Foo' references type parameter 'T' before it is declared" when detected. Basic testing of this error is also added in a new diagnostic test. * Add error for forward refs in generic constiants update 1 * Add error for forward refs in generic constraints update 2 Revised algo in checkForwardReferencesInGenericConstraint to run in O(n) instead of the previous O(n^2) using HashSets. * Add error for forward refs in generic constraints update 3 -Update logic adding referenced decl's in collectReferencedDecls. -Simplified error string logic. * Add error for forward refs in generic constraints update 4 -Declare collectReferencedDecls in slang-check.h such that it can be used as a general utility function. * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Diffstat (limited to 'tests/cpu-program')
0 files changed, 0 insertions, 0 deletions