fix: require distinct argument and property names#272
Merged
Conversation
Restrict the usage of datatype parameters in functions, so that languages with keyword argument support can inline datatype parameters into the function declaration. This means it cannot share any field names with remaining function argument names. Fixes #268.
dstufft
approved these changes
Oct 22, 2018
…atatype-placement
Contributor
|
Can we also annotate the method in the jsii spec that keyword arguments can be expanded? |
eladb
reviewed
Oct 23, 2018
| const lastParamTypeRef = apply(last(parameters), x => x.type); | ||
| const lastParamSymbol = last(signature.getParameters()); | ||
| if (lastParamTypeRef && spec.isNamedTypeReference(lastParamTypeRef)) { | ||
| this._deferUntilTypesAvailable(symbol.name, [lastParamTypeRef], lastParamSymbol!.declarations[0], (lastParamType) => { |
Contributor
There was a problem hiding this comment.
I am worried about this programming model. I really liked your idea of phases as a safer and more deterministic alternative.
rix0rrr
pushed a commit
that referenced
this pull request
Oct 23, 2018
* **jsii:** use base interfaces for 'datatype' property ([#265](#265)) ([1c56902](1c56902)), closes [#264](#264) * **jsii:** use default jsx compiler options ([#261](#261)) ([bf1f586](bf1f586)), closes [aws/aws-cdk#830](aws/aws-cdk#830) * match behavioral interface to 'I'-prefix ([#271](#271)) ([03103f3](03103f3)) * require distinct argument and property names ([#272](#272)) ([4d2f268](4d2f268)), closes [#268](#268)
Merged
rix0rrr
added a commit
that referenced
this pull request
Oct 23, 2018
Bug Fixes ======= * **jsii:** use base interfaces for 'datatype' property ([#265](#265)) ([1c56902](1c56902)), closes [#264](#264) * **jsii:** use default jsx compiler options ([#261](#261)) ([bf1f586](bf1f586)), closes [aws/aws-cdk#830](aws/aws-cdk#830) * match behavioral interface to 'I'-prefix ([#271](#271)) ([03103f3](03103f3)) * require distinct argument and property names ([#272](#272)) ([4d2f268](4d2f268)), closes [#268](#268)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Restrict the usage of datatype parameters in functions, so that
languages with keyword argument support can inline datatype parameters
into the function declaration. This means it cannot share any field
names with remaining function argument names.
Fixes #268.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.