Skip to content

Commit 8c42de8

Browse files
committed
Update tests
1 parent af265da commit 8c42de8

File tree

2 files changed

+29
-20
lines changed

2 files changed

+29
-20
lines changed

source/compiler/tests/class_specifiers_p2.meta

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
class_specifiers_p2.pwn(4) : error 042: invalid combination of class specifiers
55
class_specifiers_p2.pwn(7) : error 042: invalid combination of class specifiers
66
class_specifiers_p2.pwn(11) : error 010: invalid function or declaration
7-
class_specifiers_p2.pwn(16) : error 025: function heading differs from prototype
8-
class_specifiers_p2.pwn(25) : error 025: function heading differs from prototype
9-
class_specifiers_p2.pwn(26) : error 025: function heading differs from prototype
7+
class_specifiers_p2.pwn(29) : error 042: invalid combination of class specifiers
8+
class_specifiers_p2.pwn(30) : error 042: invalid combination of class specifiers
9+
class_specifiers_p2.pwn(35) : error 025: function heading differs from prototype
10+
class_specifiers_p2.pwn(36) : error 025: function heading differs from prototype
1011
"""
1112
}

source/compiler/tests/class_specifiers_p2.pwn

+25-17
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,34 @@ forward Tag:[2] static stock Func(); // error 010: invalid function or declarat
1212
forward static stock Tag:[2] Func2(); // OK
1313

1414
forward Func3();
15-
public Func3(); // class specifier "public" is introduced; it will be required in the definition
16-
Func3(){} // error 025: function heading differs from prototype
15+
stock Func3(); // class specifier "stock" is added
16+
Func3(){} // OK (the function is implicitly defined as "stock")
1717

18-
static Func4(); // class specifier "static" is introduced
19-
forward Func4(); // OK (class specifiers are only mandatory in function definitions, not declarations)
20-
static Func4(){} // OK (class specifier "static" is in place)
18+
forward Func4();
19+
public Func4(); // class specifier "public" is added
20+
Func4(){} // OK (the function is implicitly defined as "public")
2121

22-
stock Func5(){} // Func5() is "finalized"; subsequent forward declarations
23-
// for this function can't introduce specifiers "static" and "public"
24-
forward stock Func5(); // OK (no new class specifiers)
25-
forward static stock Func5(); // error 025: function heading differs from prototype
26-
static stock Func5(); // error 025: function heading differs from prototype
22+
forward Func5();
23+
static Func5(); // class specifier "static" is added
24+
Func5(){} // OK (the function is implicitly defined as "static")
25+
26+
// Func6() is declared as "static", so any subsequent re-declarations
27+
// of this function with specifier "public" should be treated as errors
28+
forward static Func6();
29+
forward public Func6(); // error 025: function heading differs from prototype
30+
public Func6(){} // error 025: function heading differs from prototype
2731

28-
Func6(){}
29-
forward stock Func6(); // OK (specifier "stock" can be introduced after the definition)
32+
stock Func7(){} // Func4() is "finalized"; subsequent forward declarations
33+
// for this function can't introduce specifiers "static" and "public"
34+
forward stock Func7(); // OK (no new class specifiers)
35+
forward static stock Func7(); // error 025: function heading differs from prototype
36+
static stock Func7(); // error 025: function heading differs from prototype
3037

31-
forward stock Func7(); // specifier "stock" is introduced, but it's not mandatory to use it
32-
// in the function definition
33-
Func7(){} // OK
38+
// Func8() is "finalized", but specifier "stock" can be added even after the definition,
39+
// as it doesn't affect code generation (it only disables warning 203 for the function)
40+
Func8(){}
41+
forward stock Func8(); // OK
3442

35-
#pragma unused Func4, Func5, Func6, Func7
43+
#pragma unused Func3, Func5, Func7, Func8
3644

37-
main(){}
45+
main(){}

0 commit comments

Comments
 (0)