From 1c7d30ab77960be3a0c7ae259d601fa6aed640b3 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Mon, 24 Jun 2024 19:30:40 +0200 Subject: Add typechecking for structs and struct fields --- tests/semantics.bad | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/semantics.bad b/tests/semantics.bad index 486f6c0..a6810a9 100644 --- a/tests/semantics.bad +++ b/tests/semantics.bad @@ -8,7 +8,23 @@ enum weekdays { sun } let a = weekdays.tue -let b = a +; let b = a + +struct item { + id: int + name: str +} + +; let a: item = item { +; id = 1 +; } +; let a: item = item ; this shouldn't work, or should it return the default val? +let c: item +set c.id = "hi" +let d = c.id +; set a.name = "hello" +; let b = a.id +; let c = a.name ; fun add10(a: int, b: str): int { ; a + 10 -- cgit v1.2.1