Skip to content

Constrain availability of ref conditional expressions to language versions 7.2 and higher#24355

Merged
VSadov merged 1 commit intodotnet:dev15.6.xfrom
VSadov:conditionalRef
Jan 22, 2018
Merged

Constrain availability of ref conditional expressions to language versions 7.2 and higher#24355
VSadov merged 1 commit intodotnet:dev15.6.xfrom
VSadov:conditionalRef

Conversation

@VSadov
Copy link
Copy Markdown
Member

@VSadov VSadov commented Jan 20, 2018

Constrains availability of ref conditional expressions to language versions 7.2 and higher

Fixes:#24306

Customer scenario

Customer uses the new feature ref conditional expression in a project not yet upgraded to C# 7.2
Let's say the team of developers has not yet completely moved to the new version of the compiler and compiling with older toolset is still a scenario.

It is expected to see errors about insufficient version for the feature used, but the error is not given.

As a result the project is no longer compatible with an older versions of the compiler defeating the purpose of the language version restriction.

Bugs this fixes

#24306

Workarounds, if any

Customer must know to not use the feature if compiling with older toolsets is still important.

Risk

Very low.
The feature is very new and is generally used in combination with other features predicated on 7.2

Performance impact

None.
The fix merely adds a language version check.

Is this a regression from a previous update?

N/A

Root cause analysis

The feature was prototyped in a separate branch - before the version 7.2 was available and could be checked for.
In addition the feature did not introduce any new syntax nodes, which would typically trigger adding a version check.

How was the bug found?

Customer reported.

Test documentation updated?

N/A

@VSadov VSadov requested a review from a team as a code owner January 20, 2018 01:30
@VSadov
Copy link
Copy Markdown
Member Author

VSadov commented Jan 20, 2018

@dotnet/roslyn-compiler - please review! This is for 15.6.x .

@jcouv jcouv changed the title Constrains availability of ref conditional expressions to language versions 7.2 and higher Constrain availability of ref conditional expressions to language versions 7.2 and higher Jan 20, 2018
int local2 = 2;
bool b = true;

ref int r = ref b? ref local1: ref local2;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Odd formatting

@VSadov
Copy link
Copy Markdown
Member Author

VSadov commented Jan 20, 2018

CC @MeiChin-Tsai for ask mode approval

@jcouv jcouv added this to the 15.6 milestone Jan 22, 2018
@MeiChin-Tsai
Copy link
Copy Markdown

approved.

@VSadov
Copy link
Copy Markdown
Member Author

VSadov commented Jan 22, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants