Skip to content

[New Solver] fails to report type errors when using if-then-else expressions #1815

@OverHash

Description

@OverHash

Minimal repro:

--!strict
local item: "foo" = "bar" -- TypeError: Type '"bar"' could not be converted into '"foo"', good!
item = if true then "foo" else "foo" -- TypeError: Type 'string' could not be converted into '"foo"', bad!

local item2: "foo" = if true then "doge" else "doge2" -- no error, bad!

There's two issues here:

  1. On line 2, the solver expands from the singletons to the generic string type which causes assignment issues
  2. On line 4 (and the main title of this issue), the solver does not report any errors! Based on line 1, this should report an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnew solverThis issue is specific to the new solver.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions