feat: lifetime elision, tooling CI, registry, and LSP locals
Ship the QUALITY_PLAN stretch from ownership through ecosystem: C.1 lifetime elision (bootstrap + selfhost), bux fmt/test/doc CI hooks, stdlib goldens, package registry (bux search/add), and LSP 0.4 position-sensitive locals with inferred let types. Full-tree format pass plus Map/Set remove double-free fix.
This commit is contained in:
@@ -10,20 +10,20 @@ enum Result {
|
||||
func Main() -> int {
|
||||
let r1: Result = Result { tag: Result_Ok };
|
||||
r1.data.Ok_0 = 42;
|
||||
|
||||
|
||||
let r2: Result = Result { tag: Result_Err };
|
||||
r2.data.Err_0 = "error message";
|
||||
|
||||
|
||||
if r1.tag == Result_Ok {
|
||||
PrintLine("r1 is Ok:");
|
||||
PrintInt(r1.data.Ok_0);
|
||||
PrintLine("");
|
||||
}
|
||||
|
||||
|
||||
if r2.tag == Result_Err {
|
||||
PrintLine("r2 is Err:");
|
||||
PrintLine(r2.data.Err_0);
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -23,12 +23,12 @@ func ColorName(c: Color) -> String {
|
||||
|
||||
func Main() -> int {
|
||||
let myColor: Color = Color::Green;
|
||||
|
||||
|
||||
PrintLine("My color is:");
|
||||
PrintLine(ColorName(myColor));
|
||||
PrintLine("Color value:");
|
||||
PrintInt(myColor as int);
|
||||
PrintLine("");
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -11,13 +11,13 @@ func Fibonacci(n: int) -> int {
|
||||
|
||||
func Main() -> int {
|
||||
PrintLine("Fibonacci sequence:");
|
||||
|
||||
|
||||
var i: int = 0;
|
||||
while i < 10 {
|
||||
let fib: int = Fibonacci(i);
|
||||
PrintLine(Fmt_Fmt1("{0}", String_FromInt(fib)));
|
||||
i = i + 1;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -13,14 +13,14 @@ func Max<T>(a: T, b: T) -> T {
|
||||
func Main() -> int {
|
||||
let m1: int = Max<int>(10, 20);
|
||||
let m2: int = Max<int>(5, 3);
|
||||
|
||||
|
||||
PrintLine("Max(10, 20) = ");
|
||||
PrintInt(m1);
|
||||
PrintLine("");
|
||||
|
||||
|
||||
PrintLine("Max(5, 3) = ");
|
||||
PrintInt(m2);
|
||||
PrintLine("");
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ extend Rectangle {
|
||||
func Area(self: Rectangle) -> int {
|
||||
return self.width * self.height;
|
||||
}
|
||||
|
||||
|
||||
func Perimeter(self: Rectangle) -> int {
|
||||
return 2 * (self.width + self.height);
|
||||
}
|
||||
@@ -19,7 +19,7 @@ extend Rectangle {
|
||||
|
||||
func Main() -> int {
|
||||
let rect: Rectangle = Rectangle { width: 10, height: 5 };
|
||||
|
||||
|
||||
PrintLine("Rectangle:");
|
||||
PrintLine("Width = ");
|
||||
PrintInt(rect.width);
|
||||
@@ -33,6 +33,6 @@ func Main() -> int {
|
||||
PrintLine("Perimeter = ");
|
||||
PrintInt(rect.Perimeter());
|
||||
PrintLine("");
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,49 +1,49 @@
|
||||
module Main {
|
||||
|
||||
import Std::Array::{Array, Array_New, Array_Push};
|
||||
import Std::Array::{Array, Array_New, Array_Push};
|
||||
|
||||
struct Record {
|
||||
name: String;
|
||||
value: int;
|
||||
}
|
||||
|
||||
struct Box {
|
||||
items: Array<Record>;
|
||||
}
|
||||
|
||||
enum Payload {
|
||||
Ok(Record),
|
||||
Err(String),
|
||||
}
|
||||
|
||||
enum Color { Red, Green }
|
||||
|
||||
func Name(c: Color) -> String {
|
||||
match c {
|
||||
Color::Red => "red",
|
||||
Color::Green => "green",
|
||||
struct Record {
|
||||
name: String;
|
||||
value: int;
|
||||
}
|
||||
}
|
||||
|
||||
func Main() -> int {
|
||||
var box: Box;
|
||||
box.items = Array_New<Record>(4);
|
||||
Array_Push<Record>(&box.items, Record { name: "x", value: 10 });
|
||||
struct Box {
|
||||
items: Array<Record>;
|
||||
}
|
||||
|
||||
for it in box.items {
|
||||
if it.value == 10 {
|
||||
return 0;
|
||||
enum Payload {
|
||||
Ok(Record),
|
||||
Err(String),
|
||||
}
|
||||
|
||||
enum Color { Red, Green }
|
||||
|
||||
func Name(c: Color) -> String {
|
||||
match c {
|
||||
Color::Red => "red",
|
||||
Color::Green => "green",
|
||||
}
|
||||
}
|
||||
|
||||
var r: Payload;
|
||||
r.tag = Payload_Ok;
|
||||
r.data.Ok_0 = Record { name: "y", value: 20 };
|
||||
if r.data.Ok_0.value == 20 {
|
||||
return 0;
|
||||
func Main() -> int {
|
||||
var box: Box;
|
||||
box.items = Array_New<Record>(4);
|
||||
Array_Push<Record>(&box.items, Record { name: "x", value: 10 });
|
||||
|
||||
for it in box.items {
|
||||
if it.value == 10 {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
var r: Payload;
|
||||
r.tag = Payload_Ok;
|
||||
r.data.Ok_0 = Record { name: "y", value: 20 };
|
||||
if r.data.Ok_0.value == 20 {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,30 +5,30 @@ import Std::String::{String_Len, String_Eq, String_Concat};
|
||||
func Main() -> int {
|
||||
let hello: String = "Hello";
|
||||
let world: String = "World";
|
||||
|
||||
|
||||
PrintLine("String operations:");
|
||||
|
||||
|
||||
// Length
|
||||
PrintLine("Length of 'Hello':");
|
||||
PrintInt(String_Len(hello));
|
||||
PrintLine("");
|
||||
|
||||
|
||||
// Concatenation
|
||||
let greeting: String = String_Concat(hello, ", ");
|
||||
let greeting2: String = String_Concat(greeting, world);
|
||||
let full: String = String_Concat(greeting2, "!");
|
||||
|
||||
|
||||
PrintLine("Concatenated:");
|
||||
PrintLine(full);
|
||||
|
||||
|
||||
// Equality
|
||||
if String_Eq(hello, "Hello") {
|
||||
PrintLine("'Hello' equals 'Hello'");
|
||||
}
|
||||
|
||||
|
||||
if !String_Eq(hello, world) {
|
||||
PrintLine("'Hello' does not equal 'World'");
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ func Main() -> int {
|
||||
let p1: Point = Point { x: 10, y: 20 };
|
||||
let p2: Point = Point { x: 5, y: 15 };
|
||||
let sum: Point = AddPoints(p1, p2);
|
||||
|
||||
|
||||
PrintLine("Point sum:");
|
||||
PrintLine("x = ");
|
||||
PrintInt(sum.x);
|
||||
@@ -24,6 +24,6 @@ func Main() -> int {
|
||||
PrintLine("y = ");
|
||||
PrintInt(sum.y);
|
||||
PrintLine("");
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user