-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Relax ordering constraints around 'ref' and 'partial' modifiers #23533
Conversation
That's weird. This doesn't touch any ide code. (maybe we should add root slashes to paths?) /cc @jasonmalinowski This is for the compiler team to review. Thanks. |
@alrz: I see you rebased the branch. If you branched master, retargeted to the PR to features/compiler, but hadn't rebased your branch first, then you might have in that window of time carried along an IDE fix which got that added. Or you found a bug in GitHub. We'll see if we see it again? #Resolved |
Also, by clicking on "code owner" in "requested a review from dotnet/roslyn-ide as a code owner" line you will be redirected to the line that caused it. it's on master. sounds like a GitHub bug. #Resolved |
@alrz Yeah, did you change GitHub branch target and then do a rebase? Yeah GitHub shows it's the EditorFeatures line, but unfortunately doesn't let us see the point-in-time diff it was looking at when it decided to do that. #Resolved |
@gafter should I rebase to master? #Resolved |
IMO this should be behind a feature flag if we intend to relax
which I think could be a bug fix. #Resolved |
var isPartialType = this.IsPartialType(); | ||
var isPartialMember = this.IsPartialMember(); | ||
if (isPartialType || isPartialMember) | ||
var isPartialFollowedByType = this.IsPartialType(); |
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.
I think we should change or remove the IsPartialType
helper. It no longer does what it says it does.
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.
We should also add tests for the case described in the comment for ParseIdentifierToken
var isPartialMember = this.IsPartialMember(); | ||
if (isPartialType || isPartialMember) | ||
var isPartialFollowedByType = this.IsPartialType(); | ||
var isPartialType = isPartialFollowedByType || IsNonContextualModifier(nextToken); |
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.
What's the result if we try to parse partial partial ref struct
? #Resolved
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.
I think the diagnostic will be similar to what we have today (expected ;
etc). I'll add the test.
// (2,1): error CS0267: The 'partial' modifier can only appear immediately before 'class', 'struct', 'interface', or 'void' | ||
// partial public class C // CS0267 | ||
Diagnostic(ErrorCode.ERR_PartialMisplaced, "partial").WithLocation(2, 1)); | ||
CreateStandardCompilation(test).VerifyDiagnostics(); |
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.
In all of the cases where compilation now succeeds, I think we should access the type symbol for the declaration from the Compilation and verify that all the modifiers we expect are now present on the type.
the update xlf thing is such a drag. now for every resx change we need to commit 15 files? I thought we were going to narrow it down to one (just resx, not even .designer.cs) #Resolved |
/cc @tmeschter @nguerrera #Resolved |
@alrz We're in the process of moving localization work into the dotnet/roslyn repository. The upside is that we will, eventually, be able to take community contributions to improve translations. The downside is the need to keep the .xlf files up-to-date with the .resx files to ensure our translators are not working with stale data. We're looking into ways of automating this so you won't have to deal with it in normal developer workflows. Note that changes to .resx and .designer.cs will generally have to happen together for correctness reasons, but that's always how it has been. #Resolved |
@alrz Has this been approved by LDM? #Resolved |
@AlekseyTs The last notes on this only recorded that we want to relax for |
I think we can actually exclude |
No, that's not safe. The .designer.cs file is updated by VS as the .resx files changes; it is not updated during the build. If you don't commit and flow changes to the .designer.cs along with the .resx then you'll quickly run into problems where your changes build on your local system, but don't build on a CI system. #Resolved |
The conflicts in the .xlf files can be dealt with as follows:
|
This is how to do those steps on the command line if you don't use GUI tools to handle bulk conflict resolution. # merge and get conflicts (assuming upstream remote name and using base branch of this particular PR)
git fetch --all
git merge upstream/features/compiler
# overwrite xlf with their changes
git checkout --theirs '**/*.xlf'
# build to get your xlf updates reapplied
build
# stage updated xlf and mark conflict resolved
git add '**/*.xlf'
# commit merge
git commit
``` #Resolved |
// For instance, we return true for both of these: | ||
// | ||
// partial partial<T>() | ||
// partial partail<T> partial() |
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.
partail [](start = 22, length = 7)
typo?
The parsing of modifiers has been updated in the meantime, causing some conflicts. |
some of test failures are there just because the default langversion doesn't include preview features. should we adjust those tests or include preview in default? |
@alrz The tests should be adjusted to use Preview language version. Once we lock the release each feature goes into, those tests will be updated with a specific language version (TestOptions.Regular9 and such). |
We probably need to consider the /cc @agocke |
@alrz Agreed. I'm going to regard this feature as necessary if we want to add a |
@alrz If you don't mind I'm gonna rebase this to master in a new PR. I'm gonna build on it for my records work. |
Sure. I think we can close this one now. Thanks. I'll keep the branch for you to rebase. |
Thanks! Draft PR #42097 I'll keep your code and just add any changes needed for records. |
Proposal: dotnet/csharplang#946 (as part of C# 7.3)
Also related: dotnet/csharplang#1022