Skip to content

number | vector type errors on multiplication with number #2957

Description

@nnullcolumn
local a: number
local b: vector
local c: number | vector

-- number * vector / vector * number fine
print(a * b, b * a)


-- i would expect this not to type error:
--   Expected this to be 'number', but got 'number | vector'; 
--   `vector` is not a subtype of `number`
print(c * a, a * c)

-- no type error on 'number | vector' * 'vector'
print(c * b, b * c)

https://play.luau.org/#N4IgbiBcBMA0IDMqgE4FMAOKD2A6ANgK4CGhUI+2AxsfgATGR0B2hAtgEZooA6zlNehyZg0VAC7Ze-arTpUmrTtzoAfOqIlS+fALS6W7LijoAqDWMkmA9Ba0nzS43QQBLZmj5Z34gBTEzOg5YIMDiAEodZj0DVzoAd2xCfAATOjQADwxLOnEAC1cAZxZscVzsXIBPbPSUHBRIGLpmgFEsyzQ0-KLyoLQ6AHInbgGQjkIygHNSweGTdU0rAYBuOibmgANFqQ26HuYZgMLCDnFq-uwEOg25ja8UH18qMJCA8ypI6OZ9Eqqa7nqdGwzFmRhUC0sUgGgQG2xQA3uj2e5mCoXenxAAF94IVkCBsBhxK42K4AF7EInAgAyaFE+CgcBAVGwbAwrnw3AASmg2MQUABrXGQcQoQhoTGYoA

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

    analysisThis is an issue related to type inferencebugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions