New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ivy): support abstract directives in template type checking #33131
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JoostK
added
type: bug/fix
effort1: hours
freq2: medium
severity3: broken
workaround2: non-obvious
target: major
This PR is targeted for the next major release
risk: medium
area: compiler
Issues related to `ngc`, Angular's template compiler
labels
Oct 13, 2019
JoostK
force-pushed
the
ngtsc-abstract-directives
branch
from
October 13, 2019 15:49
04c3225
to
52552f9
Compare
7 tasks
This was referenced Oct 17, 2019
JoostK
added
the
action: review
The PR is still awaiting reviews from at least one requested reviewer
label
Oct 22, 2019
alxhub
approved these changes
Oct 24, 2019
alxhub
force-pushed
the
ngtsc-abstract-directives
branch
from
October 24, 2019 17:03
52552f9
to
61c2c2f
Compare
AndrewKushnir
added
action: cleanup
The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews
and removed
action: review
The PR is still awaiting reviews from at least one requested reviewer
labels
Oct 24, 2019
AndrewKushnir
added
the
action: presubmit
The PR is in need of a google3 presubmit
label
Oct 24, 2019
Recently it was made possible to have a directive without selector, which are referred to as abstract directives. Such directives should not be registered in an NgModule, but can still contain decorators for inputs, outputs, queries, etc. The information from these decorators and the `@Directive()` decorator itself needs to be registered with the central `MetadataRegistry` so that other areas of the compiler can request information about a given directive, an example of which is the template type checker that needs to know about the inputs and outputs of directives. Prior to this change, however, abstract directives would only register themselves with the `MetadataRegistry` as being an abstract directive, without all of its other metadata like inputs and outputs. This meant that the template type checker was unable to resolve the inputs and outputs of these abstract directives, therefore failing to check them correctly. The typical error would be that some property does not exist on a DOM element, whereas said property should have been bound to the abstract directive's input. This commit fixes the problem by always registering the metadata of a directive or component with the `MetadataRegistry`. Tests have been added to ensure abstract directives are handled correctly in the template type checker, together with tests to verify the form of abstract directives in declaration files. Fixes angular#30080
alxhub
force-pushed
the
ngtsc-abstract-directives
branch
from
October 24, 2019 17:26
61c2c2f
to
3d1960c
Compare
AndrewKushnir
removed
the
action: cleanup
The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews
label
Oct 24, 2019
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
action: merge
The PR is ready for merge by the caretaker
action: presubmit
The PR is in need of a google3 presubmit
area: compiler
Issues related to `ngc`, Angular's template compiler
cla: yes
effort1: hours
freq2: medium
risk: medium
target: major
This PR is targeted for the next major release
type: bug/fix
workaround2: non-obvious
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Recently it was made possible to have a directive without selector,
which are referred to as abstract directives. Such directives should not
be registered in an NgModule, but can still contain decorators for
inputs, outputs, queries, etc. The information from these decorators and
the
@Directive()
decorator itself needs to be registered with thecentral
MetadataRegistry
so that other areas of the compiler canrequest information about a given directive, an example of which is the
template type checker that needs to know about the inputs and outputs of
directives.
Prior to this change, however, abstract directives would only register
themselves with the
MetadataRegistry
as being an abstract directive,without all of its other metadata like inputs and outputs. This meant
that the template type checker was unable to resolve the inputs and
outputs of these abstract directives, therefore failing to check them
correctly. The typical error would be that some property does not exist
on a DOM element, whereas said property should have been bound to the
abstract directive's input.
This commit fixes the problem by always registering the metadata of a
directive or component with the
MetadataRegistry
. Tests have beenadded to ensure abstract directives are handled correctly in the
template type checker, together with tests to verify the form of
abstract directives in declaration files.
Fixes #30080