Skip to content

macroexp methods on union types are miscompiled #1134

Description

@purplesyringa
local record I1
    where true -- imagine a real condition here
    method: function(self) = macroexp(self: I1): boolean
        return false
    end
end
local record I2
    where true
    method: function(self) = macroexp(self: I1): boolean
        return true
    end
end

local function f(x: I1 | I2): boolean
    return x:method()
end

...compiles to:

local function f(x)
   return false
end

I believe calling macroexp methods on union types should be forbidden.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsemanticsUnexpected or unsound behaviors

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions