Skip to content

Potential issue with two types using the same primitives #708

Description

@FourierTransformer

I'm trying to use Teal to have the concept of units, and while I can create my own new types based off of a number, however I'm allowed to still add those two different types together.

Here's an example:

local type Temperature = number
local type Day = number

local temp: Temperature = 45
local birthday: Day = 34

print(temp + birthday) -- doesn't report as an error or warning

I'm not exactly sure if this is a bug, but I feel like you should only be able to get away with this if you use as to have it be treated as a different type.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    semanticsUnexpected or unsound behaviors

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions