Skip to content

Some suggested corrections of the tests for the named-arguments-anywhere language features #1240

Closed
@chloestefantsova

Description

@chloestefantsova

Some of the tests for the named-arguments-anywhere language feature aren't passing. I looked into them, and I think the tests should be updated.

Test co19/LanguageFeatures/Named-arguments-anywhere/constructor_t08

In this test the error is due to class A having a default constructor instead of the one taking three arguments. I think it's just a typo, and if C is corrected to A in line 20, the test passes.

class A<T> {
String log = "";
C(T x, T y, {T? z}) {
log = "x=$x, y=$y, z=$z";
}
}

Test co19/LanguageFeatures/Named-arguments-anywhere/constructor_t06

I think the failure in this test is due to the typo too: in line 28 it should say T x (with the space) instead of Tx.

Test co19/LanguageFeatures/Named-arguments-anywhere/constructor_t02

The failures in this test are in the lines where the type argument is paced after the name of the named constructor. I think it should be a compile-time error indeed, and the argument should to after the name of the class and before the name of the constructor. CC-ing @eernstg to confirm.

Expect.equals("x=1, y=2, z=3", C.named<int>(1, 2, z: 3).log);
Expect.equals("x=1, y=2, z=3", C.named<int>(z: 3, 1, 2).log);
Expect.equals("x=1, y=2, z=3", C.named<int>(1, z: 3, 2).log);

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions