fix(template-compiler): inline iterator checks key is not index #2703
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.
Details
Fixes #2702.
This is a fix for a somewhat orthogonal issue I discovered in #2699. I'm breaking it into its own PR to try to make things less confusing. (Hopefully?)
The compiler is supposed to throw an error if the
key
attribute is set to anindex
. But previously we weren't throwing the error for inline iterators:This PR fixes it so that it properly throws an error. I also added a bunch of tests to make sure that various flavors of iterators are working correctly (inline vs
<template>
,for:each
vsiterator:*
).Does this pull request introduce a breaking change?
Does this pull request introduce an observable change?
If you try to set a
key
to anindex
on an inline iterator, it will now throw an error. I don't expect this to break anyone in practice, because in 234 and 236 we didn't support inline iterators at all – we introduced support for them (perhaps unintentionally) during development of 238.GUS work item
W-10738523