Changelog
All notable changes to Nebra are listed here, newest first. Entries under Breaking can make code that compiled before report errors; they are listed first so you can check them before upgrading.
0.5.24 (2026-11-10)
Breaking
- An import of a module that runs on a side the importing file does not run on is an error under
[sides], as it would fail at runtime on that side.import typestays allowed. (#231) - The variables of
for ... in ipairs(t)andpairs(t)take the types oft, and values declared before a class are checked inside its fields, constructors and methods. Both wereany, so code that was wrong can now report errors. (#236, #232) nebra buildremoves what earlier builds left in the output directory;--no-cleankeeps it. A directory that is not one of its own, such as the project root or one containing the sources, is left alone with a warning. (#230)
Added
- Runtime errors of
nebra runand failures ofnebra test, tracebacks included, name the.nebfile and line instead of the generated Lua. (#238) source_maps = truewrites a.lua.mapnext to every generated file, mapping its lines to the.nebsource, so a host can translate tracebacks. (#229)- Parameters of function types can be named, in any number:
(entity: number, value: string?) -> nil. (#237) contractdeclares a strict interface: a table with any other field is a type error, and fields can carry the rules@range,@integer,@length,@nonEmptyand@pattern, checked for literals at compile time and byisandmatchat runtime. (#234)
Fixed
- A method without a return type takes it from its body, like a function does, instead of reporting its
returnas returning a value from a function that returnsnil. (#235) - Classes, interfaces and enums of one name in different files are different types. They used to be merged, so the members of one were accepted on the other, even with an explicit import. (#233)
0.5.23 (2026-11-09)
Added
import "models/*.neb"imports every matching file, like one side-effect import per file;**reaches nested directories. (#228)- Completion and the import quick fix offer the exports of installed packages from
nebra_modules/, asimport { Model } from "nanos-orm", and the types of the other modules of aruntime_globalpackage throughimport type. (#227)
Fixed
- The exports of other files are completed from the start of a word. A request sent before its first letter, such as after a space, left them out, and editors kept filtering that list, so they never appeared. (#227)
- The import quick fix finds every exported declaration, such as
export abstract class, and no longer suggests a file that only mentions the name in anexport localline. Adding a name no longer merges it into animport typeorexport { } fromline. (#227)
0.5.22 (2026-11-09)
Added
operator []andoperator []=work on classes created through@overrideInheritwhen the annotation names the methods of the host withindexandnewindex, so in nanos world they run as theindexandnewindexhooks of an inherited class. (#225)- The builtin annotation
@overrideIs("template")lets a class decide howis,instanceofand type patterns test against it and the classes extending it, which in nanos world go throughIsA. (#225)
0.5.21 (2026-11-09)
Added
- The builtin annotation
@overrideInherit("template")lets a declared class decide how classes extending it are created, for hosts with their own inheritance: such a class is created through the template, constructs throughConstructor, reaches the host throughself.Superand is spawned like its base. With it,class Crate extends Propworks in nanos world throughProp.Inherit. (#224)
0.5.20 (2026-11-05)
Fixed
- Completion works in Zed and other clients that require a title on every command: functions completed as a call no longer send their command without one, which made Zed drop the whole list. (#223)
0.5.19 (2026-10-29)
Added
- The utility types
Partial,Required,PickandOmitare declared in the standard library with the newdeclare type Name<T>form, so they are completed, hovered and documented. (#221) - Completion knows where a type is written: after
:,->,extends,implements,keyof,asandis, inside type arguments, unions and function types it offers only types andkeyof, and completes a generic type with its type argument list. (#221) - The keys of
Pick<User, |>,Omit<User, |>andUser[|]complete as the field names ofUser, and a value whose type takes literals, such askeyof Eventsor"fill" | "line", completes with those literals first, also inside a string being typed. (#221) - The code between the braces of an interpolated string is highlighted like code, and completes values, members and the keywords an expression can use; the text around it completes nothing. (#222)
Fixed
- Hover, go to definition and diagnostics find the code inside an interpolated string, which used to be placed at the start of the file. (#222)
sealed,keyof,try,catchandfinallyare highlighted as keywords, also after a:in a type annotation, while a keyword used as a member name, such aspromise:catch(...), is highlighted as a plain name. (#219)- A file of the standard library opened from the compiler's sources, such as
stdlib/test.d.neb, takes the place of its embedded copy instead of declaring its names twice, and hovering adeclare moduleshows the module with its members. (#220)
0.5.18 (2026-10-28)
Added
function a.b(...)takes the types of unannotated parameters from the fieldb, like an assignment of a function literal does, sofunction love.update(dt)typesdt. (#215)
Fixed
- A package published since the registry index was cached is found right away: a name the cached index does not have refreshes it. (#217)
function T:method(...)declaresself, typed asT, and takes the types of its parameters from the membermethodofT; a parameter named like a type no longer hides the type in its annotation; a declared class needs nosuper()call. (#216)- An overload taking a union of literals, such as
mode: "fill" | "line", is picked for a literal argument, and a call no overload takes is reported with the overloads there are. (#214)
0.5.17 (2026-10-28)
Added
- A
declare interfacewhose name is already declared as an interface adds its members to it, so a declaration file can extend an interface another one declares, such as the standard library'sMathLib. (#213)
Fixed
- A missing member of an interface or enum is reported as such instead of as a type that cannot be indexed. (#213)
0.5.16 (2026-10-28)
Breaking
try,catchandfinallyare keywords and can no longer name a variable or function; they still work as member names, such aspromise:catch(...). (#181)
Added
- Utility types
Partial<T>,Required<T>,Pick<T, K>andOmit<T, K>make a struct type from the fields of a struct, class or interface. (#210) - Completion puts what fits the expected type first: the members of an expected enum as the shorthand, then values and functions of that type, in an annotated local, an argument, an assignment, a
return, a comparison, amatchcase and a field or element of a table literal. (#211) target = "luajit"is accepted as another name for"jit". (#209)try ... catch (err) ... finally ... end. Areturninsidetryorcatchreturns from the enclosing function,trywithoutcatchraises the error again afterfinally, and a baretry ... endignores it. (#181)- A member of an enum may be written without the enum where a value of that enum is expected:
local color: Color = Red, as an argument, in an assignment, areturn, a comparison, amatchcase or a table field. (#165) - A class may declare several constructors with different parameter types.
newandsuper(...)pick the one the arguments fit, at compile time where it is known and throughnewat runtime otherwise. (#182)
Fixed
- An empty table literal fits a struct type whose fields are all optional, and a missing field of a struct is reported with the fields it has. (#210)
- A half-written
caseof amatchno longer drops the whole file from the language server, which left it without completion, hover and diagnostics. (#211) - A
nebra.tomlthat cannot be read, such as one with an unknowntarget, stops the build instead of building with every setting at its default. (#209)
0.5.15 (2026-10-27)
Breaking
- The members of a generic class or interface now have the type arguments of the instantiation they are used through, so a mismatch such as
local name: string = new Box(1).valueis an error where the erasedTlet it pass before. (#204)
Added
- Generic classes and interfaces are fully substituted: each instantiation such as
Box<number>has its type arguments filled into its fields, methods, getters, operators, base class and interfaces,newinfers them from the constructor's arguments, and an instantiation fits another of the same class when its type arguments do. (#204) isandinstanceofagainst an instantiation, such asvalue is Box<number>, compare the type arguments at runtime. A generic class without type arguments,value is Box, matches every instantiation. (#204)- Generated declaration files keep type parameters with their bounds and the type arguments of
extendsandimplements. (#203) - Literal types such as
"fast" | "slow",1 | 2andtrue,keyof Tand indexed access typesT[K], so an event map types each callback by the name it is registered under. Interface and struct fields may be named by a string such as"user:login". (#206) - A function literal without parameter annotations takes its parameter types from the function type it is passed or assigned to. (#207)
Fixed
- A generic method implementing a generic interface method is compared with it key by key, a union fits a union holding each of its members, and errors in code an annotation generates point at the annotation. (#208)
nebra testno longer hangs when a test directory contains a link back to the project, such as a fixture'snebra_modules/linking to the package it tests. The CLI walks directories like the language server does, without following directory links or enteringnebra_modules/, and test discovery skips nested projects that have their ownnebra.toml. (#205)
0.5.14 (2026-10-27)
Breaking
- A generic class or interface used without its type arguments, such as
Boxinstead ofBox<number>, is an error, in annotations as well as inextendsandimplements. (#190) - Inside the body of a generic function, class, method or interface default, a type parameter only accepts a value of itself and fits only what its bounds fit, so
local value: T = 0ora + bon unboundedTvalues are errors. Call sites still infer type parameters as before. (#177) - Member names Nebra reserves are errors: the metamethods
operatordeclares (__add,__eq,__len, ...),__index,__newindex,__name,__interfaces,__metatableand names starting with__nebra,__get_,__set_,__op_or__ext_.__tostring,__close,__gc,__pairsand__callstay allowed. (#198, #187) - A class written in Nebra, its constructor and its methods cannot be replaced from outside (
A = ...,function A.new() end). (#201) - A second constructor in a class is an error instead of silently replacing the first. (#185)
super()outside a derived class's constructor is an error instead of producing invalid Lua. (#194)- Two unrelated interface defaults for the same method must be resolved by overriding it in the class. (#188)
- Operators, constructors and getters/setters cannot declare type parameters, and operators other than
()cannot declare several return values. (#199, #200) - A getter takes no parameters, a setter exactly one, and a property with only a setter cannot be read. (#177)
Added
- Code that runs while a file loads and reaches a class, function or
extendblock defined further down the same file is an error, includingclass B extends AaboveA, which leftBwithoutA's methods. (#154) - Under
strict_nil, an instance field whose type does not allow nil must be initialized by a default value or on every path of the constructor. (#186) sealed classprevents a class from being extended. (#180)local constructorlimits creating instances to the class itself, for factories and singletons. (#173)- A warning for an extension that is never used because the extended type has a member of the same name. (#189)
Changed
- Expressions made only of literals are computed while compiling and written as their result, with Lua's integer and float semantics. (#19)
- A derived class whose constructor only creates the base instance compiles to a single
return setmetatable(Base.new(...), Class), and...is forwarded only when the inherited constructor takes parameters. (#195) - A subclass copies only the metamethods its base classes actually declare; the copying loop is left out when there are none. (#192)
Fixed
- A subclass keeps
__tostring,__call,__closeand__pairsdeclared as methods on its base class; before, only operator metamethods were carried over. (#192) - The named varargs example in the documentation uses the named parameter. (#169)
- Warnings of a successful build are printed. (#202)
- A constructor ending in varargs accepts any number of further arguments. (#197)
- Loop variables take the types the iterator returns, so
for _, v in next, valuesno longer typesvas possibly nil. (#171) - A table keyed by numbers, such as
{ [1] = n }, fits an array type. (#179)
0.5.13 (2026-10-25)
Fixed
- Packages from a repository subdirectory are installed without the subdirectory's prefix and under a store path of their own, so their
nebra.tomland dependencies are read again. (#164)
0.5.12 (2026-10-25)
Fixed
- A class operator picks the overload whose parameter takes the right operand, and reports operands no overload takes. (#162)
- A class operator taking a string wins over string concatenation, in type checking and in the generated Lua. (#163)
0.5.11 (2026-10-25)
Added
- Index, index assignment and call operators (
operator [],operator []=,operator ()) for classes and extensions. (#158)
Fixed
- An optional function type no longer shares its key with a function returning an optional value, which crashed the compiler. (#160)
- Table literals fit struct types and interfaces by their fields; fields typed
T?may be left out. (#161) - A subclass with getters but no constructor of its own keeps its getters and inherited methods. (#159)
0.5.10 (2026-10-20)
Breaking
..between two numbers is an inclusive range instead of a concatenation;1.is no longer a number literal. (#153)- Extensions are local to their module;
export extendshares them with importing modules. (#149)
Added
- Getters, operators and
export extendfor type extensions, and member access on number literals such as1.hour. (#149)
Fixed
- Overloads of the same arity are told apart by their parameter types, the known overload is called directly, and duplicate signatures are reported. (#150, #151, #152)
0.5.9 (2026-10-17)
Added
super:method()calls the overridden method of the base class. (#148)- Type arguments of generic calls are inferred, and bounded type parameters get the members of their bounds. (#145)
nebra publish,unpublish,scopeandloginfor the package registry. (#135, #136, #137)import_path = "root"writes imports of own modules as their path from the output root. (#133)- Packages load through a runtime global, and
export { ... } fromre-exports names. (#127) - Type imports may form cycles, top-level classes and local functions are hoisted, and loops iterate values through their
iterator()method. (#124, #125, #126, #130) nebra createfrom local setup scripts and template directories.
Fixed
deferworks like Go: arguments are evaluated when reached, each loop pass defers its own call and deferred calls run on errors. (#134)- Local dependencies skip links, nested projects and build output when hashed and loaded. (#146, #147)
- Further fixes for map types, method scopes, deep annotation targets, keyword method names, syntax errors in imported modules,
whilenarrowing, empty table arguments,fromandoperatoras contextual keywords, untyped locals, class annotations and async errors. (#122–#144)