Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit22898ad

Browse files
Vasily KirichenkoVasily Kirichenko
Vasily Kirichenko
authored and
Vasily Kirichenko
committed
restrict usingnameof operator as first class
1 parent0f5165f commit22898ad

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

‎src/fsharp/FSComp.txt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1334,4 +1334,5 @@ tcGlobalsSystemTypeNotFound,"The system type '%s' was required but no referenced
13341334
3213,typrelMemberHasMultiplePossibleDispatchSlots,"The member '%s' matches multiple overloads of the same method.\nPlease restrict it to one of the following:%s."
13351335
3214,methodIsNotStatic,"Method or object constructor '%s' is not static"
13361336
3215,expressionHasNoName,"This expression does not have a name."
1337-
3216,nameofNotPermitted,"The nameof operator is not allowed in this position."
1337+
3216,nameofNotPermitted,"The nameof operator is not allowed in this position."
1338+
3217,chkNoFirstClassNameOf,"First-class uses of the 'nameof' operator is not permitted"

‎src/fsharp/PostInferenceChecks.fs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ and CheckVal (cenv:cenv) (env:env) v m context =
514514
if isSpliceOperator cenv.g vthen errorR(Error(FSComp.SR.chkNoFirstClassSplicing(), m))
515515
if valRefEq cenv.g v cenv.g.addrof_vrefthen errorR(Error(FSComp.SR.chkNoFirstClassAddressOf(), m))
516516
if valRefEq cenv.g v cenv.g.reraise_vrefthen errorR(Error(FSComp.SR.chkNoFirstClassRethrow(), m))
517+
if valRefEq cenv.g v cenv.g.nameof_vrefthen errorR(Error(FSComp.SR.chkNoFirstClassNameOf(), m))
517518
if noByrefs context&& isByrefLikeTy cenv.g v.Typethen
518519
// byref typed val can only occur in permitting contexts
519520
errorR(Error(FSComp.SR.chkNoByrefAtThisPoint(v.DisplayName), m))

‎src/fsharp/TastOps.fs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7763,7 +7763,9 @@ let IsSimpleSyntacticConstantExpr g inputExpr =
77637763
| Expr.Op(TOp.UnionCase_,_,[],_)// Nullary union cases
77647764
| UncheckedDefaultOfExpr g_
77657765
| SizeOfExpr g_
7766-
| TypeOfExpr g_->true
7766+
| TypeOfExpr g_
7767+
| NameOfExpr g_
7768+
| TypeNameOfExpr g_->true
77677769
// All others are not simple constant expressions
77687770
|_->false
77697771

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp