edubart / nelua-lang

Minimal, efficient, statically-typed and meta-programmable systems programming language heavily inspired by Lua, which compiles to C and native code.
https://nelua.io
MIT License
1.99k stars 64 forks source link

Compiler hangs when cgenerator.lua errors #260

Open distantforest1 opened 3 months ago

distantforest1 commented 3 months ago

Bug description

The compiler hangs when running the following example:

local RTest = @record {}

function RTest:run(a: auto) -- remove: `a: auto` to see the actual error
  ## if a.type.is_niltype then
    local a = 0
  ## end
  local x: sequence(integer)
  local y

  return x, y
end

local r: RTest
r:run()

Expected behavior

Error saying any type not supported yet or something to that effect. Currently it freezes, was tough to track down since I was working on a lot of code at once (porting code from lua).

Workaround

Explicitly putting the in the type.

Environment

Provide relevant information about your environment: Nelua 0.2.0-dev Build number: 1615 Git date: 2024-04-20 09:45:08 -0300 Git hash: 9f75e009db190feda0f90ae858b48fd82f51b8b1 Semantic version: 0.2.0-dev.1615+9f75e009 Copyright (C) 2019-2024 Eduardo Bart (https://nelua.io/)

Windows 10 x64