Skip to content

Commit

Permalink
test: fix linker compliance tests after not running for a while (angu…
Browse files Browse the repository at this point in the history
…lar#53571)

The linker compliance tests did not run for a while. There were a couple
of new tests that were not passing as this wasn't flagged on CI. This commit fixes this.
Fortunately there was no problematic code that did indicate issues with linking.

In the follow-up commit, we fix the compliance test infrastructure to
re-enable linker testing..

One clear issue is still that the defer blocks are not handled properly
in linked output- hence making defer not actually "lazy" for compiled
libraries. This needs to be handled separately by the framework team.

PR Close angular#53571
  • Loading branch information
devversion authored and amilamen committed Jan 26, 2024
1 parent 74bbb57 commit 8d80524
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ FooModule.ɵinj = /*@__PURE__*/ $i0$.ɵɵdefineInjector({});
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FooModule, [{
type: NgModule,
args: [{ declarations: [FooComponent, BarDirective, QuxPipe], bootstrap: [FooComponent] }]
}], null, null)
}], null, null);
})();
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ export function provideModule() {
return { ngModule: ForwardModule };
}
class TestModule {}
export class TestModule {}
TestModule.ɵfac = function TestModule_Factory(t) { return new (t || TestModule)(); };
TestModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: TestModule, imports: function () { return [ForwardModule]; } });
TestModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: TestModule, imports: () => [ForwardModule] });
TestModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [provideModule()] });
export { TestModule };
class ForwardModule {}
export class ForwardModule {}
ForwardModule.ɵfac = function ForwardModule_Factory(t) { return new (t || ForwardModule)(); };
ForwardModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: ForwardModule });
ForwardModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
export { ForwardModule };
ForwardModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
class AModule {}
export class AModule {}
AModule.ɵfac = function AModule_Factory(t) { return new (t || AModule)(); };
AModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: AModule, declarations: [A1Component, A2Component], exports: [A1Component, A2Component] });
AModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
export { AModule };
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AModule, [{
Expand All @@ -11,12 +10,10 @@ export { AModule };
}], null, null);
})();

class BModule {}
export class BModule {}
BModule.ɵfac = function BModule_Factory(t) { return new (t || BModule)(); };
BModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: BModule, declarations: [B1Component, B2Component], exports: [AModule] });
BModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [AModule] });
export { BModule };
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BModule, [{
Expand All @@ -25,12 +22,10 @@ export { BModule };
}], null, null);
})();

class AppModule {}
export class AppModule {}
AppModule.ɵfac = function AppModule_Factory(t) { return new (t || AppModule)(); };
AppModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: AppModule, imports: [BModule] });
AppModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [BModule] });
export { AppModule };
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AppModule, [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
"cases": [
{
"description": "should generate a basic deferred block",
"inputFiles": [
"basic_deferred.ts"
],
"inputFiles": ["basic_deferred.ts"],
"compilationModeFilter": ["full compile"],
"expectations": [
{
"files": [
Expand All @@ -20,9 +19,8 @@
},
{
"description": "should generate a deferred block with secondary blocks",
"inputFiles": [
"deferred_secondary_blocks.ts"
],
"inputFiles": ["deferred_secondary_blocks.ts"],
"compilationModeFilter": ["full compile"],
"expectations": [
{
"files": [
Expand All @@ -37,9 +35,8 @@
},
{
"description": "should generate a deferred block with placeholder block parameters",
"inputFiles": [
"deferred_with_placeholder_params.ts"
],
"inputFiles": ["deferred_with_placeholder_params.ts"],
"compilationModeFilter": ["full compile"],
"expectations": [
{
"files": [
Expand All @@ -54,9 +51,8 @@
},
{
"description": "should generate a deferred block with loading block parameters",
"inputFiles": [
"deferred_with_loading_params.ts"
],
"inputFiles": ["deferred_with_loading_params.ts"],
"compilationModeFilter": ["full compile"],
"expectations": [
{
"files": [
Expand All @@ -71,9 +67,8 @@
},
{
"description": "should generate a deferred block with local dependencies",
"inputFiles": [
"deferred_with_local_deps.ts"
],
"inputFiles": ["deferred_with_local_deps.ts"],
"compilationModeFilter": ["full compile"],
"expectations": [
{
"files": [
Expand All @@ -94,6 +89,7 @@
"deferred_with_external_deps_lazy.ts",
"deferred_with_external_deps_loading.ts"
],
"compilationModeFilter": ["full compile"],
"expectations": [
{
"files": [
Expand All @@ -108,9 +104,8 @@
},
{
"description": "should generate a deferred block with triggers",
"inputFiles": [
"deferred_with_triggers.ts"
],
"inputFiles": ["deferred_with_triggers.ts"],
"compilationModeFilter": ["full compile"],
"expectations": [
{
"files": [
Expand All @@ -125,9 +120,8 @@
},
{
"description": "should generate a deferred block with prefetch triggers",
"inputFiles": [
"deferred_with_prefetch_triggers.ts"
],
"inputFiles": ["deferred_with_prefetch_triggers.ts"],
"compilationModeFilter": ["full compile"],
"expectations": [
{
"files": [
Expand All @@ -142,9 +136,8 @@
},
{
"description": "should generate a deferred block with a `when` trigger that has a pipe",
"inputFiles": [
"deferred_when_with_pipe.ts"
],
"inputFiles": ["deferred_when_with_pipe.ts"],
"compilationModeFilter": ["full compile"],
"expectations": [
{
"files": [
Expand All @@ -160,9 +153,8 @@
},
{
"description": "should generate a deferred block with an interaction trigger in the same view",
"inputFiles": [
"deferred_interaction_same_view_trigger.ts"
],
"inputFiles": ["deferred_interaction_same_view_trigger.ts"],
"compilationModeFilter": ["full compile"],
"expectations": [
{
"files": [
Expand All @@ -177,9 +169,8 @@
},
{
"description": "should generate a deferred block with an interaction trigger in a parent view",
"inputFiles": [
"deferred_interaction_parent_view_trigger.ts"
],
"inputFiles": ["deferred_interaction_parent_view_trigger.ts"],
"compilationModeFilter": ["full compile"],
"expectations": [
{
"files": [
Expand All @@ -194,9 +185,8 @@
},
{
"description": "should generate a deferred block with an interaction trigger inside the placeholder",
"inputFiles": [
"deferred_interaction_placeholder_trigger.ts"
],
"inputFiles": ["deferred_interaction_placeholder_trigger.ts"],
"compilationModeFilter": ["full compile"],
"expectations": [
{
"files": [
Expand All @@ -211,9 +201,8 @@
},
{
"description": "should generate a deferred block with implicit trigger references",
"inputFiles": [
"deferred_with_implicit_triggers.ts"
],
"inputFiles": ["deferred_with_implicit_triggers.ts"],
"compilationModeFilter": ["full compile"],
"expectations": [
{
"files": [
Expand All @@ -228,10 +217,8 @@
},
{
"description": "should generate a deferred block with implicit trigger references",
"inputFiles": [
"defer_deps.ts",
"defer_deps_ext.ts"
],
"inputFiles": ["defer_deps.ts", "defer_deps_ext.ts"],
"compilationModeFilter": ["full compile"],
"expectations": [
{
"files": [
Expand All @@ -246,9 +233,8 @@
},
{
"description": "should generate a lazy deferred block with empty and placeholder",
"inputFiles": [
"lazy_with_blocks.ts"
],
"inputFiles": ["lazy_with_blocks.ts"],
"compilationModeFilter": ["full compile"],
"expectations": [
{
"files": [
Expand All @@ -262,4 +248,4 @@
]
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
.ɵɵadvance(1);\n // SOURCE: "/ng_for_simple.ts" "{{ item }}"
.ɵɵtextInterpolate(item_r1);\n }\n}\n\nclass // SOURCE: "/ng_for_simple.ts" "{{ item }}"
.ɵɵtextInterpolate(item_r1);\n }\n}\n\nexport class // SOURCE: "/ng_for_simple.ts" "{{ item }}"
.ɵɵtemplate(0, TestCmp_div_0_Template, 2, 1, "div", 0) // SOURCE: "/ng_for_simple.ts" "<div *ngFor="let item "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// TODO: Work out how to fix the broken segment for the last item in a template
.ɵɵelem // SOURCE: "/ng_if_simple.ts" "</div>'"
.ɵɵtextInterpolate(ctx_r0.name);\n }\n}\n\nclass // SOURCE: "/ng_if_simple.ts" "{{ name }}"
.ɵɵtextInterpolate(ctx_r0.name);\n }\n}\n\nexport class // SOURCE: "/ng_if_simple.ts" "{{ name }}"
.ɵɵtemplate(0, TestCmp_div_0_Template, 2, 1, "div", 0) // SOURCE: "/ng_if_simple.ts" "<div *"
Expand Down

0 comments on commit 8d80524

Please sign in to comment.