Skip to content

Commit 4263420

Browse files
committed
Minor fixes, and make one more regression test case deterministic
1 parent d00fea8 commit 4263420

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

regression-tests/mixed-multiple-return-values.cpp2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ f: () -> (i: int, s: std::string) = {
88

99
i = 10;
1010

11-
if std::time(nullptr)%2 == 0 {
11+
if std::rand()%2 == 0 {
1212
s = "xyzzy";
1313
}
1414
else {
@@ -18,7 +18,7 @@ f: () -> (i: int, s: std::string) = {
1818
return;
1919
}
2020

21-
print: (name: std::string, value:_)
21+
print: (name: std::string, value:_)
2222
= std::cout << name << " is " << value << "\n";
2323

2424
int main() {

regression-tests/test-results/mixed-multiple-return-values.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ int main() {
3535

3636
i.construct(10);
3737

38-
if (std::time(nullptr) % 2 == 0) {
38+
if (std::rand() % 2 == 0) {
3939
s.construct("xyzzy");
4040
}
4141
else {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
a is 10
2-
b is xyzzy
2+
b is plugh

source/lex.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ auto lex_line(
449449
!is_identifier_continue(line[i+m[0].length()]) // non-identifier char
450450
)
451451
{
452-
return (int)(m[0].length());;
452+
return (int)(m[0].length());
453453
}
454454
}
455455
return 0;

source/sema.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ class sema
209209
public:
210210
std::vector<error>& errors;
211211
std::vector<symbol> symbols;
212-
std::vector<declaration_sym> partial_decl_stack;;
212+
std::vector<declaration_sym> partial_decl_stack;
213213

214214
std::vector<selection_statement_node const*> active_selections;
215215

@@ -544,7 +544,7 @@ class sema
544544
if (sym.start && sym.identifier && *sym.identifier == *id) {
545545
errors.emplace_back(
546546
sym.identifier->position(),
547-
"local variable" + sym.identifier->to_string(true)
547+
"local variable " + sym.identifier->to_string(true)
548548
+ " cannot have the same name as an uninitialized"
549549
" variable in the same function");
550550
}

0 commit comments

Comments
 (0)