Comments (14)
Btw, the error message I get is:
/Users/rjhala/research/liquid/RefScript/tests/pos/misc/init-00.ts:4:9-4:17: Error: TC-ERROR
Variable definition of 'i_SSA_0' with neither type annotation nor initialization is not supported.
from refscript.
Agreed. This has been around for a while, but now that we seem to have a clear story for 'undefined' we can just implicitly use that in cases where we don't have an initializer.
For the moment, writing down the 'undefined' should do it.
from refscript.
I see. Adding undefined
doesn't quite cut it -- or rather it works for the one case, but not for the second second test I added, where TC complains about joining undefined
and number
. In general this is sketchy, because indeed, due to the while loop, maybe the i
is indeed not defined but since the i
is dead -- i.e. not used afterwards it shouldn't matter...
from refscript.
Also, I thought I would hack around it by using the crash
from the prelude to just make up a fictitious value of any-old type, but it get some strange error, see:
https://github.com/UCSD-PL/RefScript/blob/varinit/tests/pos/misc/init-02.ts
from refscript.
See the new tests I have added -- bottom-line is that the simple undefined
trick is not working. These seem like pretty simple things, and should be
fixed soon IMO.
On Mon, Sep 15, 2014 at 7:28 PM, Panagiotis Vekris <[email protected]
wrote:
Agreed. This has been around for a while, but now that we seem to have a
clear story for 'undefined' we can just implicitly use that in cases where
we don't have an initializer.For the moment, writing down the 'undefined' should do it.
Reply to this email directly or view it on GitHub
#24 (comment).
Ranjit.
from refscript.
OK I made the fix that addresses:
https://github.com/UCSD-PL/RefScript/blob/varinit/tests/pos/misc/init-00.ts
This one:
https://github.com/UCSD-PL/RefScript/blob/varinit/tests/pos/misc/init-01.ts
will require some more thought - e.g. introduce a union at the exiting (from the loop) phi var.
The last one you posted:
https://github.com/UCSD-PL/RefScript/blob/varinit/tests/pos/misc/init-02.ts
is a TypeScript error. It has to do with the way TS sometimes treats open (polymorphic - as in forall A . A
) types as {} -- the empty object type.
from refscript.
I suggest just merging (joining) T + undefined == undefined (keep it simple) ?
from refscript.
Yikes. Is there any way around the TS error? crash
or diverge
is a pretty handy thing to have...
but anyway, if you fix the union issue -- by just special casing undefined
-- thats fine too IMO, because
this is a common imperative idiom.
from refscript.
You can always 'any' it up.
I.e.
/*@ crash :: forall A . () => A */
declare function crash(): any;
from refscript.
OK I'll do the "simple - undefined" solution for the moment.
If we end up having situations like:
var i;
if (a > 0) i = a;
if (i) assert(i > 0);
we might have to revise
from refscript.
Indeed -- good plan.
On Sep 15, 2014, at 8:15 PM, Panagiotis Vekris [email protected] wrote:
OK I'll do the "simple - undefined" solution for the moment.
If we end up having situations like:
var i;
if (a > 0) i = a;
if (i) assert(i > 0);
we might have to revise—
Reply to this email directly or view it on GitHub.
from refscript.
Btw wouldn't be explicit undefined plus number annotation on i work in this case?
On Sep 15, 2014, at 8:15 PM, Panagiotis Vekris [email protected] wrote:
OK I'll do the "simple - undefined" solution for the moment.
If we end up having situations like:
var i;
if (a > 0) i = a;
if (i) assert(i > 0);
we might have to revise—
Reply to this email directly or view it on GitHub.
from refscript.
Yes, in this specific one the number annotation can be inferred.
But note that adding the annotation, means no SSA. So with multiple assignments you'd lose flow sensitivity.
from refscript.
Addressed by #26
(all tests pass.)
from refscript.
Related Issues (20)
- Scope of 'this' HOT 1
- Missing qualifier HOT 1
- Refinements on constructors HOT 1
- += ++ interaction
- Offsets HOT 1
- Loop SSA
- Assume non-trivial refinements for exported functions HOT 1
- Support `export` for public functions HOT 1
- Rconc/Fixpoint broke some tests HOT 1
- Add DeadCast for Join HOT 1
- real? HOT 1
- SSA bug HOT 1
- bitvector HOT 1
- ssa HOT 1
- Catch malformed refinement in `rsc`
- Measure and symbol name clash
- No mutability for Enums
- ssa HOT 1
- Demo not working HOT 4
- Online demo seems not working HOT 1
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 refscript.