@@ -10,7 +10,6 @@ import {
1010 DataModelFieldType ,
1111 Enum ,
1212 EnumField ,
13- Expression ,
1413 ExpressionType ,
1514 FunctionDecl ,
1615 FunctionParam ,
@@ -333,9 +332,8 @@ export class ZModelLinker extends DefaultLinker {
333332 getModelFieldsWithBases ( containingModel ) . find ( ( field ) => field . name === name ) ;
334333
335334 // Ensure the alias expression is fully resolved in the current context
336- this . resolveExpressionInContext ( matchingAlias . expression , document , containingModel , [
337- scopeProvider ,
338- ] ) ;
335+ // Pass both the model scope and existing extraScopes
336+ this . resolve ( matchingAlias . expression , document , [ scopeProvider , ...extraScopes ] ) ;
339337 }
340338 }
341339 } else {
@@ -472,16 +470,6 @@ export class ZModelLinker extends DefaultLinker {
472470 node . $resolvedType = node . value . $resolvedType ;
473471 }
474472
475- private resolveExpressionInContext (
476- expr : Expression ,
477- document : LangiumDocument < AstNode > ,
478- contextModel : DataModel ,
479- extraScopes : ScopeProvider [ ]
480- ) {
481- // Resolve the expression with the model context scope
482- this . resolve ( expr , document , extraScopes ) ;
483- }
484-
485473 private unresolvableRefExpr ( item : ReferenceExpr ) {
486474 const ref = item . target as DefaultReference ;
487475 ref . _ref = this . createLinkingError ( {
@@ -569,10 +557,6 @@ export class ZModelLinker extends DefaultLinker {
569557 //#region Utils
570558
571559 private resolveToDeclaredType ( node : AstNode , type : FunctionParamType | DataModelFieldType | TypeDefFieldType ) {
572- // enums from alias expressions are already resolved and do not exist in the scope
573- if ( ! type ) {
574- return ;
575- }
576560 let nullable = false ;
577561 if ( isDataModelFieldType ( type ) || isTypeDefField ( type ) ) {
578562 nullable = type . optional ;
0 commit comments