Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d380a0e
substitute 'nameof(<long ident>)` with `Conts(<long ident as string l…
Jan 18, 2017
223d313
Implementing basic nameof and typenameof operators
Jan 18, 2017
529cc6f
Apply feedback
Jan 18, 2017
f3c4ba5
Revert "Apply feedback"
Jan 18, 2017
8fd0392
Revert "Implementing basic nameof and typenameof operators"
Jan 18, 2017
77c8f77
revert nameof and typenameof functions to FSharp.Core
vasily-kirichenko Jan 18, 2017
3070c1d
wip
vasily-kirichenko Jan 18, 2017
b3e712d
it works
vasily-kirichenko Jan 18, 2017
6c6e3b5
Merge remote-tracking branch 'origin/master' into nameof-operator
Jan 19, 2017
7832be5
refactoring
Jan 19, 2017
6581790
make it work on simple `Ident`s
Jan 19, 2017
0f5165f
use proper error message
Jan 19, 2017
22898ad
restrict using `nameof` operator as first class
Jan 19, 2017
e5033af
remove `typenameof` bits
Jan 19, 2017
1ad0a0e
nameof(typeof<_>) works
Jan 19, 2017
c9a64b2
Merge branch 'master' into nameof-operator
vasily-kirichenko Jan 28, 2017
5657759
fix QA tests
vasily-kirichenko Jan 28, 2017
b26994c
Merge branch 'master' into nameof-operator
vasily-kirichenko Feb 3, 2017
a732de0
remove nameof function form FSharp.Core
vasily-kirichenko Feb 3, 2017
b29fe57
Merge remote-tracking branch 'origin/master' into nameof-operator
vasily-kirichenko Feb 4, 2017
b7763a6
Revert "remove nameof function form FSharp.Core"
vasily-kirichenko Feb 4, 2017
906a934
Try to resolve the `nameof` operator argument to prevent passing anyt…
vasily-kirichenko Feb 4, 2017
a770e3c
nameof works on generic types
vasily-kirichenko Feb 4, 2017
067955a
fix error range in case of wrong `nameof`operator argument
vasily-kirichenko Feb 4, 2017
bfcc390
notify name resolution sink about nameof operator argument Item in or…
vasily-kirichenko Feb 5, 2017
6a92a80
fully type check `nameof` argument
vasily-kirichenko Feb 5, 2017
bcec600
try to type check arg again
vasily-kirichenko Feb 5, 2017
f64b3c5
Merge remote-tracking branch 'origin/master' into nameof-operator
Feb 6, 2017
0c1cad2
type check `nameof` argument more carefully
vasily-kirichenko Feb 6, 2017
15bf862
Merge remote-tracking branch 'vasily-kirichenko/nameof-operator' into…
vasily-kirichenko Feb 6, 2017
5b72f32
Merge remote-tracking branch 'origin/master' into nameof-operator
vasily-kirichenko Feb 15, 2017
ceb7731
Merge branch 'master' into nameof-operator
vasily-kirichenko Mar 1, 2017
588de2e
factor tcExpr to top level function
vasily-kirichenko Mar 1, 2017
f2ae00f
Merge remote-tracking branch 'origin/master' into nameof-operator
vasily-kirichenko Mar 8, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix QA tests
  • Loading branch information
