# # Test application written in SLUL # # Copyright © 2021-2024 Samuel Lidén Borell # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # \slul 0.0.0 \name mainapp \depends somelib 0.12.3 \depends otherlib 3.0.1 \depends nesteddep 1.24 nestedonly \source comments.slul \source constexpr.slul \source datadefs.slul \source definedness.slul \source expressions.slul \source for_loops.slul \source funccalls.slul \source generics.slul \source return.slul \source statements.slul \source typecompat.slul \source typedefs.slul data int global = 123 func do_stuff(ref OtherClosedType ot) { var UseNestedDep und = ( .nested = ( .nestedvalue = 123, .nested_other = .external_constructor(true), ), ) und.nested.nestedvalue += 1 # Test of type-identifiers declared outside of the module of the type assert ot.external_method(123, false) var OtherClosedType ot2 = .external_constructor(456) var OtherClosedType ot3 = .external_data_typeident # Normal type-identifiers should still work ot2 = .constructor(789) assert ot2.method(1, false) ot3 = .data_typeident } func use_conflicting_type(ref var NameConflictInOtherlibV4 obj) { # This type exists in both otherlib v4 and in somelib # But we're using otherlib v3, so we're fine, # and this function should use the type and methods in somelib. obj.set(3, 5) assert obj.get_sum() == 8 ref NameConflictInOtherlibV4 obj1 = .get_default() } type ImplType = struct { int x int y } func SlulApp.main() -> SlulExitStatus { constexpr_test() datadefs_test() definedness_test() expressions_test() for_loops_test() funccalls_test() generics_test() return_test() statements_test() typecompat_test() own SomeThing st = make_some_thing() var int zero = 0 if global == zero return 2 else if global == zero+123 { } else return st.x free_some_thing(st) return 123 }