Skip to content
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

Features/local functions prototype #4940

Merged
merged 61 commits into from
Sep 16, 2015
Merged
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
0067749
Start work on local functions
May 19, 2015
927b461
Local functions 'Hello, World!'
May 21, 2015
388d11a
More local function features working
May 22, 2015
b0de720
Make local functions use lambda closure machenery
May 27, 2015
fea05ad
Support recursive closures
May 27, 2015
ab32bbf
Change LocalFunctionMethodSymbol base class to MethodSymbol
May 28, 2015
2d0272a
Improved parsing and IDE experience
May 28, 2015
1d8c2c8
Enable feature flag for local functions
Jun 4, 2015
a673936
Allow unsafe local functions
Jun 5, 2015
8ffeb31
Fix CallerMemberNameAttribute
Jun 8, 2015
2b47dc5
Respond to local functions feedback
Jun 8, 2015
7b4911e
Merge pull request #3372 from khyperia/LocalFunctions
khyperia Jun 9, 2015
e771b51
Add documentation for local function branch
Jun 11, 2015
d59050a
Merge pull request #3534 from dotnet/future
khyperia Jun 16, 2015
47ad825
Merge pull request #3460 from khyperia/LocalFunctionsDocs
khyperia Jun 16, 2015
f507de4
Merge remote-tracking branch 'upstream/future' into features-local-fu…
Jun 19, 2015
ef76ee1
Allow generic local functions
Jun 10, 2015
f1d923e
Small features and bugfixes in local functions
Jun 11, 2015
20af771
Syntax-related bugfixes
Jun 16, 2015
6f09a77
Initial EnC working for local functions
Jun 17, 2015
4518a58
Fix parsing bug and parameter binding bug in speculative contexts
Jun 18, 2015
ef9cedd
Inferred return types for local functions
Jun 19, 2015
f18e7aa
Change local function mangled name to be separate from lambdas
Jun 19, 2015
42d71a8
Merge pull request #3591 from khyperia/LocalFunctions
khyperia Jun 22, 2015
646459e
Make generic local functions work in EE
Jun 22, 2015
ead6aec
Handle 'async var' and 'iterator var'
Jun 23, 2015
b3c30d9
Fix type parameter name conflict diagnostic
Jun 26, 2015
b083c6a
Implement generic constraints
Jun 29, 2015
7bb4cd1
Update local-functions design document
Jun 29, 2015
21fe558
Refactor local function tests for smaller individual tests
Jun 29, 2015
fc75c74
Merge branch 'future' into 'features/local-functions'
Jul 1, 2015
037f4a6
Optimize local function closures into structs
Jul 1, 2015
b5999ef
Respond to PR feedback
Jul 1, 2015
1a9794a
Merge pull request #3775 from khyperia/LocalFunctions
khyperia Jul 6, 2015
bd2fa00
Add more local function unit tests
Jul 6, 2015
8f4befc
Add local functions to BoundBlock
Jul 6, 2015
835b387
Allow multiple returns in inferred return type local function
Jul 6, 2015
3b5d9ee
Remove SyntaxNode parameter from GetDeclaredLocalsForScope
Jul 7, 2015
831890a
Merge pull request #3849 from khyperia/LocalFunctions
khyperia Jul 8, 2015
9a04e5b
Fix struct frames being passed by value in a double-nested closure
Jul 7, 2015
b310c40
Fix bug in closure detection of generic local functions, and optimize…
Jul 8, 2015
d36e3d8
Make static closures that are never converted to a delegate be static…
Jul 10, 2015
40a1d1c
Merge pull request #3902 from khyperia/LocalFunctions
khyperia Jul 13, 2015
31fa3ff
Disallow invocations of local functions with dynamic arguments
Jul 10, 2015
591b749
Remove Reflection.MethodBase.GetCurrentMethod from within unit tests,…
Jul 13, 2015
f045d80
Update message for local functions in expression trees
Jul 13, 2015
a7e7c71
Update local-functions.md
Jul 14, 2015
98d95e7
Merge pull request #3946 from khyperia/LocalFunctions
khyperia Jul 16, 2015
7b4098f
Merge branch 'future' into 'features/local-functions'
Jul 16, 2015
fed6600
Implement by-ref struct closure optimization
Jul 15, 2015
7267116
Struct closures can be generic
Jul 20, 2015
ad5965d
Merge pull request #4082 from khyperia/LocalFunctionsStruct
khyperia Jul 27, 2015
3cb0e07
Merge branch 'future' into 'features/local-functions'
Jul 27, 2015
738fa9a
Report unused local functions in switch statements
Jul 20, 2015
4cfc5b0
Minor locfunc bugfixes
Jul 24, 2015
34089af
Add documentation to var return types being broken
Jul 30, 2015
52ab4ce
Merge pull request #4260 from khyperia/LocalFunctions
khyperia Jul 31, 2015
e75ca21
Merge branch 'future' of https://github.com/dotnet/roslyn into featur…
gafter Sep 10, 2015
b8e0bf2
Fix some merge issues.
gafter Sep 10, 2015
065dfb5
Further integration fixes.
gafter Sep 11, 2015
3f5eaf2
Merge branch 'future' of https://github.com/dotnet/roslyn into featur…
gafter Sep 11, 2015
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
Add documentation to var return types being broken
  • Loading branch information
Evan Hauck committed Jul 30, 2015
commit 34089af57e364b9688e0e0c70702e9690a36e41f
2 changes: 1 addition & 1 deletion docs/features/local-functions.md
Original file line number Diff line number Diff line change
@@ -37,4 +37,4 @@ TODO:
- `LocalScopeBinder.ReportConflictWithLocal()` (twice)
- `LocalScopeBinder.EnsureSingleDefinition()`, handle case where 'name' exists in both `localsMap` and `localFunctionsMap`. Might be related to `LocalFunctionTests.NameConflictLocalVarLast()`
- Defining a local function with a dynamic parameter doesn't work at runtime.
- Return type of `var` is strange - when normally compiling, it works fine, but intellisense/etc doesn't work.
- Return type of `var` is broken - see LocalFunctionSymbol.cs for an explanation. Fixing it will require a large rewrite of much of return type analysis, as the current system assumes that all return types are known (mostly) without examining the method body.
Original file line number Diff line number Diff line change
@@ -158,6 +158,17 @@ public TypeSymbol ReturnTypeIterator
}
}

/*
Note: `var` return types are currently very broken in subtle ways, in particular in the IDE scenario when random things are being bound.
The basic problem is that a LocalFunctionSymbol needs to compute its return type, and to do that it needs access to its BoundBlock.
However, the BoundBlock needs access to the local function's return type. Recursion detection is tricky, because this property (.ReturnType)
doesn't have access to the binder where it is being accessed from (i.e. either from inside the local function, where it should report an error,
or from outside, where it should attempt to infer the return type from the block).

The current (broken) system assumes that Binder_Statements.cs BindLocalFunctionStatement will always be called (and so a block will be provided)
before any (valid) uses of the local function are bound that require knowing the return type. This assumption breaks in the IDE, where
a use of a local function may be bound before BindLocalFunctionStatement is called on the corresponding local function.
*/
internal TypeSymbol ComputeReturnType(BoundBlock body, bool returnNullIfUnknown, bool isIterator)
{
if (_returnType != null)