Skip to content

Commit 4f10b7f

Browse files
committed
wip
1 parent 0d4df86 commit 4f10b7f

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

source/slang/slang-check-conversion.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ bool SemanticsVisitor::isEffectivelyScalarForInitializerLists(Type* type)
4343
if (as<MatrixExpressionType>(type))
4444
return false;
4545

46-
if (as<BasicExpressionType>(type))
46+
if (as<BasicExpressionType>(type) || as<IntLiteralType>(type))
4747
{
4848
return true;
4949
}
@@ -996,7 +996,11 @@ static bool isSigned(Type* t)
996996
{
997997
auto basicType = as<BasicExpressionType>(t);
998998
if (!basicType)
999+
{
1000+
if (auto litType = as<IntLiteralType>(t))
1001+
return isSigned(litType->getProperType());
9991002
return false;
1003+
}
10001004
switch (basicType->getBaseType())
10011005
{
10021006
case BaseType::Int8:
@@ -1014,7 +1018,11 @@ int getTypeBitSize(Type* t)
10141018
{
10151019
auto basicType = as<BasicExpressionType>(t);
10161020
if (!basicType)
1021+
{
1022+
if (auto litType = as<IntLiteralType>(t))
1023+
return getTypeBitSize(litType->getProperType());
10171024
return 0;
1025+
}
10181026

10191027
switch (basicType->getBaseType())
10201028
{

source/slang/slang-check-decl.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -7707,7 +7707,12 @@ bool SemanticsVisitor::isIntValueInRangeOfType(IntegerLiteralValue value, Type*
77077707
{
77087708
auto basicType = as<BasicExpressionType>(type);
77097709
if (!basicType)
7710-
return false;
7710+
{
7711+
if (auto litType = as<IntLiteralType>(type))
7712+
basicType = (BasicExpressionType*)litType->getProperType();
7713+
else
7714+
return false;
7715+
}
77117716

77127717
switch (basicType->getBaseType())
77137718
{

source/slang/slang-check-expr.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -4937,7 +4937,7 @@ Expr* SemanticsVisitor::checkBaseForMemberExpr(
49374937
{
49384938
auto baseExpr = inBaseExpr;
49394939
baseExpr = CheckTerm(baseExpr);
4940-
4940+
baseExpr = maybeCoerceExprToProperIntType(baseExpr);
49414941
return maybeInsertImplicitOpForMemberBase(baseExpr, checkBaseContext, outNeedDeref);
49424942
}
49434943

@@ -5032,7 +5032,6 @@ Expr* SemanticsExprVisitor::visitMemberExpr(MemberExpr* expr)
50325032
return CheckSwizzleExpr(expr, baseScalarType, 1);
50335033
}
50345034
}
5035-
50365035
if (as<NamespaceType>(baseType))
50375036
{
50385037
return _lookupStaticMember(expr, expr->baseExpression);

0 commit comments

Comments
 (0)