# # Implementation file of badlib # # Copyright © 2023-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. # # ERROR +2.53: error: Incompatible types. Arrays have mixed variable/non-variable lengths # ERROR .7: error: Identifier value is not known at compile-time data [external_value_ver]int typechk_array_extlen = [] func BadVersion1.some_private_function() -> bool { return true } func BadLibClosedType.some_private_function() -> bool { return this.x == 123 } func use_nestedonly_lib() { # ERROR .5: error: Identifier 'func_in_lib' does not exist func_in_lib() } func use_nestedonly_typeident() { # ERROR .18: error: ".local_constructor" does not exist in the target type accept_type(.local_constructor()) # ERROR .18: error: ".typeident1_constructor" does not exist in the target type accept_type(.typeident1_constructor()) # ERROR +2.24: error: ".from_different_type" does not exist in the target type # ERROR .24: hint: Regarding missing identifier 'from_different_type' in type 'DiffType': A type with the same name also exists in module 'with_typeident_diff1' var DiffType dt = .from_different_type } # The nestedonly flag for withtypeident3 applies to our interface only data NestedType use_iface_nestedonly = (.field = .nested_typeident_in_withtypeident3) func func_use_iface_nestedonly() { var NestedType use_iface_nestedonly = (.field = .nested_typeident_in_withtypeident3) } func use_conflicting_idents( # ERROR .17: error: Identifier 'Conflicting' is defined in more than one module ref var Conflicting confl_type, ref var PrivTypeVer confl_mth) { # ERROR +2.16: error: Method "method_a" does not exist in type "Conflicting" # ERROR .16: hint: Regarding missing identifier 'method_a' in type 'Conflicting': A type with the same name also exists in module 'conflict1' confl_type.method_a() # Should not give a hint like above # ERROR .16: error: Method "missing_method" does not exist in type "Conflicting" confl_type.missing_method() # ERROR .15: error: Type identifier 'conflicting_method' in 'PrivTypeVer' is defined in more than one module confl_mth.conflicting_method() } func use_unavailable_versions() { # 1.2 = the version specified as a dependency. # 2.0 = a chronologically earlier release with a higher (=unavailable) version number. # 0.9.1 = a chronologically later (=unavailable) release with a lower version number. # 2.1 = a relase that is both chronologically later and has a higher version number. # ERROR .9: error: Type 'TypeSince20' from module 'error_support_ver' isn't available in version 1.2. It was added in 2.0 ref TypeSince20 obj1 # ERROR .9: error: Type 'TypeSince091' from module 'error_support_ver' isn't available in version 1.2. It was added in a more recent (although lower) version 0.9.1 ref TypeSince091 obj2 # ERROR .5: error: Identifier 'func_since_20' from module 'error_support_ver' isn't available in version 1.2. It was added in 2.0 func_since_20(123) # ERROR .5: error: Identifier 'func_since_091' from module 'error_support_ver' isn't available in version 1.2. It was added in a more recent (although lower) version 0.9.1 func_since_091(123) # ERROR .13: error: Identifier 'external_value_since_20' from module 'error_support_ver' isn't available in version 1.2. It was added in 2.0 int x = external_value_since_20 # ERROR .13: error: Identifier 'external_value_since_091' from module 'error_support_ver' isn't available in version 1.2. It was added in a more recent (although lower) version 0.9.1 int y = external_value_since_091 var VersionedEnum enu enu = .a # ERROR .12: error: Identifier 'c_since091' in 'VersionedEnum' from module 'error_support_ver' isn't available in version 1.2. It was added in a more recent (although lower) version 0.9.1 enu = .c_since091 # ERROR .12: error: Identifier 'd_since21' in 'VersionedEnum' from module 'error_support_ver' isn't available in version 1.2. It was added in 2.1 enu = .d_since21 ref var VersionedStruct st = .defaults() st.a = 123 st.b = true # ERROR .8: error: Field 'c_since091' in 'VersionedStruct' from module 'error_support_ver' isn't available in version 1.2. It was added in a more recent (although lower) version 0.9.1 st.c_since091 = 456 # ERROR .8: error: Field 'd_since21' in 'VersionedStruct' from module 'error_support_ver' isn't available in version 1.2. It was added in 2.1 st.d_since21 = 789 # ERROR .33: error: Identifier 'defaults_20' in 'VersionedStruct' from module 'error_support_ver' isn't available in version 1.2. It was added in 2.0 ref VersionedStruct st20 = .defaults_20() # ERROR .34: error: Identifier 'defaults_091' in 'VersionedStruct' from module 'error_support_ver' isn't available in version 1.2. It was added in a more recent (although lower) version 0.9.1 ref VersionedStruct st091 = .defaults_091() }