summaryrefslogtreecommitdiff
path: root/source/slang/slang-check-type.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-check-type.cpp')
-rw-r--r--source/slang/slang-check-type.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/source/slang/slang-check-type.cpp b/source/slang/slang-check-type.cpp
index 2c8f3d0c0..db753713b 100644
--- a/source/slang/slang-check-type.cpp
+++ b/source/slang/slang-check-type.cpp
@@ -266,8 +266,10 @@ bool SemanticsVisitor::CoerceToProperTypeImpl(
// diagnostic.
// Get the AST node type info, so we can output a 'got' name
- auto info = ASTClassInfo::getInfo(originalExpr->astNodeType);
- diagSink->diagnose(originalExpr, Diagnostics::expectedAType, info->m_name);
+ diagSink->diagnose(
+ originalExpr,
+ Diagnostics::expectedAType,
+ originalExpr->getClass().getName());
}
}
@@ -296,7 +298,12 @@ bool SemanticsVisitor::CoerceToProperTypeImpl(
{
if (auto typeParam = as<GenericTypeParamDecl>(member))
{
- if (!typeParam->initType.exp)
+ if (auto defaultArg = typeParam->initType.type)
+ {
+ if (outProperType)
+ args.add(defaultArg);
+ }
+ else
{
if (diagSink)
{
@@ -305,10 +312,6 @@ bool SemanticsVisitor::CoerceToProperTypeImpl(
}
return false;
}
-
- // TODO: this is one place where syntax should get cloned!
- if (outProperType)
- args.add(ExtractGenericArgVal(typeParam->initType.exp));
}
else if (auto valParam = as<GenericValueParamDecl>(member))
{