Skip to content

Commit db721c6

Browse files
committed
update
1 parent 50f65c2 commit db721c6

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

packages/schema/src/language-server/validator/expression-validator.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
import { ValidationAcceptor, getContainerOfType, streamAst } from 'langium';
2626
import { findUpAst, getContainingDataModel } from '../../utils/ast-utils';
2727
import { AstValidator } from '../types';
28-
import { isAuthOrAuthMemberAccess, translateExpressionTypeToResolve, typeAssignable } from './utils';
28+
import { isAuthOrAuthMemberAccess, typeAssignable } from './utils';
2929

3030
/**
3131
* Validates expressions.
@@ -295,19 +295,17 @@ export default class ExpressionValidator implements AstValidator<Expression> {
295295
}
296296

297297
private isValidOperandType(operand: Expression, supportedShapes: string[]): boolean {
298-
const decl = operand.$resolvedType?.decl;
298+
let decl = operand.$resolvedType?.decl;
299+
if (isAliasDecl(decl)) {
300+
// If it's an alias, we check the resolved type of the expression
301+
decl = decl.expression?.$resolvedType?.decl;
302+
}
299303

300304
// Check for valid type
301305
if (typeof decl === 'string') {
302306
return supportedShapes.includes(decl);
303307
}
304308

305-
// Check for valid AliasDecl
306-
if (isAliasDecl(decl)) {
307-
const mappedResolvedType = translateExpressionTypeToResolve(decl.expression?.$type);
308-
return supportedShapes.includes(mappedResolvedType);
309-
}
310-
311309
// Any other type is invalid
312310
return false;
313311
}

0 commit comments

Comments
 (0)