aboutsummaryrefslogtreecommitdiffhomepage
path: root/errortest/badlib/main.slul
blob: 211f8c58639fac1f4b240185dadafbf8bd1029fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146

#
# Invalid SLUL library with errors, for test purposes
#
# Copyright © 2023-2024 Samuel Lidén Borell <samuel@kodafritt.se>
#
# 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 badlib
\type library
\version 0.2.0
\depends error_support_unver 1.0 unstable_api
\depends with_func 1.0 nestedonly
\depends with_typeident3 1.0
\depends with_type_diff2 1.0
\depends conflict1 1.1
\depends conflict2 1.1
\interface_depends use_nested 1.0 since 0.1.0
\interface_depends use_unavailable_versions 1.0 since 0.1.0
\interface_depends with_type 1.0 nestedonly since 0.1.0
\interface_depends with_type_diff1 1.0 nestedonly since 0.1.0
\interface_depends with_typeident1 1.0 nestedonly since 0.1.0
\interface_depends with_typeident3 1.0 nestedonly since 0.1.0
\interface_depends with_typeident_diff1 1.0 since 0.1.0
\interface_depends error_support_ver 1.2 since 0.1.1
\api_def 0.1.0
\api_def 0.1.1
\api_def 0.2.0
\api_def 0.1.1.1

\source versioned_impls.slul


since 0.1.0
type UseNestedOnly = struct {
    # ERROR .9: error: Type 'TypeInLib' does not exist
    ref TypeInLib thing
}

since 0.1.0
data int use_nested1 = externaltype_value.x
since 0.1.0
data NestedType use_nested2 = (.field = .nested_typeident_in_usenested)
since 0.1.0
data NestedType use_nested3 = (.field = .nested_typeident_onehidden)
# This typeident is in module "with_typeident3", which is nestedonly
# ERROR +2.42: error: ".nested_typeident_in_withtypeident3" does not exist in the target type
since 0.1.0
data NestedType use_nested4 = (.field = .nested_typeident_in_withtypeident3)

since 0.1.0
type BadVersion1 = struct {
    int x
    since 0.1.1
    int y
    # ERROR .5: error: All struct/enum members after a versioned one must also be versioned
    int z
}

since 0.1.0
type BadVersion2 = struct {
    int x
    since 0.1.1.1
    int y
    # ERROR .5: error: struct/enum members do not come in chronological version order
    since 0.1.1
    int z
}

since 0.1.1
type BadVersion3 = struct {
    struct {
        int x
        # ERROR .9: error: "since" cannot appear in nested types
        since 0.1.1.1
        int y
    } nested
}

since 0.1.1
type BadVersion4 = closed struct {
    int x
    # ERROR .5: error: closed types cannot have since-versions inside
    since 0.1.1.1
    int y
}

since 0.1.0
type BadLibClosedType = closed struct {
    int x
}

# ERROR .8: error: since {} must contain at least one version
since {}
data int bad_versioned_data = 123

# ERROR +2.7: error: Identifier value is not known at compile-time
since 0.1.1
data [external_value_ver]int typechk_array_extlen

# ERROR +2.7: error: No implementation of 'missing_funcimpl_typeident_class' found in \source files (class 'BadVersion4' does not exist there)
since 0.1.0
func .missing_funcimpl_typeident_class() -> BadVersion4
# ERROR +2.7: error: No implementation of 'missing_funcimpl_typeident' found in \source files
since 0.1.0
func .missing_funcimpl_typeident() -> ref BadVersion1
# ERROR +2.18: error: No implementation of 'missing_funcimpl_class' found in \source files (class 'BadVersion4' does not exist there)
since 0.1.0
func BadVersion4.missing_funcimpl_class() -> bool
# ERROR +2.18: error: No implementation of 'missing_funcimpl' found in \source files
since 0.1.0
func BadVersion1.missing_funcimpl() -> bool

# ERROR +2.19: error: No implementation of 'missing_dataimpl_class' found in \source files (class 'BadVersion4' does not exist there)
since 0.1.0
data BadVersion4 .missing_dataimpl_class
# ERROR +2.24: error: No implementation of 'missing_dataimpl' found in \source files
since 0.1.0
data BadLibClosedType .missing_dataimpl

# ERROR .2: error: Top-levels should start at column 1 on a new line
 since 0.1.0
type IndentedSinceVer = bool


# TODO add error checks for items that refer to future versions

# ERROR .12: error: Unexpected end of file
since 0.1.0