rokucommunity / brighterscript

A superset of Roku's BrightScript language
MIT License
153 stars 47 forks source link

Adding string and number should be compile error #880

Closed TwitchBronBron closed 10 months ago

TwitchBronBron commented 11 months ago

With the new type validations in v0.66.0, this should be a compile error because you can't add a string and an int.

image

markwpearce commented 11 months ago

In scope validate’s ast walk, visit binaryOperator expressions, and if LHS and RHS are not dynamic type, and the util function that finds binary operator results return dynamic type, then raise a new diagnostic… Something like “Operator $operator can not be used with types $lhs and $rhs”

markwpearce commented 10 months ago

Solved in https://github.com/rokucommunity/brighterscript/commit/7cafaf12219dcfa73b3e0be04f7acba47b10f93a