Skip to content

Commit ab63601

Browse files
authored
Add snapshot tests to stress inheritance (#137)
* Add snapshot tests to stress inheritance * Update PR auditor
1 parent 5949415 commit ab63601

File tree

3 files changed

+110
-1
lines changed

3 files changed

+110
-1
lines changed

.github/workflows/pr-auditor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- uses: actions/checkout@v3
1111
with: { repository: 'sourcegraph/sourcegraph' }
1212
- uses: actions/setup-go@v3
13-
with: { go-version: '1.17' }
13+
with: { go-version: '1.18' }
1414

1515
- run: ./dev/pr-auditor/check-pr.sh
1616
env:
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
export interface Superinterface {
2+
property: string
3+
interfaceMethod(): string
4+
}
5+
export abstract class Superclass {
6+
public abstract overrideMethod(): string
7+
}
8+
export abstract class IntermediateSuperclass extends Superclass {}
9+
export class Subclass extends IntermediateSuperclass implements Superinterface {
10+
property = 'property'
11+
public overrideMethod(): string {
12+
throw new Error('Method not implemented.')
13+
}
14+
public interfaceMethod(): string {
15+
throw new Error('Method not implemented.')
16+
}
17+
}
18+
export const objectLiteralImplementation: Superinterface = {
19+
property: 'property',
20+
interfaceMethod: (): string => {
21+
throw new Error('Function not implemented.')
22+
},
23+
}
24+
export function consumesInterface(superInterface: Superinterface): void {}
25+
export function infersInterface(): void {
26+
consumesInterface({
27+
interfaceMethod: (): string => 'inferred',
28+
property: 'inferred',
29+
})
30+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
export interface Superinterface {
2+
// ^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/Superinterface#
3+
// documentation ```ts\ninterface Superinterface\n```
4+
property: string
5+
// ^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/Superinterface#property.
6+
// documentation ```ts\n(property) property: string\n```
7+
interfaceMethod(): string
8+
// ^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/Superinterface#interfaceMethod().
9+
// documentation ```ts\n(method) interfaceMethod() => string\n```
10+
}
11+
export abstract class Superclass {
12+
// ^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/Superclass#
13+
// documentation ```ts\nclass Superclass\n```
14+
public abstract overrideMethod(): string
15+
// ^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/Superclass#overrideMethod().
16+
// documentation ```ts\n(method) overrideMethod(): string\n```
17+
}
18+
export abstract class IntermediateSuperclass extends Superclass {}
19+
// ^^^^^^^^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/IntermediateSuperclass#
20+
// documentation ```ts\nclass IntermediateSuperclass\n```
21+
// ^^^^^^^^^^ reference syntax 1.0.0 src/`inheritance.ts`/Superclass#
22+
export class Subclass extends IntermediateSuperclass implements Superinterface {
23+
// ^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/Subclass#
24+
// documentation ```ts\nclass Subclass\n```
25+
// ^^^^^^^^^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`inheritance.ts`/IntermediateSuperclass#
26+
// ^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`inheritance.ts`/Superinterface#
27+
property = 'property'
28+
// ^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/Subclass#property.
29+
// documentation ```ts\n(property) property: string\n```
30+
public overrideMethod(): string {
31+
// ^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/Subclass#overrideMethod().
32+
// documentation ```ts\n(method) overrideMethod(): string\n```
33+
throw new Error('Method not implemented.')
34+
// ^^^^^ reference typescript 4.6.2 lib/`lib.es5.d.ts`/Error#
35+
// ^^^^^ reference typescript 4.6.2 lib/`lib.es5.d.ts`/Error.
36+
}
37+
public interfaceMethod(): string {
38+
// ^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/Subclass#interfaceMethod().
39+
// documentation ```ts\n(method) interfaceMethod(): string\n```
40+
throw new Error('Method not implemented.')
41+
// ^^^^^ reference typescript 4.6.2 lib/`lib.es5.d.ts`/Error#
42+
// ^^^^^ reference typescript 4.6.2 lib/`lib.es5.d.ts`/Error.
43+
}
44+
}
45+
export const objectLiteralImplementation: Superinterface = {
46+
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/objectLiteralImplementation.
47+
// documentation ```ts\nvar objectLiteralImplementation: Superinterface\n```
48+
// ^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`inheritance.ts`/Superinterface#
49+
property: 'property',
50+
// ^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/property0:
51+
// documentation ```ts\n(property) property: string\n```
52+
interfaceMethod: (): string => {
53+
// ^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/interfaceMethod0:
54+
// documentation ```ts\n(property) interfaceMethod: () => string\n```
55+
throw new Error('Function not implemented.')
56+
// ^^^^^ reference typescript 4.6.2 lib/`lib.es5.d.ts`/Error#
57+
// ^^^^^ reference typescript 4.6.2 lib/`lib.es5.d.ts`/Error.
58+
},
59+
}
60+
export function consumesInterface(superInterface: Superinterface): void {}
61+
// ^^^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/consumesInterface().
62+
// documentation ```ts\nfunction consumesInterface(superInterface: Superinterface): void\n```
63+
// ^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/consumesInterface().(superInterface)
64+
// documentation ```ts\n(parameter) superInterface: Superinterface\n```
65+
// ^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`inheritance.ts`/Superinterface#
66+
export function infersInterface(): void {
67+
// ^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/infersInterface().
68+
// documentation ```ts\nfunction infersInterface(): void\n```
69+
consumesInterface({
70+
// ^^^^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`inheritance.ts`/consumesInterface().
71+
interfaceMethod: (): string => 'inferred',
72+
// ^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/interfaceMethod1:
73+
// documentation ```ts\n(property) interfaceMethod: () => string\n```
74+
property: 'inferred',
75+
// ^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/property1:
76+
// documentation ```ts\n(property) property: string\n```
77+
})
78+
}
79+

0 commit comments

Comments
 (0)