From 812e478989e27983b8dea7ab11964de751654ba2 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 4 Jun 2025 13:05:58 -0700 Subject: Make interface types non c-style in Slang2026. (#7260) * Make interface types non c-style. * Make Optional work with autodiff and existential types. * Fix. * patch behind slang 2026. * Fix warnings. * cleanup. * Fix tests. * Fix. * Fix com interface lowering. * Add comment to test. * regenerate command line reference * Add test for passing `none` to autodiff function. * Fix recording of `getDynamicObjectRTTIBytes`. * Fix nested Optional types. --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> --- source/slang/slang-check-decl.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'source/slang/slang-check-decl.cpp') diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index 5aff41988..e3b05ec00 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -34,7 +34,7 @@ static bool isAssociatedTypeDecl(Decl* decl) return false; } -static bool isSlang2026OrLater(SemanticsVisitor* visitor) +bool isSlang2026OrLater(SemanticsVisitor* visitor) { return visitor->getShared()->m_module->getModuleDecl()->languageVersion >= SLANG_LANGUAGE_VERSION_2026; @@ -1604,6 +1604,23 @@ EnumDecl* isEnumType(Type* type) return nullptr; } +bool isNullableType(Type* type) +{ + if (as(type)) + return true; + if (isDeclRefTypeOf(type)) + return true; + if (isDeclRefTypeOf(type)) + return true; + if (as(type)) + return true; + if (as(type)) + return true; + if (as(type)) + return true; + return false; +} + bool SemanticsVisitor::shouldSkipChecking(Decl* decl, DeclCheckState state) { if (state < DeclCheckState::DefinitionChecked) -- cgit v1.2.3