File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -689,6 +689,16 @@ export class Runtime {
689
689
} else if ( expr . operator == operators . subtract ) {
690
690
fail ( `Cannot subtract an enum value from a number` , expr ) ;
691
691
} else fail ( f . quote `Expected the expression "$rc" to evaluate to a value of type ${ guessedType } , but it returns an enum value` , expr . nodes [ 1 ] ) ;
692
+ } else if ( left . typeIs ( 'STRING' ) && right . typeIs ( 'STRING' ) ) {
693
+ fail ( {
694
+ summary : 'Invalid operand types' ,
695
+ elaboration : 'the addition operator (+) is used to add numbers' ,
696
+ help : [
697
+ 'use the string concatenation operator (&) to join strings' ,
698
+ ! isNaN ( Number ( left . value ) ) && ! isNaN ( Number ( right . value ) ) &&
699
+ 'to add the values of these strings, convert them to numbers using the STR_TO_NUM function' ,
700
+ ] . filter ( Boolean ) ,
701
+ } , expr . operatorToken , expr ) ;
692
702
} else {
693
703
left = coerceValue ( left . value , left . type , guessedType , expr . nodes [ 0 ] ) ;
694
704
right = coerceValue ( right . value , right . type , guessedType , expr . nodes [ 1 ] ) ;
You can’t perform that action at this time.
0 commit comments