From 16fb30950e94b22208a998a6c0df433bdfc757d7 Mon Sep 17 00:00:00 2001 From: Michael Gerhold Date: Thu, 16 Nov 2023 16:02:35 +0100 Subject: [PATCH] extended generics test --- test/generics.las | 20 ++++++++++++++++++++ test/generics_expected.txt | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/test/generics.las b/test/generics.las index 5dbfeea..3e86662 100644 --- a/test/generics.las +++ b/test/generics.las @@ -36,3 +36,23 @@ function f(n: I32) { let words = ["a", "b"]; f(words.size); + +struct GenericStruct { + number: I32, + value: ?, +} + +struct Person { + name: String, + age: I32, +} + +let s = new GenericStruct{ + number: 42, + value: new Person{ + name: "Claus Kleber", + age: 67, + } +}; + +println(s); \ No newline at end of file diff --git a/test/generics_expected.txt b/test/generics_expected.txt index 4204900..80d8797 100644 --- a/test/generics_expected.txt +++ b/test/generics_expected.txt @@ -3,4 +3,5 @@ test:sentence:with:words [1, 2, 3] <-> [4, 5, 6] <-> [7, 8, 9] 3 Hello, World! -The answer is 42 \ No newline at end of file +The answer is 42 +struct GenericStruct(number: 42, value: struct Person(name: Claus Kleber, age: 67)) \ No newline at end of file