Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
269 commits
Select commit Hold shift + click to select a range
bd2f21a
List interesting files following match! PR
TD5 Sep 5, 2018
9fdd275
Add findings from match! and RFC process
TD5 Sep 5, 2018
e82ba1e
Clean up notes about 'letmatch!'
TD5 Sep 5, 2018
00f7f2e
Add list of things to explore for let! ... and! ...
TD5 Sep 5, 2018
92df296
Ponder `andUse!`-like construct
TD5 Sep 5, 2018
5753505
Sketch shonky and! addition to AST
TD5 Sep 5, 2018
dc097e2
Sketch shonky lexing and parsing for and!
TD5 Sep 5, 2018
5125e44
Comment on and! being its own expression type
TD5 Sep 5, 2018
e718b12
Note that and!-sequences are like lists
TD5 Sep 5, 2018
670c97a
Add detail about modeling and!s as a list
TD5 Sep 5, 2018
bf38ca2
Revert "Sketch shonky lexing and parsing for and!"
TD5 Sep 6, 2018
e59e9c3
Revert "Sketch shonky and! addition to AST"
TD5 Sep 6, 2018
b58b743
Add alternative and! model in AST
TD5 Sep 6, 2018
f26b499
Fix typo in LexFilter comments
TD5 Sep 6, 2018
98e8ff4
Mark LexFilter as a key thing to undderstand
TD5 Sep 6, 2018
f787bad
Make note to explore role of BINDER after application of lexfilter
TD5 Sep 6, 2018
1fb6c76
Add dsymes response about BINDER vs OBINER
TD5 Sep 6, 2018
c80fe72
Make and! part of the existing let!/use! expr
TD5 Sep 6, 2018
245b3f3
Sketch new parsing and lexing f and! based on existing usages of and
TD5 Sep 6, 2018
cd11672
Link to good guides for fslex and fsyacc
TD5 Sep 6, 2018
0a22a57
Make pars.fsy build
TD5 Sep 6, 2018
7b88781
Fix throwing away of first binding in a let! ... and! .. chain
TD5 Sep 6, 2018
77608d7
Try to fix range over and!s
TD5 Sep 6, 2018
05222f0
Add note about current high-level questions
TD5 Sep 6, 2018
3cee2cf
Note that I think I'll do what let does for ranges for now
TD5 Sep 6, 2018
f08d8bd
Structure my EoD thoughts
TD5 Sep 6, 2018
a4377c7
Add notes about desugaring let! ... and! ... and the prior art
TD5 Sep 7, 2018
fb28e7c
Make note about return for applicatives and yield for alt. applicatives
TD5 Sep 7, 2018
082ec6f
Sketch docs for Apply method on a CE builder
TD5 Sep 7, 2018
3b40a2c
Note a seemingly undocumented usage of Delay
TD5 Sep 7, 2018
86abfda
Define desugaring of apply
TD5 Sep 7, 2018
4f84da4
Add operator notation for applicatives desugaring example
TD5 Sep 7, 2018
4061267
Note why let! ... and! .. syntax is still useful in a world where the…
TD5 Sep 7, 2018
ec41873
Clean up last week's notes
TD5 Sep 10, 2018
571b29f
Fill out notes on optimisng desugarings etc
TD5 Sep 10, 2018
b4cfa8d
Consider liftA2 vs apply / merge
TD5 Sep 10, 2018
d84c9d5
Add notes from f2f discussion with dsyme
TD5 Sep 10, 2018
2306813
Compare apply to liftA2
TD5 Sep 10, 2018
06fd117
Record decisions from today
TD5 Sep 10, 2018
c720b57
Give an example of desugaring with let bindings
TD5 Sep 10, 2018
ab3657b
Try to make up to type checking run and stub everything else out with…
TD5 Sep 10, 2018
6da5655
Make pars.fs build
TD5 Sep 11, 2018
7a934dd
Fix build errors in ServiceLexing and Service ParseTreeWalk
TD5 Sep 11, 2018
76a7984
Fix build errors in ServiceUntypedParse
TD5 Sep 11, 2018
ec7a4ba
Fix remaining build errors from updating the AST & simplify seq CE us…
TD5 Sep 11, 2018
296b505
Add notes on surrounding work to support new feature
TD5 Sep 11, 2018
28098ec
Prepare for testing up to and excluding type checking
TD5 Sep 11, 2018
d836dba
Fix up SimpleBuilder.fsx
TD5 Sep 11, 2018
3122444
Add syntax error msg for and! keyword
TD5 Sep 11, 2018
51358d5
Note that we'll want to check both light and verbose syntax
TD5 Sep 11, 2018
9e0f937
Add link to docs on different syntaxes
TD5 Sep 11, 2018
47ae84f
Add notes on implementing offside rule for and!
TD5 Sep 11, 2018
8014dd4
Add clear error msg when we hit the unimplemented and! SeqBlock logic
TD5 Sep 11, 2018
40fd692
Point to the spec regarding offside rule
TD5 Sep 11, 2018
29e7e78
Add beginnings of offside rule for and!
TD5 Sep 11, 2018
426ed0b
Fix offside and! compile issues in parser
TD5 Sep 11, 2018
737bac1
Add notes from debugging parsing
TD5 Sep 11, 2018
fb5e729
Add braindump when trying to debug mysterious parse fail
TD5 Sep 11, 2018
2c56bdb
Move parse fail to and! token by replicating logic for handling and k…
TD5 Sep 11, 2018
8a5bdca
Move single defn terminator that follows let! to after all and!s
TD5 Sep 11, 2018
7a3238e
Fix broken ref to defn terminator
TD5 Sep 11, 2018
e2c9390
Dump more brain-state on parser debugging
TD5 Sep 12, 2018
a528ed0
Make at least one example of let! ... and! ... syntax be accepted by …
TD5 Sep 12, 2018
4e61ee6
Comment and begin sketching first TypeCheck case for and!
TD5 Sep 12, 2018
027aae0
Add first cut of desugaring a particular instance of let! ... and! ...
TD5 Sep 12, 2018
af6d91e
Add second and! to example script so I can check ordering of and! bin…
TD5 Sep 12, 2018
50ec655
Try to handle var space and add comments for fixing remaining known d…
TD5 Sep 12, 2018
13e8186
Refine desugaring of current let! ... and! ... case - a long way to g…
TD5 Sep 12, 2018
0bef48e
Add EoD notes to self
TD5 Sep 12, 2018
b93258f
Update current project state
TD5 Sep 13, 2018
f65173f
Clean up construction of Apply clause in proof-of-concept case
TD5 Sep 13, 2018
f2c9c71
Shanpshot status before pulling updates of varSpace outside construct…
TD5 Sep 13, 2018
a0d472f
Move varSpace collation up-front
TD5 Sep 13, 2018
f1c6847
Add details of recet debugging
TD5 Sep 13, 2018
8819168
Make new syntax work under certain conditions (and erroneously doubly…
TD5 Sep 13, 2018
13bf70d
Add note on how to fix "double wrapping" of functor
TD5 Sep 13, 2018
d7e5ca7
List some more interesting desugaring cases
TD5 Sep 17, 2018
fb2386b
Add alternative applicative desugaring
TD5 Sep 17, 2018
3d79a28
Add extra notes on semi-groups and active patterns on the LHS
TD5 Sep 17, 2018
27035b9
Add desugaring example with normal `let`s interspersed with `yield`s
TD5 Sep 17, 2018
4e94f1e
Fix ordering of `let` bindings in applicative CE desugarings
TD5 Sep 17, 2018
2b2f75d
Add nested applicative CE & `yield!` example desugarings
TD5 Sep 17, 2018
5a98819
Change formatting of today's notes to be clearer (bullets -> headers)
TD5 Sep 17, 2018
37ccaab
Show example of `Apply` being used to implement `Map`
TD5 Sep 17, 2018
5131035
Touch up whitespace and comments
TD5 Sep 17, 2018
5ae38bc
Fix incorrect MD for very strong emphasis
TD5 Sep 17, 2018
8755f50
Record my opinion of picking Map vs. Apply vs.Bind in simple CEs
TD5 Sep 17, 2018
a40b4e8
Record some key points for when rewriting the desugaring logic
TD5 Sep 17, 2018
395336f
Clean up my current shapshot of questions and answers
TD5 Sep 17, 2018
504f009
Note that each RHS of a binding should be evaluated at most once
TD5 Sep 17, 2018
d349584
Fix desugaring repeatedly evaluating the RHS of bindings
TD5 Sep 17, 2018
134575b
Consider the implications for side-effects for various desugarings
TD5 Sep 17, 2018
13293a9
Capture argument that facotring out bindings per yield might actually…
TD5 Sep 17, 2018
94c4bce
Refine thoughts on what logic should be commonised/duplicated in let!…
TD5 Sep 17, 2018
67d03ae
Add desugaring examples for commonising and duplicating approaches to…
TD5 Sep 17, 2018
08c6457
Add another option: ban yield inside a let! ... and! ...
TD5 Sep 17, 2018
4f7b311
Add some more arguments around possible desugarings
TD5 Sep 17, 2018
9d5b591
Make the "duplication" approach more internally consistent
TD5 Sep 17, 2018
17f66f1
Appeal to example with loops as prior art for the commising vs. dupli…
TD5 Sep 17, 2018
3c1271d
Make the potential side-effects more clear in my examples
TD5 Sep 17, 2018
3dd69dd
Add note on `use!`
TD5 Sep 17, 2018
16a82c4
Fix let location in desugaring
TD5 Sep 17, 2018
d2bb47c
Record @Nick's suggestions and contributions after our discussion
TD5 Sep 17, 2018
0ddb19f
Make `let`s slightly more interesting in @Nick's example
TD5 Sep 17, 2018
8c3fb51
Clean up comments on Nick's example
TD5 Sep 17, 2018
e39ddc5
Fix mistakes in `let! ... and! ...` desugaring
TD5 Sep 18, 2018
b5c9e05
Give an example of using `yield` when `Bind` is not implemented
TD5 Sep 18, 2018
1666c0a
Add some more comments around new `Apply` syntax
TD5 Sep 18, 2018
d401588
Add note on syntax for calling a "wrapped" function
TD5 Sep 18, 2018
cbc0f80
Snapshot before separating applies from lambdas
TD5 Sep 18, 2018
d48cde9
Separate applies from lambdas
TD5 Sep 18, 2018
244aec2
Keep Return along side its expr
TD5 Sep 18, 2018
9da6da9
Change creation of match lambdas to happen immediately
TD5 Sep 18, 2018
7dc2916
Clean up creation of match lambdas
TD5 Sep 18, 2018
f3af277
Make desugaring work for SimpleBuilder.fsx
TD5 Sep 18, 2018
7ebe676
Make SimpleBuilder.fsx show off None code path and pattern maching on…
TD5 Sep 18, 2018
190674c
Remove bind from builder in SimpleBuilder.fsx to prove it is not needed
TD5 Sep 18, 2018
490bb93
Add example let binding inside a return in SimpleBuilder.fsx
TD5 Sep 18, 2018
3de3c3d
Make let-bound value in the return actually get used in example CE
TD5 Sep 18, 2018
9a303d5
Remove hacky debug printing
TD5 Sep 18, 2018
54a9c37
Update Log.md with progress and next steps
TD5 Sep 18, 2018
12eca83
Add note about considering moving requirement for `return` after `let…
TD5 Sep 18, 2018
66f905d
Add `use! ... anduse! ...` TODO to list
TD5 Sep 18, 2018
84363ce
Add first cut for a desugaring of `use! ... anduse! ...`
TD5 Sep 18, 2018
29a409d
Add like to scott w's trace builder example
TD5 Sep 18, 2018
3209f98
Enhance SimpleBuilder.fsx to show type checking bug
TD5 Sep 19, 2018
d2a795a
Add more explicit typings
TD5 Sep 19, 2018
a5978e3
Move Apply calls inside translation
TD5 Sep 19, 2018
ff11395
Move everything but expr inside return into translation. Broken becau…
TD5 Sep 19, 2018
3b4da1d
Move Return back outside this round of translation - I think everythi…
TD5 Sep 19, 2018
7dae6d2
Move Return back inside this round of translation, but replace CE key…
TD5 Sep 19, 2018
875b900
Fix naming of unused value
TD5 Sep 19, 2018
c06c1d7
Add missing check for a Return impl. on the builder
TD5 Sep 19, 2018
6a7e80d
Add what I think should be the desugaring of the most simple example,…
TD5 Sep 19, 2018
8f2c5dc
Set up type checker for more detailed debugging of desugarings
TD5 Sep 19, 2018
7e566e0
Sketch alternative applicatives example
TD5 Sep 19, 2018
f75d043
Show example of an alternative applicative with no Bind in sight!
TD5 Sep 19, 2018
9e695f6
Give example of mixed inline and bound alternative applicatives
TD5 Sep 19, 2018
5f29c47
Make the quux an example of loads of nested stuff for an alternative …
TD5 Sep 19, 2018
3a2fd42
Wrap quux example in comments
TD5 Sep 19, 2018
8e222ff
Add example of `and! _ = ...` working
TD5 Sep 19, 2018
35779a8
Add notes about use! and yield!
TD5 Sep 19, 2018
9d2a2d3
Refine in light of feedback
TD5 Sep 24, 2018
9d9921b
Fix spelling mistakes etc
TD5 Sep 24, 2018
8f2b0e5
Clean up after additional feedback
TD5 Sep 24, 2018
afbaafb
Merge branch 'master' into master
TD5 Sep 24, 2018
7944098
Delete Log.md
TD5 Sep 24, 2018
0171c5d
Add note about order of args to Apply - be consistent with bind, or w…
TD5 Sep 24, 2018
1df37ae
Merge branch 'master' of https://github.com/TD5/visualfsharp
TD5 Sep 24, 2018
706db99
Fix bad merge
TD5 Sep 24, 2018
3bc18fa
Update xlf
TD5 Sep 25, 2018
890567e
Sketch out desugaring of use! ... anduse! ... to builder.MapUsing(...)
TD5 Sep 26, 2018
f976ff8
Update example to flush out issues in desugaring - probably varSpace
TD5 Sep 26, 2018
57ebdfa
Remove varSpace and trans from let! ... and! ... / use! ... anduse! .…
TD5 Sep 26, 2018
3ae17d1
Fix up SimpleBuilder to not introduce delay (mainly becaue it has the…
TD5 Sep 26, 2018
8133003
Add note to remove call to mkSourceExpr for applicative CEs
TD5 Sep 26, 2018
dd27210
Add logging to check order of events for disposal
TD5 Sep 27, 2018
120e024
Move `builder.MapUsing` calls inside match lambdas
TD5 Sep 27, 2018
6a4ea59
Sketch out an applicative form of Eventually
TD5 Sep 27, 2018
a6de7f3
Remove old debugging failwith and comments
TD5 Sep 27, 2018
6b6c344
Remove debug printfns and comments
TD5 Sep 28, 2018
4a61eaf
Create new error message for applicative CEs that who body isn't an i…
TD5 Sep 28, 2018
d49142c
Remove unneeded debug printfn
TD5 Sep 28, 2018
f1d3ed7
Add more specific error for pattern matching on the LHS of a use! ...…
TD5 Sep 28, 2018
06aa8f0
Sketch new error msg tests for applicative CEs
TD5 Oct 1, 2018
56bd67b
Add new applicative CE error messages to FSharp.Compiler.Private
TD5 Oct 1, 2018
34b1392
Add new applicative CE tests to main test.lst
TD5 Oct 1, 2018
b845f52
Make new applicative CE error msg tests pass locally
TD5 Oct 1, 2018
f88bcce
Sketch unit tests which require support for applicative CEs
TD5 Oct 1, 2018
9826ea0
Move happy-path applicative CE tests to their own fsharpqa directory
TD5 Oct 1, 2018
9816252
Move happy-path applicative CE tests towards a fsx style
TD5 Oct 1, 2018
bd93b04
Make new CE tests closer to existing ones
TD5 Oct 1, 2018
4256678
Merge branch 'master' into master
TD5 Oct 1, 2018
eb6e16e
Reshuffle new tests in somewhat desparate hopes for a cache miss
TD5 Oct 1, 2018
a7832b6
Make new applicative CE tests match FSI output correctly
TD5 Oct 2, 2018
53f924b
Merge branch 'master' of https://github.com/TD5/visualfsharp
TD5 Oct 2, 2018
e4cb70e
Accept empty ine output by FSI
TD5 Oct 2, 2018
408b4cd
Move to less noisy Expects syntax
TD5 Oct 2, 2018
c2d2ced
Move new applicative CE tests from scripts to normal source files
TD5 Oct 2, 2018
dc6be5f
Make new happy-path applicative CE tests pass locally
TD5 Oct 2, 2018
155a350
Move new applicative CE tests aling side existing CE tests
TD5 Oct 2, 2018
080f856
Merge branch 'master' of https://github.com/Microsoft/visualfsharp
TD5 Oct 2, 2018
fb33b7e
Include and! LHS patterns when searching for idents
TD5 Oct 2, 2018
c80c216
Include and! LHS patterns when searching for idents
TD5 Oct 2, 2018
284df84
Allow break points at and! seq point bindings
TD5 Oct 2, 2018
044a59a
Merge branch 'master' of https://github.com/TD5/visualfsharp
TD5 Oct 2, 2018
2fc66d5
Tweak vanilla let! ... and! ... test to show two functors "wrapping" …
TD5 Oct 3, 2018
a162c67
Speculatively recover from errors a bit earlier when parsing bindings…
TD5 Oct 3, 2018
d170402
Merge branch 'master' of https://github.com/Microsoft/visualfsharp
TD5 Oct 3, 2018
5819594
Give full completion list when an expected entry cannot be found
TD5 Oct 3, 2018
85bf4f6
Don't discard applicative bindings if the later body has an error
TD5 Oct 3, 2018
b5010b5
Add TODO note about parse errors somewhere in the middle of an and! s…
TD5 Oct 3, 2018
3b1af4a
Comment out older error handling parser case for let! ... and! ... to…
TD5 Oct 3, 2018
af288cb
Add legacy language service tests for completion in an applicative CE
TD5 Oct 4, 2018
1d0d075
Fix and refine legacy completion tests for applicative CEs
TD5 Oct 4, 2018
8fec2ca
Get rid of redundant completion list
TD5 Oct 4, 2018
05bc252
rm swap file
TD5 Oct 5, 2018
26a5e10
Remove experimental script
TD5 Oct 8, 2018
f6097ee
Fix error message that said "return" was expected. "and!"/"anduse!" a…
TD5 Oct 8, 2018
7238ab4
Change order of keywords as they appear in FS3243 to match order they…
TD5 Oct 8, 2018
b243d33
Expand on applicative error tests so that they map nicely to the exam…
TD5 Oct 9, 2018
e6c4e9e
Add missing test definition and comment
TD5 Oct 9, 2018
c4cd688
Give test file names with their descriptions
TD5 Oct 9, 2018
383aa5c
Make E_MoreAfterReturn a more plausible error case
TD5 Oct 9, 2018
cd1ef5f
Add a new error message for yield instead of return in an applicative CE
TD5 Oct 9, 2018
a2c8147
Add custom error messages for applicative computation expressions wit…
TD5 Oct 9, 2018
3ab2af8
Fix tests for some examples of common applicative CE mistakes
TD5 Oct 9, 2018
bc77c64
Give test file names to make locating failing tests easier
TD5 Oct 9, 2018
b690bd1
Add new error message for extra expressions being sequenced after ret…
TD5 Oct 9, 2018
f675fb7
Change expected error messages for cases which look more monadic than…
TD5 Oct 9, 2018
f2c94c2
'Fix' test by chainging expectation: Case is currently somewhat ambig…
TD5 Oct 9, 2018
3850eb4
s/MapUsing/ApplyUsing/
TD5 Oct 9, 2018
7864b94
Remove some trailing whitespace
TD5 Oct 9, 2018
828ab63
Remove trailing newline - will that satisfy CI?
TD5 Oct 9, 2018
c1fef16
Remove trailing whitespace
TD5 Oct 9, 2018
89e1e0f
Promote error msgs to buildfromsource
TD5 Oct 9, 2018
f9e0866
Merge branch 'master' of https://github.com/Microsoft/visualfsharp
TD5 Oct 10, 2018
d588f40
Add test for error msgs for missing builder methods
TD5 Oct 10, 2018
39ce20a
Fix tests
TD5 Oct 10, 2018
b09776a
Generalise Scope.LetOrUseBang given new syntax
TD5 Oct 10, 2018
fc9bb61
Add missed file to generalise Scope.LetOrUseBang
TD5 Oct 10, 2018
d2d426e
Pull naming of SynExpr and Scope cases into line
TD5 Oct 10, 2018
472d856
Reduce guarantees for VS autocomplete
TD5 Oct 10, 2018
802e1ce
Remove toy .fsx file
TD5 Oct 10, 2018
fa73455
Remove reference to SimpleBuilder.fsx
TD5 Oct 10, 2018
ecad993
Simplify pattern matching using named DU case args
TD5 Oct 10, 2018
f640c21
Clean up comments and formatting
TD5 Oct 10, 2018
25dced3
Merge branch 'master' of https://github.com/TD5/visualfsharp
TD5 Oct 10, 2018
f0e67c9
Use more named DU args to make intent clearer
TD5 Oct 10, 2018
5d8e0cc
Use new name for let! ... syntax node
TD5 Oct 10, 2018
2ed50a5
Fix more let! ... syntax node rename fallout
TD5 Oct 10, 2018
d663cf0
Fix do! using old let! ... stntax node name
TD5 Oct 10, 2018
95753df
Tidy comments in TypeChecker.fs
TD5 Oct 10, 2018
ebfb8a4
Clean up for comments and code style
TD5 Oct 10, 2018
7cb2c73
Add test showing Delay and Run working
TD5 Oct 10, 2018
a0f13a9
Test Run and Delay translation separately
TD5 Oct 10, 2018
1206821
Fix missing punctuation in comment
TD5 Oct 10, 2018
03002cf
Remove old TODO
TD5 Oct 10, 2018
062d6ef
Add err msg for yield!/return! instead of return
TD5 Oct 15, 2018
96f189b
Capture Bind preceding Apply being accepted
TD5 Oct 15, 2018
c90e522
Tidy applicative-after-monad CE test
TD5 Oct 15, 2018
0796932
Specualtively reintroduce `let! ... and! ... error` case
TD5 Oct 19, 2018
9d9d2e3
Merge branch 'master' of https://github.com/Microsoft/visualfsharp
TD5 Oct 20, 2018
63a898d
Add missing autogen'd resources
TD5 Oct 22, 2018
db519dd
integrate master
dsyme Mar 12, 2019
bdfda97
integrate master
dsyme Mar 12, 2019
7e35e8f
Merge branch 'diag4' into TD5-master
dsyme Mar 12, 2019
b26d173
merge master
dsyme Oct 18, 2019
0a95da5
merge master
dsyme Oct 18, 2019
bffc110
Merge branch 'master' of http://github.com/Microsoft/visualfsharp int…
dsyme Oct 22, 2019
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
5,853 changes: 5,853 additions & 0 deletions src/buildfromsource/FSharp.Compiler.Private/FSComp.fs

Large diffs are not rendered by default.

4,419 changes: 4,419 additions & 0 deletions src/buildfromsource/FSharp.Compiler.Private/FSComp.resx

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/fsharp/CompileOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,8 @@ let OutputPhasedErrorR (os: StringBuilder) (err: PhasedDiagnostic) (canSuggestNa
| Parser.TOKEN_OLET(_) -> getErrorString("Parser.TOKEN.OLET")
| Parser.TOKEN_OBINDER
| Parser.TOKEN_BINDER -> getErrorString("Parser.TOKEN.BINDER")
| Parser.TOKEN_OAND_BANG
| Parser.TOKEN_AND_BANG -> getErrorString("Parser.TOKEN.AND.BANG")
| Parser.TOKEN_ODO -> getErrorString("Parser.TOKEN.ODO")
| Parser.TOKEN_OWITH -> getErrorString("Parser.TOKEN.OWITH")
| Parser.TOKEN_OFUNCTION -> getErrorString("Parser.TOKEN.OFUNCTION")
Expand Down
5 changes: 5 additions & 0 deletions src/fsharp/FSComp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1466,6 +1466,11 @@ notAFunctionButMaybeDeclaration,"This value is not a function and cannot be appl
3251,chkNoFirstClassNameOf,"Using the 'nameof' operator as a first-class function value is not permitted."
3300,chkInvalidFunctionParameterType,"The parameter '%s' has an invalid type '%s'. This is not permitted by the rules of Common IL."
3301,chkInvalidFunctionReturnType,"The function or method has an invalid return type '%s'. This is not permitted by the rules of Common IL."
3343,tcApplicativeComputationExpressionNotImmediatelyTerminatedWithReturn,"Expecting 'and!', 'anduse!' or 'return' but saw something else. Applicative computation expressions must be of the form 'let! <pat1> = <expr2> and! <pat2> = <expr2> and! ... and! <patN> = <exprN> return <exprBody>'."
3344,tcInvalidAndUseBangBinding,"Pattern matching is not allowed on the left-hand side of the equals. 'use! ... anduse! ...' bindings must be of the form 'use! <var> = <expr>' or 'anduse! <var> = <expr>'."
3345,tcInvalidKeywordInsteadOfReturnInApplicativeComputationExpression,"'%s' is not valid in this position in an applicative computation expression. Did you mean 'return' instead?"
3346,parsNoBodyInApplicativeComputationExpression,"No body given after the applicative bindings. Expected a 'return' to terminate this applicative computation expression."
3347,tcMoreAfterReturnInApplicativeComputationExpression,"Saw unexpected expression sequenced after 'return'. Applicative computation expressions must be terminated with a single 'return'."
useSdkRefs,"Use reference assemblies for .NET framework references when available (Enabled by default)."
fSharpBannerVersion,"%s for F# %s"
nativeResourceFormatError,"Stream does not begin with a null resource and is not in '.RES' format."
Expand Down
3 changes: 3 additions & 0 deletions src/fsharp/FSStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,9 @@
<data name="Parser.TOKEN.AND" xml:space="preserve">
<value>keyword 'and'</value>
</data>
!<data name="Parser.TOKEN.AND.BANG" xml:space="preserve">
<value>keyword 'and!'</value>
</data>
<data name="Parser.TOKEN.AS" xml:space="preserve">
<value>keyword 'as'</value>
</data>
Expand Down
7 changes: 7 additions & 0 deletions src/fsharp/LexFilter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1737,6 +1737,13 @@ type LexFilterImpl (lightSyntaxStatus: LightSyntaxStatus, compilingFsLib, lexer,
pushCtxt tokenTup (CtxtLetDecl(blockLet, tokenStartPos))
returnToken tokenLexbufState (if blockLet then OBINDER b else token)

// and! ... ~~~> CtxtLetDecl
| AND_BANG isUse, (ctxt :: _) ->
let blockLet = match ctxt with CtxtSeqBlock _ -> true | _ -> false
if debug then dprintf "AND!: entering CtxtLetDecl(blockLet=%b), awaiting EQUALS to go to CtxtSeqBlock (%a)\n" blockLet outputPos tokenStartPos
pushCtxt tokenTup (CtxtLetDecl(blockLet,tokenStartPos))
returnToken tokenLexbufState (if blockLet then OAND_BANG isUse else token)

| (VAL | STATIC | ABSTRACT | MEMBER | OVERRIDE | DEFAULT), ctxtStack when thereIsACtxtMemberBodyOnTheStackAndWeShouldPopStackForUpcomingMember ctxtStack ->
if debug then dprintf "STATIC/MEMBER/OVERRIDE/DEFAULT: already inside CtxtMemberBody, popping all that context before starting next member...\n"
// save this token, we'll consume it again later...
Expand Down
156 changes: 138 additions & 18 deletions src/fsharp/TypeChecker.fs
100644 → 100755

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions src/fsharp/ast.fs
Original file line number Diff line number Diff line change
Expand Up @@ -766,12 +766,16 @@ and
/// Computation expressions only
| YieldOrReturnFrom of (bool * bool) * expr: SynExpr * range: range

/// SynExpr.LetOrUseBang (spBind, isUse, isFromSource, pat, rhsExpr, bodyExpr, mWholeExpr).
/// SynExpr.LetOrUseAndBang (spBind, isUse, isFromSource, pat, rhsExpr, mLetBangExpr, [(andBangSpBind, andBangIsUse, andBangIsFromSource, andBangPat, andBangRhsExpr, mAndBangExpr)], bodyExpr).
///
/// F# syntax: let! pat = expr in expr
/// F# syntax: use! pat = expr in expr
/// F# syntax: let! pat = expr and! ... and! ... and! pat = expr in expr
/// F# syntax: use! pat = expr and! ... and! ... and! pat = expr in expr
/// F# syntax: let! pat = expr anduse! ... and! ... and! pat = expr in expr
/// F# syntax: use! pat = expr and! ... anduse! ... and! pat = expr in expr
/// Computation expressions only
| LetOrUseBang of bindSeqPoint: SequencePointInfoForBinding * isUse: bool * isFromSource: bool * SynPat * SynExpr * SynExpr * range: range
| LetOrUseBang of bindSeqPoint: SequencePointInfoForBinding * isUse: bool * isFromSource: bool * SynPat * rhs:SynExpr * range:range * andBangs:(SequencePointInfoForBinding * bool * bool * SynPat * SynExpr * range) list * body:SynExpr

/// F# syntax: match! expr with pat1 -> expr | ... | patN -> exprN
| MatchBang of matchSeqPoint: SequencePointInfoForBinding * expr: SynExpr * clauses: SynMatchClause list * range: range (* bool indicates if this is an exception match in a computation expression which throws unmatched exceptions *)
Expand Down Expand Up @@ -2484,6 +2488,6 @@ let rec synExprContainsError inpExpr =

| SynExpr.MatchBang (_, e, cl, _) ->
walkExpr e || walkMatchClauses cl
| SynExpr.LetOrUseBang (_, _, _, _, e1, e2, _) ->
walkExpr e1 || walkExpr e2
| SynExpr.LetOrUseBang (rhs=e1;body=e2;andBangs=es) ->
walkExpr e1 || walkExprs [ for (_,_,_,_,e,_) in es do yield e ] || walkExpr e2
walkExpr inpExpr
6 changes: 5 additions & 1 deletion src/fsharp/lex.fsl
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,14 @@ rule token args skip = parse
{ YIELD_BANG(false) }
| "match!"
{ MATCH_BANG }
| "and!"
{ AND_BANG(false) }
| "anduse!"
Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting, I hadn't considered anduse!.

{ AND_BANG(true) }
| ident '!'
{ let tok = Keywords.KeywordOrIdentifierToken args lexbuf (lexemeTrimRight lexbuf 1)
match tok with
| LET _ -> BINDER (lexemeTrimRight lexbuf 1)
| LET _ -> BINDER (lexemeTrimRight lexbuf 1)
| _ -> fail args lexbuf (FSComp.SR.lexIdentEndInMarkReserved("!")) (Keywords.KeywordOrIdentifierToken args lexbuf (lexeme lexbuf)) }
| ident ('#')
{ fail args lexbuf (FSComp.SR.lexIdentEndInMarkReserved("#")) (Keywords.KeywordOrIdentifierToken args lexbuf (lexeme lexbuf)) }
Expand Down
67 changes: 48 additions & 19 deletions src/fsharp/pars.fsy
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ let rangeOfLongIdent(lid:LongIdent) =
%token <char> CHAR
%token <System.Decimal> DECIMAL
%token <(string * string)> BIGNUM
%token <bool> LET YIELD YIELD_BANG
%token <bool> LET YIELD YIELD_BANG AND_BANG
%token <bool> LESS GREATER /* here the bool indicates if the tokens are part of a type application or type parameter declaration, e.g. C<int>, detected by the lex filter */
%token <string> PERCENT_OP BINDER
%token <string * bool> LQUOTE RQUOTE RQUOTE_DOT
Expand Down Expand Up @@ -218,6 +218,7 @@ let rangeOfLongIdent(lid:LongIdent) =
/* for offside rule */
%token <bool> OLET /* LexFilter #light converts 'LET' tokens to 'OLET' when starting (CtxtLetDecl(blockLet=true)) */
%token <string> OBINDER /* LexFilter #light converts 'BINDER' tokens to 'OBINDER' when starting (CtxtLetDecl(blockLet=true)) */
%token <bool> OAND_BANG /* LexFilter #light converts 'AND_BANG' tokens to 'OAND_BANG' when starting (CtxtLetDecl(blockLet=true)) */
%token ODO /* LexFilter #light converts 'DO' tokens to 'ODO' */
%token ODO_BANG /* LexFilter #light converts 'DO_BANG' tokens to 'ODO_BANG' */
%token OTHEN /* LexFilter #light converts 'THEN' tokens to 'OTHEN' */
Expand Down Expand Up @@ -453,6 +454,7 @@ let rangeOfLongIdent(lid:LongIdent) =
%nonassoc paren_pat_attribs
%left OR BAR_BAR JOIN_IN
%left AND /* check */
%left AND_BANG /* check */
%left AMP AMP_AMP
%nonassoc pat_conj
%nonassoc expr_not
Expand Down Expand Up @@ -3044,6 +3046,48 @@ recover:
| error { debugPrint("recovering via error"); true }
| EOF { debugPrint("recovering via EOF"); false }

binders:
| BINDER headBindingPattern EQUALS typedSeqExprBlock IN opt_OBLOCKSEP morebinders typedSeqExprBlock %prec expr_let
{ let spBind = SequencePointAtBinding(rhs2 parseState 1 5)
let m = unionRanges (rhs parseState 1) $8.Range
SynExpr.LetOrUseBang(spBind,($1 = "use"),true,$2,$4,m,$7,$8) }

| OBINDER headBindingPattern EQUALS typedSeqExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP morebinders typedSeqExprBlock %prec expr_let
{ $5 (if $1 = "use" then "use!" else "let!") (rhs parseState 1) // report unterminated error
let spBind = SequencePointAtBinding(unionRanges (rhs parseState 1) $4.Range)
let m = unionRanges (rhs parseState 1) $8.Range
SynExpr.LetOrUseBang(spBind,($1 = "use"),true,$2,$4,m,$7,$8) }

| OBINDER headBindingPattern EQUALS typedSeqExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP morebinders error %prec expr_let
{ // error recovery that allows intellisense when writing incomplete computation expressions
let spBind = SequencePointAtBinding(unionRanges (rhs parseState 1) $4.Range)
let mAll = unionRanges (rhs parseState 1) (rhs parseState 7) // TODO Check this range
let m = $4.Range.EndRange // zero-width range
SynExpr.LetOrUseBang(spBind,($1 = "use"),true,$2,$4, mAll, $7, SynExpr.ImplicitZero m) }

| OBINDER headBindingPattern EQUALS typedSeqExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP error %prec expr_let
{ // error recovery that allows intellisense when writing incomplete computation expressions
let spBind = SequencePointAtBinding(unionRanges (rhs parseState 1) $4.Range)
let mAll = unionRanges (rhs parseState 1) (rhs parseState 7)
let m = $4.Range.EndRange // zero-width range
SynExpr.LetOrUseBang(spBind,($1 = "use"),true,$2,$4, mAll, [], SynExpr.ImplicitZero m) }

morebinders:
| AND_BANG headBindingPattern EQUALS typedSeqExprBlock IN morebinders %prec expr_let /* TODO Check precedence */
{ let spBind = SequencePointAtBinding(rhs2 parseState 1 5) (* TODO Pretty sure this is wrong *)
let m = rhs parseState 1 (* TODO Pretty sure this is wrong *)
(spBind,$1,true,$2,$4,m) :: $6 }

| OAND_BANG headBindingPattern EQUALS typedSeqExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP morebinders %prec expr_let
{ $5 (if $1 then "anduse!" else "and!") (rhs parseState 1) // report unterminated error
let spBind = SequencePointAtBinding(rhs2 parseState 1 5) (* TODO Pretty sure this is wrong *)
let m = rhs parseState 1 (* TODO Pretty sure this is wrong *)
(spBind,$1,true,$2,$4,m) :: $7 }

/* TODO What if there's an error halfway through the list of and! bindings? Probably okay since each and! is out of scope of the other */

| %prec prec_no_more_attr_bindings /* TODO Make a prec_no_more_andbang_bindings or something */
{ [] }

declExpr:
| defnBindings IN typedSeqExpr %prec expr_let
Expand Down Expand Up @@ -3337,27 +3381,12 @@ declExpr:
| YIELD_BANG declExpr
{ SynExpr.YieldOrReturnFrom (($1,not $1), $2, unionRanges (rhs parseState 1) $2.Range) }

| BINDER headBindingPattern EQUALS typedSeqExprBlock IN opt_OBLOCKSEP typedSeqExprBlock %prec expr_let
{ let spBind = SequencePointAtBinding(rhs2 parseState 1 5)
let m = unionRanges (rhs parseState 1) $7.Range
SynExpr.LetOrUseBang (spBind,($1 = "use"),true,$2,$4,$7,m) }

| OBINDER headBindingPattern EQUALS typedSeqExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP typedSeqExprBlock %prec expr_let
{ $5 (if $1 = "use" then "use!" else "let!") (rhs parseState 1) // report unterminated error
let spBind = SequencePointAtBinding(unionRanges (rhs parseState 1) $4.Range)
let m = unionRanges (rhs parseState 1) $7.Range
SynExpr.LetOrUseBang (spBind,($1 = "use"),true,$2,$4,$7,m) }

| OBINDER headBindingPattern EQUALS typedSeqExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP error %prec expr_let
{ // error recovery that allows intellisense when writing incomplete computation expressions
let spBind = SequencePointAtBinding(unionRanges (rhs parseState 1) $4.Range)
let mAll = unionRanges (rhs parseState 1) (rhs parseState 7)
let m = $4.Range.EndRange // zero-width range
SynExpr.LetOrUseBang (spBind,($1 = "use"),true,$2,$4, SynExpr.ImplicitZero m, mAll) }
| binders
{ $1 }

| DO_BANG typedSeqExpr IN opt_OBLOCKSEP typedSeqExprBlock %prec expr_let
{ let spBind = NoSequencePointAtDoBinding
SynExpr.LetOrUseBang (spBind,false,true,SynPat.Const(SynConst.Unit,$2.Range),$2,$5, unionRanges (rhs parseState 1) $5.Range) }
SynExpr.LetOrUseBang(spBind,false,true,SynPat.Const(SynConst.Unit,$2.Range),$2, unionRanges (rhs parseState 1) $5.Range, [], $5) }

| ODO_BANG typedSeqExprBlock hardwhiteDefnBindingsTerminator %prec expr_let
{ SynExpr.DoBang ($2, unionRanges (rhs parseState 1) $2.Range) }
Expand Down
8 changes: 6 additions & 2 deletions src/fsharp/service/ServiceAssemblyContent.fs
Original file line number Diff line number Diff line change
Expand Up @@ -705,9 +705,13 @@ module ParsedInput =
addLongIdentWithDots ident
List.iter walkExpr [e1; e2; e3]
| SynExpr.JoinIn (e1, _, e2, _) -> List.iter walkExpr [e1; e2]
| SynExpr.LetOrUseBang (_, _, _, pat, e1, e2, _) ->
| SynExpr.LetOrUseBang (_, _, _, pat, e1, _, es, e2) ->
walkPat pat
List.iter walkExpr [e1; e2]
walkExpr e1
for (_,_,_,patAndBang,eAndBang,_) in es do
walkPat patAndBang
walkExpr eAndBang
walkExpr e2
| SynExpr.TraitCall (ts, sign, e, _) ->
List.iter walkTypar ts
walkMemberSig sign
Expand Down
10 changes: 8 additions & 2 deletions src/fsharp/service/ServiceInterfaceStubGenerator.fs
Original file line number Diff line number Diff line change
Expand Up @@ -896,8 +896,14 @@ module InterfaceStubGenerator =
| SynExpr.DoBang (synExpr, _range) ->
walkExpr synExpr

| SynExpr.LetOrUseBang (_sequencePointInfoForBinding, _, _, _synPat, synExpr1, synExpr2, _range) ->
List.tryPick walkExpr [synExpr1; synExpr2]
| SynExpr.LetOrUseBang (_sequencePointInfoForBinding, _, _, _synPat, synExpr1, _range, synExprAndBangs, synExpr2) ->
[
yield synExpr1
for (_,_,_,_,eAndBang,_) in synExprAndBangs do
yield eAndBang
yield synExpr2
]
|> List.tryPick walkExpr

| SynExpr.LibraryOnlyILAssembly _
| SynExpr.LibraryOnlyStaticOptimization _
Expand Down
4 changes: 2 additions & 2 deletions src/fsharp/service/ServiceLexing.fs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,14 @@ module internal TokenClassifications =
| MEMBER | STATIC | NAMESPACE
| OASSERT | OLAZY | ODECLEND | OBLOCKSEP | OEND | OBLOCKBEGIN | ORIGHT_BLOCK_END
| OBLOCKEND | OBLOCKEND_COMING_SOON | OBLOCKEND_IS_HERE | OTHEN | OELSE | OLET(_)
| OBINDER _ | BINDER _ | ODO | OWITH | OFUNCTION | OFUN | ORESET | ODUMMY _ | DO_BANG
| OBINDER _ | OAND_BANG _ | BINDER _ | ODO | OWITH | OFUNCTION | OFUN | ORESET | ODUMMY _ | DO_BANG
| ODO_BANG | YIELD _ | YIELD_BANG _ | OINTERFACE_MEMBER
| ELIF | RARROW | LARROW | SIG | STRUCT
| UPCAST | DOWNCAST | NULL | RESERVED | MODULE | AND | AS | ASSERT | ASR
| DOWNTO | EXCEPTION | FALSE | FOR | FUN | FUNCTION
| FINALLY | LAZY | MATCH | MATCH_BANG | MUTABLE | NEW | OF | OPEN | OR | VOID | EXTERN
| INTERFACE | REC | TO | TRUE | TRY | TYPE | VAL | INLINE | WHEN | WHILE | WITH
| IF | THEN | ELSE | DO | DONE | LET(_) | IN (*| NAMESPACE*) | CONST
| IF | THEN | ELSE | DO | DONE | LET(_) | AND_BANG(_) | IN (*| NAMESPACE*) | CONST
| HIGH_PRECEDENCE_PAREN_APP | FIXED
| HIGH_PRECEDENCE_BRACK_APP
| TYPE_COMING_SOON | TYPE_IS_HERE | MODULE_COMING_SOON | MODULE_IS_HERE ->
Expand Down
14 changes: 10 additions & 4 deletions src/fsharp/service/ServiceParseTreeWalk.fs
Original file line number Diff line number Diff line change
Expand Up @@ -473,10 +473,16 @@ module public AstTraversal =
| SynExpr.ImplicitZero (_range) -> None
| SynExpr.YieldOrReturn (_, synExpr, _range) -> traverseSynExpr synExpr
| SynExpr.YieldOrReturnFrom (_, synExpr, _range) -> traverseSynExpr synExpr
| SynExpr.LetOrUseBang (_sequencePointInfoForBinding, _, _, synPat, synExpr, synExpr2, _range) ->
[dive synPat synPat.Range traversePat
dive synExpr synExpr.Range traverseSynExpr
dive synExpr2 synExpr2.Range traverseSynExpr]
| SynExpr.LetOrUseBang(_sequencePointInfoForBinding, _, _, synPat, synExpr, _range, andBangSynExprs, synExpr2) ->
[
yield dive synPat synPat.Range traversePat
yield dive synExpr synExpr.Range traverseSynExpr
yield!
[ for (_,_,_,andBangSynPat,andBangSynExpr,_) in andBangSynExprs do
yield (dive andBangSynPat andBangSynPat.Range traversePat)
yield (dive andBangSynExpr andBangSynExpr.Range traverseSynExpr)]
yield dive synExpr2 synExpr2.Range traverseSynExpr
]
|> pick expr
| SynExpr.MatchBang (_sequencePointInfoForBinding, synExpr, synMatchClauseList, _range) ->
[yield dive synExpr synExpr.Range traverseSynExpr
Expand Down
25 changes: 16 additions & 9 deletions src/fsharp/service/ServiceStructure.fs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ module Structure =
| Attribute -> "Attribute"
| Interface -> "Interface"
| HashDirective -> "HashDirective"
| LetOrUseBang -> "LetOrUseBang"
| LetOrUseBang -> "LetOrUseBang"
| TypeExtension -> "TypeExtension"
| YieldOrReturn -> "YieldOrReturn"
| YieldOrReturnBang -> "YieldOrReturnBang"
Expand Down Expand Up @@ -245,14 +245,21 @@ module Structure =
| SynExpr.DoBang (e, r) ->
rcheck Scope.Do Collapse.Below r <| Range.modStart 3 r
parseExpr e
| SynExpr.LetOrUseBang (_, _, _, pat, e1, e2, _) ->
// for `let!` or `use!` the pattern begins at the end of the keyword so that
// this scope can be used without adjustment if there is no `=` on the same line
// if there is an `=` the range will be adjusted during the tooltip creation
let r = Range.endToEnd pat.Range e1.Range
rcheck Scope.LetOrUseBang Collapse.Below r r
parseExpr e1
parseExpr e2
| SynExpr.LetOrUseBang (_,_,_,pat,eLet,_,es,eBody) ->
[
yield eLet
yield! [ for (_,_,_,_,eAndBang,_) in es do yield eAndBang ]
]
|> List.iter (fun e ->
// for `let!`, `use!`, `and!` or `anduse!` the pattern begins at the end of the
// keyword so that this scope can be used without adjustment if there is no `=`
// on the same line. If there is an `=` the range will be adjusted during the
// tooltip creation
let r = Range.endToEnd pat.Range e.Range
rcheck Scope.LetOrUseBang Collapse.Below r r
parseExpr e
)
parseExpr eBody
| SynExpr.For (_, _, _, _, _, e, r)
| SynExpr.ForEach (_, _, _, _, _, e, r) ->
rcheck Scope.For Collapse.Below r r
Expand Down
Loading