Skip to content

Commit a996fe6

Browse files
committed
fix(jsii-diff): renaming a positional argument is a breaking change in Python
Related: #2927
1 parent a63b2e8 commit a996fe6

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { expectError } from './util';
2+
3+
// ----------------------------------------------------------------------
4+
5+
test.each([
6+
['class', 'constructor'],
7+
['class', 'method'],
8+
['interface', 'method'],
9+
])(
10+
'not okay to rename a positional parameter',
11+
(scope, decl) =>
12+
expectError(
13+
/positional parameter was renamed from 'previous' to 'current'/,
14+
// Note: name is ITest so we're good for both class & interface... Yes, this is ugly.
15+
`
16+
export ${scope} ITest {
17+
${decl}(previous: any)${decl === 'constructor' ? '' : ': void'}${scope === 'class' ? ' { previous.use(); }' : ';'}
18+
}`,
19+
`
20+
export ${scope} ITest {
21+
${decl}(current: any)${decl === 'constructor' ? '' : ': void'}${scope === 'class' ? ' { current.use(); }' : ';'}
22+
}`,
23+
),
24+
);

0 commit comments

Comments
 (0)