Comments (4)
minified repro
type Class1() =
static member A(a: 'a) = ()
static member B(rng: 'b) =
let rec go a =
if a then go a
else <@@ rng @@>
1
from fsharp.
@vladima discussed with me that the underlying cause is the reallocation of the reference cell in the Expr.Quote node by the "instExpr" operation inside ChooseTyparSolutionsForFreeChoiceTypars. This means "check.fs" doesn't correctly fill in the AST value of the quotation for the untyped quotation.
| Expr.Quote (a,{contents=None},isFromQueryExpression,m,ty) ->
Expr.Quote (remapExpr g (fixValCopyFlagForQuotations compgen) tmenv a,{contents=None},isFromQueryExpression,m,remapType tmenv ty)
I believe this node should not be reallocated in this pass. I suggest adding a new flag CloneAllKeepReferenceCells
to ValCopyFlag:
type ValCopyFlag =
| CloneAll
| CloneAllKeepReferenceCells <-- add this
| CloneAllAndMarkExprValsAsCompilerGenerated
| OnlyCloneExprVals
and adding a boolean flag into instExpr
and ChooseTyparSolutionsForFreeChoiceTypars
which activates this flag, and returning the original reference cell when this flag is active
| Expr.Quote (a,({contents=None} as origRefCell),isFromQueryExpression,m,ty) ->
We may have to review additional code paths at the callers to these two functions, though initially assume that the flag doesn't have to be set on any other code paths.
Cheers
Don
from fsharp.
unfortunately after a deeper look this approach will not work. If ref cell is not reallocated then after running check phase on the node produced by instExpr
then it might be filled with transient data that does not match the rest of the tree. i.e if instExpr
can copy some Val
and this Val
is captured in quotation then ref cell will save information about this copied Val and this will cause crash on other compilation steps later. As an option we can extract code that creates quotations from the check
into the separate phase so it will always use consistent view of the tree
from fsharp.
Has been fixed.
from fsharp.
Related Issues (20)
- Tooltip in IDE suggests wrong type of parameter or even multiple types HOT 2
- The term 'fsi' is not recognized as the name of a cmdlet, function, script file, or operable program HOT 2
- Static abstract method on class or abstract class yields internal error HOT 2
- Units of measure can affect compiled form of integral ranges HOT 2
- [Automated] PRs inserted in VS build feature.debugger.main-34815.163
- FSharp.Core. summary XML documentation for pairwise (List, Array, and Seq) is misleading
- [Automated] PRs inserted in VS build main-34817.26
- Using multiple operators in INumber-constrained generic functions leads to compiler error HOT 12
- [Automated] PRs inserted in VS build feature.debugger.main-34818.223
- Improve F# Interactive formatting of byte arrays HOT 8
- Implicit int to float conversion in function arguments fails when using arithmetic operations HOT 13
- TypeProvider not working in VS but works in CLI and VSCode HOT 3
- Better error recovery for unfinished result expressions in pattern matching clauses. HOT 5
- Transparent Compiler: Fails when signature file is not exactly next to source file HOT 2
- Cannot specific a SRTP property constraint as `with get, set` HOT 2
- AttributeUsage.AllowMultiple is not inherited for attributes defined (subclassed) in C#
- Prevent duplicate diagnostics from showing in VS when using LSP pull diagnostics
- Support LSP `textDocument/semanticTokens/full`
- `SkipLocalsInit` is an unsafe operation, but does not give warning FS0009 HOT 4
- StackOverflow in compiler when used in FSAutocomplete/Ionide on large project HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fsharp.