vasily-kirichenko committed Jan 28, 2017
commit 56577597f7178414a277ff51a887d0f890e8d2fc
2 changes: 1 addition & 1 deletion src/fsharp/FSComp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1334,4 +1334,4 @@ tcGlobalsSystemTypeNotFound,"The system type '%s' was required but no referenced
3213,typrelMemberHasMultiplePossibleDispatchSlots,"The member '%s' matches multiple overloads of the same method.\nPlease restrict it to one of the following:%s."
3214,methodIsNotStatic,"Method or object constructor '%s' is not static"
3215,expressionHasNoName,"This expression does not have a name."
3216,chkNoFirstClassNameOf,"First-class uses of the 'nameof' operator is not permitted"
3216,chkNoFirstClassNameOf,"First-class uses of the 'nameof' operator is not permitted."
2 changes: 1 addition & 1 deletion src/fsharp/TypeChecker.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8269,7 +8269,7 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty (
// generate fake `range` for the constant the `nameof(..)` we are substituting
let constRange = mkRange r.FileName r.Start (mkPos r.StartLine (r.StartColumn + argIdent.idText.Length + 2)) // `2` are for quotes
TcDelayed cenv overallTy env tpenv mExprAndArg (ApplicableExpr(cenv, Expr.Const(Const.String(argIdent.idText), constRange, cenv.g.string_ty), true)) cenv.g.string_ty ExprAtomicFlag.Atomic delayed
| _ -> error (Error(FSComp.SR.expressionHasNoName(), synArg.Range))
| _ -> error (Error(FSComp.SR.expressionHasNoName(), expr.Range))
| _ ->
// Notice the special case 'seq { ... }'. In this case 'seq' is actually a function in the F# library.
// Set a flag in the syntax tree to say we noticed a leading 'seq'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// #Regression #Conformance #DataExpressions
// Verify that nameof doesn't work on const string
//<Expects id="FS3199" span="(5,9)" status="error">This expression does not have a name.</Expects>
//<Expects id="FS3215" span="(5,9)" status="error">This expression does not have a name.</Expects>

let x = nameof(1+2)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// #Regression #Conformance #DataExpressions
// Verify that nameof doesn't work on applied functions
//<Expects id="FS3199" span="(6,9)" status="error">This expression does not have a name.</Expects>
//<Expects id="FS3215" span="(6,9)" status="error">This expression does not have a name.</Expects>

let f() = 1
let x = nameof(f())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// #Regression #Conformance #DataExpressions
// Verify that nameof can't be used as a function.
//<Expects id="FS3199" span="(5,9)" status="error">This expression does not have a name.</Expects>
//<Expects id="FS3216" span="(5,9)" status="error">First-class uses of the 'nameof' operator is not permitted</Expects>

let f = nameof

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// #Regression #Conformance #DataExpressions
// Verify that nameof doesn't work on dictionary lookup
//<Expects id="FS3199" span="(6,9)" status="error">This expression does not have a name.</Expects>
//<Expects id="FS3215" span="(6,9)" status="error">This expression does not have a name.</Expects>

let dict = new System.Collections.Generic.Dictionary<int,string>()
let b = nameof(dict.[2])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// #Regression #Conformance #DataExpressions
// Verify that nameof doesn't work on const int
//<Expects id="FS3199" span="(5,9)" status="error">This expression does not have a name.</Expects>
//<Expects id="FS3215" span="(5,9)" status="error">This expression does not have a name.</Expects>

let x = nameof 1

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// #Regression #Conformance #DataExpressions
// Verify that nameof doesn't work on applied functions
//<Expects id="FS3199" span="(6,9)" status="error">This expression does not have a name.</Expects>
//<Expects id="FS3215" span="(6,9)" status="error">This expression does not have a name.</Expects>

let f x = 1 * x
let x = nameof(f 2)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// #Regression #Conformance #DataExpressions
// Verify that nameof doesn't work on applied functions
//<Expects id="FS3199" span="(7,9)" status="error">This expression does not have a name.</Expects>
//<Expects id="FS3215" span="(7,9)" status="error">This expression does not have a name.</Expects>

let f x y = x y
let z x = 1 * x
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// #Regression #Conformance #DataExpressions
// Verify that nameof doesn't work on partially applied functions
//<Expects id="FS3199" span="(6,9)" status="error">This expression does not have a name.</Expects>
//<Expects id="FS3215" span="(6,9)" status="error">This expression does not have a name.</Expects>

let f x y = y * x
let x = nameof(f 2)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// #Regression #Conformance #DataExpressions
// Verify that nameof doesn't work on const string
//<Expects id="FS3199" span="(5,9)" status="error">This expression does not have a name.</Expects>
//<Expects id="FS3215" span="(5,9)" status="error">This expression does not have a name.</Expects>

let x = nameof "string"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// #Regression #Conformance #DataExpressions
// Verify that nameof can't be used as a function.
//<Expects id="FS3200" span="(26,10)" status="error">The nameof operator is not allowed in this position.</Expects>
//<Expects id="FS3216" span="(6,28)" status="error">First-class uses of the 'nameof' operator is not permitted.</Expects>

let curriedFunction x y = x * y
let b = curriedFunction |> nameof
Expand Down