-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Move IDS_FeatureRefLocalsReturns out of the parser #65710
Merged
CyrusNajmabadi
merged 140 commits into
dotnet:main
from
CyrusNajmabadi:langVersionChecksCont4
Dec 3, 2022
Merged
Changes from all commits
Commits
Show all changes
140 commits
Select commit
Hold shift + click to select a range
cf0ff82
Move IDS_FeatureFileScopedNamespace check out of the parser
CyrusNajmabadi 2e14765
Move IDS_FeatureExternAlias check out of the parser
CyrusNajmabadi c77a8df
Move IDS_FeatureUsingStatic check out of the parser
CyrusNajmabadi 9214e58
Move IDS_FeatureGlobalUsing check out of the parser
CyrusNajmabadi 57f76d1
Move IDS_FeatureNamedArgument check out of the parser
CyrusNajmabadi 95190e5
Move IDS_FeatureAsync check out of the parser
CyrusNajmabadi b9d15d0
Move IDS_FeatureStaticClasses check out of the parser
CyrusNajmabadi 6ebd08e
Move IDS_FeatureReadOnlyStructs check out of the parser
CyrusNajmabadi 5465712
Move IDS_FeatureDefaultTypeParameterConstraint check out of the parser
CyrusNajmabadi 8b23be3
Move IDS_FeatureExpressionBodiedIndexer check out of the parser
CyrusNajmabadi 3f573a6
Move IDS_FeatureExpressionBodiedProperty check out of the parser
CyrusNajmabadi d6fcf67
Move IDS_FeatureAutoPropertyInitializer check out of the parser
CyrusNajmabadi 7ddd2b3
Move IDS_FeatureOptionalParameter check out of the parser
CyrusNajmabadi 8efce60
Move IDS_FeatureFixedBuffer check out of the parser
CyrusNajmabadi 13db8fc
Move IDS_FeatureGenerics check out of the parser
CyrusNajmabadi e643c1c
Move IDS_FeatureStaticLocalFunctions check out of the parser
CyrusNajmabadi 7470991
Move IDS_FeatureExternLocalFunctions check out of the parser
CyrusNajmabadi 541e46c
Move IDS_FeatureLocalFunctions check out of the parser
CyrusNajmabadi f47b8bf
Move IDS_FeatureThrowExpression check out of the parser
CyrusNajmabadi ce53f95
Move IDS_FeaturePatternMatching check out of the parser
CyrusNajmabadi e952cca
Move IDS_FeatureNullPropagatingOperator check out of the parser
CyrusNajmabadi f463c06
Move IDS_FeatureNullableReferenceTypes check out of the parser
CyrusNajmabadi dce4b3f
Move IDS_FeatureDefault check out of the parser
CyrusNajmabadi fb50dd4
Move IDS_FeatureDefaultLiteral check out of the parser
CyrusNajmabadi 8914d2e
Move IDS_FeatureAnonymousTypes check out of the parser
CyrusNajmabadi de1d7c8
Move IDS_FeatureImplicitObjectCreation check out of the parser
CyrusNajmabadi f5a8263
Move IDS_FeatureRecords check out of the parser
CyrusNajmabadi 94702e9
Move IDS_FeatureDictionaryInitializer check out of the parser
CyrusNajmabadi c538085
Move IDS_FeatureImplicitArray check out of the parser
CyrusNajmabadi 43bcf61
Move IDS_FeatureStackAllocInitializer check out of the parser
CyrusNajmabadi 550828e
Move IDS_FeatureAnonDelegates check out of the parser
CyrusNajmabadi 0aa23d6
Move IDS_FeatureAsync and IDS_FeatureStaticAnonymousFunction check ou…
CyrusNajmabadi 499c7e4
Move IDS_FeatureLambda check out of the parser
CyrusNajmabadi f7bfbfc
Move IDS_FeatureQueryExpression check out of the parser
CyrusNajmabadi 33185d6
Move IDS_FeatureRefStructs check out of the parser
CyrusNajmabadi 01b8d6f
Move IDS_FeatureRecursivePatterns check out of the parser
CyrusNajmabadi ece1590
Move IDS_FeatureExtendedPropertyPatterns check out of the parser
CyrusNajmabadi 66350f1
Move IDS_FeatureParenthesizedPattern check out of the parser
CyrusNajmabadi 8b7ae44
Move IDS_FeatureTypePattern check out of the parser
CyrusNajmabadi ac9f64b
Move IDS_FeatureRecursivePatterns check out of the parser
CyrusNajmabadi 0dd7d23
Move IDS_FeatureOrPattern check out of the parser
CyrusNajmabadi 158eea0
Move IDS_FeatureAndPattern check out of the parser
CyrusNajmabadi ff4d75b
Move IDS_FeatureRelationalPattern IDS_FeatureNotPattern and check out…
CyrusNajmabadi 5d316ad
Move IDS_FeatureTypeVariance check out of the parser
CyrusNajmabadi 4badea9
Remove version check when we're always going to report a parse error …
CyrusNajmabadi 22de551
Move IDS_FeatureFunctionPointers check out of the parser
CyrusNajmabadi b378a29
Move IDS_FeatureExceptionFilter check out of the parser
CyrusNajmabadi eb6a35b
Move IDS_FeatureRefForEach check out of the parser
CyrusNajmabadi ad7c696
Move IDS_FeatureIterators check out of the parser
CyrusNajmabadi d2a504a
Move IDS_FeatureAsync check out of the parser
CyrusNajmabadi 7d471b1
Move IDS_FeatureCoalesceAssignmentExpression check out of the parser
CyrusNajmabadi 0654a20
Move IDS_FeaturePatternMatching check out of the parser
CyrusNajmabadi 7279de9
Move IDS_FeatureReadOnlyReferences check out of the parser
CyrusNajmabadi 0648826
Move IDS_FeatureOutVar check out of the parser
CyrusNajmabadi 9705697
Move IDS_FeatureRefReassignment check out of the parser
CyrusNajmabadi 662f71a
Remove blank lines
CyrusNajmabadi d18cdbf
UPdate comments
CyrusNajmabadi 49b6f6f
Renames
CyrusNajmabadi 03a2623
Merge remote-tracking branch 'upstream/main' into langVersionChecks
CyrusNajmabadi eaf7e8d
Merge remote-tracking branch 'upstream/main' into langVersionChecks
CyrusNajmabadi 3e5826b
Fix errant semicolon
CyrusNajmabadi a9f8451
Fix indentation
CyrusNajmabadi 2fabba1
Simplify code
CyrusNajmabadi 0263fee
Fixup change
CyrusNajmabadi 0b663a1
Merge remote-tracking branch 'upstream/main' into langVersionChecks
CyrusNajmabadi 29ae829
Fix
CyrusNajmabadi f1592dc
Move IDS_TopLevelStatements check out of the parser
CyrusNajmabadi e7a983f
Move IDS_FeatureModuleAttrLoc check out of the parser
CyrusNajmabadi 9442adc
Move IDS_FeatureRecordXXX check out of the parser
CyrusNajmabadi 4ebf39b
Merge remote-tracking branch 'upstream/main' into langVersionChecksCont
CyrusNajmabadi ce9db2d
Move IDS_FeatureExpressionBodiedXXX check out of the parser
CyrusNajmabadi 7900e3a
Move IDS_FeatureStaticAbstractMembersInInterfaces check out of the pa…
CyrusNajmabadi a27cb92
Move IDS_FeaturePropertyAccessorMods check out of the parser
CyrusNajmabadi 4670c78
Move IDS_FeatureXXXInitializer check out of the parser
CyrusNajmabadi 636d6fd
Simplify
CyrusNajmabadi e4d9d3d
Simplify
CyrusNajmabadi 7437a9e
Simplify
CyrusNajmabadi dd1a55d
Merge remote-tracking branch 'upstream/main' into langVersionChecksCont
CyrusNajmabadi 933db45
Merge remote-tracking branch 'upstream/main' into langVersionChecksCont
CyrusNajmabadi c0a1ad7
Lint
CyrusNajmabadi 8b66b65
Lint
CyrusNajmabadi 5470687
Fix test
CyrusNajmabadi f14cf24
FIx tests
CyrusNajmabadi 18dabb5
Fix record check
CyrusNajmabadi b910b94
Unify checks
CyrusNajmabadi a666886
Fix speculation
CyrusNajmabadi a23e082
Restore
CyrusNajmabadi c56a716
Merge remote-tracking branch 'upstream/main' into langVersionChecksCont
CyrusNajmabadi e008fc3
Fix tests
CyrusNajmabadi c4a42bc
Remove errant code
CyrusNajmabadi 966a269
Move modifiers check
CyrusNajmabadi 1877677
Merge remote-tracking branch 'upstream/main' into langVersionChecksCont2
CyrusNajmabadi a671a90
Move IDS_FeaturePartialTypes check out of parser
CyrusNajmabadi 165f266
Remove unnecessary check
CyrusNajmabadi eafb6d0
Merge remote-tracking branch 'upstream/main' into langVersionChecksCont2
CyrusNajmabadi 5e7505d
Move IDS_FeatureReadOnlyMembers checks out of parser
CyrusNajmabadi 71ef8d2
Move IDS_FeatureGlobalNamespace checks out of parser
CyrusNajmabadi 74d11be
Move IDS_FeatureNullable checks out of parser
CyrusNajmabadi d84dd99
Merge remote-tracking branch 'upstream/main' into langVersionChecksCont2
CyrusNajmabadi 376773e
lint
CyrusNajmabadi fedc280
lint
CyrusNajmabadi 40f1612
invert
CyrusNajmabadi 641fe28
Move IDS_FeatureRefLocalsReturns out of the parser
CyrusNajmabadi c7e8640
Move IDS_FeatureRefLocalsReturns out of the parser
CyrusNajmabadi ef2d6e7
Move IDS_FeatureTuples out of the parser
CyrusNajmabadi aa09a1b
Move IDS_FeatureTuples out of the parser
CyrusNajmabadi 2362fa8
Move IDS_FeatureTuples out of the parser
CyrusNajmabadi e179d0d
Fix test
CyrusNajmabadi 3813462
Merge branch 'langVersionChecksCont2' into langVersionChecksCont3
CyrusNajmabadi f52d0ce
Update comments
CyrusNajmabadi dd34e81
Merge remote-tracking branch 'upstream/main' into langVersionChecksCont2
CyrusNajmabadi 899c48f
Simplify
CyrusNajmabadi 2b2ba15
Simplify
CyrusNajmabadi 85dc588
Clarify code
CyrusNajmabadi b075975
Merge branch 'langVersionChecksCont2' into langVersionChecksCont3
CyrusNajmabadi 9bd07ce
Merge remote-tracking branch 'upstream/main' into langVersionChecksCont3
CyrusNajmabadi 1a1d171
Formatting
CyrusNajmabadi 94ddd02
Move one more case
CyrusNajmabadi ce4eb33
Move one more case
CyrusNajmabadi 40c7415
Fix test
CyrusNajmabadi 5fb16ee
Merge remote-tracking branch 'upstream/main' into langVersionChecksCont3
CyrusNajmabadi fdf71e5
Update test
CyrusNajmabadi 049b812
Work on ref-types
CyrusNajmabadi 6b43371
Remove from parser
CyrusNajmabadi cca1319
Merge remote-tracking branch 'upstream/main' into langVersionChecksCont4
CyrusNajmabadi 4d05f1d
Restore
CyrusNajmabadi 788ecf7
Simplify
CyrusNajmabadi e99a3d6
Add comment
CyrusNajmabadi 5677838
Update src/Compilers/CSharp/Portable/Syntax/SyntaxNodeExtensions.cs
CyrusNajmabadi d42839c
Remove redundant lang-version check
CyrusNajmabadi 21fcaca
Merge branch 'langVersionChecksCont4' of https://github.com/CyrusNajm…
CyrusNajmabadi 693ecd0
Update src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberField…
CyrusNajmabadi 2f9e73d
Update src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs
CyrusNajmabadi 099a8fa
Rename for clarity
CyrusNajmabadi 0d2a458
PR feedback
CyrusNajmabadi c145880
PR feedback
CyrusNajmabadi 532b2d0
Copy paste error
CyrusNajmabadi bfaf1d5
PR feedback
CyrusNajmabadi bc203e0
No extension
CyrusNajmabadi ba7ca5f
PR feedback
CyrusNajmabadi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,7 +50,7 @@ internal static GlobalExpressionVariable Create( | |
Debug.Assert(nodeToBind.Kind() == SyntaxKind.VariableDeclarator || nodeToBind is ExpressionSyntax); | ||
|
||
var syntaxReference = syntax.GetReference(); | ||
return (typeSyntax == null || typeSyntax.SkipScoped(out _).SkipRef(out _).IsVar) | ||
return (typeSyntax == null || typeSyntax.SkipScoped(out _).SkipRef().IsVar) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sidenote: we have a ton of code taht does this unwrapping to check .IsVar. We may want to consider having that property just do this unwinding anyways. |
||
? new InferrableGlobalExpressionVariable(containingType, modifiers, typeSyntax, name, syntaxReference, location, containingFieldOpt, nodeToBind) | ||
: new GlobalExpressionVariable(containingType, modifiers, typeSyntax, name, syntaxReference, location); | ||
} | ||
|
@@ -88,7 +88,7 @@ internal override TypeWithAnnotations GetFieldType(ConsList<FieldSymbol> fieldsB | |
|
||
if (typeSyntax != null) | ||
{ | ||
type = binder.BindTypeOrVarKeyword(typeSyntax.SkipScoped(out _).SkipRef(out _), diagnostics, out isVar); | ||
type = binder.BindTypeOrVarKeyword(typeSyntax.SkipScoped(out _).SkipRef(), diagnostics, out isVar); | ||
} | ||
else | ||
{ | ||
|
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
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
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
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here's teh general intuition (which i commented in the PR). If a feature is ignoring 'ref', then it's a place where 'ref' is not legal (otherwise they wouldn't be able to ignore it). And those places already have a syntactic check to report that. i.e. we already hve code on line 841 in this file to error for that case. As such, we don't need to report a diagnostic about needing a particular lang version to use 'ref'.
However, if hte feature does care about ref-type and actually uses that ref-kind, then it is only legal to do that in a version of c# that supports
ref
. So if it uses the actual RefKind, it needs to pass in diagnostics to get the right version checks.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seemed like in some places, we are skipping ref, but some other check is deciding conditionally whether ref is OK in that position. For example, in
BindVariableTypeWithAnnotations
. It looks like some of the time you deliberately called the overload to passdiagnostics: null
, like in SourceLocalSymbol.It looks like the
SkipRef
overload that takes a diagnostic bag is specifically checking for the ref locals and returns feature. I am wondering if the name of this method should be changed, e.g.SkipRef()
with no parameters sticks around, andSkipRef(DiagnosticBag, out RefKind
gets renamed to something likeSkipRefInLocalOrReturn(DiagnosticBag, out RefKind)
. Then it might be slightly easier to tell at a glance why it's expected to pass a diagnostic bag or not.