Comments (11)
Oh damn! That's because there is a global name generator that makes a special name that is unique for the entire program. The global state is in the nameless
crate, which makes it quite hard to find!
I didn't want to use dependency injection for it, but perhaps I might need to.
Perhaps we could just leave those tests for now?
from pikelet.
Would you be interested in picking this up @adrianwong?
from pikelet.
Sure, I'll give it a shot @brendanzab!
from pikelet.
As some extra info, I'm expecting we'll probably want to use the fmt::Debug
trait like so:
#[test]
fn ann_ann_right() {
// Do we want this to be relative to the current test directory?
let mut mint = Mint::new("tests/goldenfiles");
let mut file = mint.new_goldenfile("ann_ann_right").unwrap();
let term = parse(r"Type : (Type : Type)");
write!(file, "{:#?}", term).unwrap();
}
The funny {:#?}
will tell Rust to print out the value using an indented/pretty-printed output. This should work nicely for diffs when snapshot testing.
from pikelet.
Seems that this repo does all the golden tests in one test: https://github.com/slava-sh/rust-bundler/blob/master/tests/golden.rs
It would be interesting to see what the test failures looked like!
from pikelet.
I've hit a bit of a snag with the snapshot testing of the arrow
, lam_ann
, and pi
tests in the desugar
module. All three consistently fail snapshot testing due to the generation of a unique GenId(u32)
struct on each run.
From what I am able to tell, the presence of the GenId
node in the AST corresponds with nameless::bind( Name::user("_") )
, but the rest is a bit beyond me.
Thoughts? What I've done so far can be found here.
from pikelet.
If you're curious, this is where the ids are generated (on the call to GenId::fresh
):
pikelet/src/syntax/translation/desugar/mod.rs
Lines 249 to 255 in 4e8d0d1
from pikelet.
Super neat thing is that it's showing that arrow types, eg. Int -> Int
are actually just special cases of dependent functions/pi types/foralls: (x : Int) -> Int
, where the parameter is not mentioned in the return type.
from pikelet.
Ah, whoops, I had it backwards. So in the tests when we parse, e.g. r"(x : Type -> Type) -> x"
, we then assert that the first Type
has name
x
, whereas the second type doesn't have one, hence the Name::user("_")
?
from pikelet.
Ok I'll leave the snapshot testing out for those three tests then!
from pikelet.
yup, spot on!
from pikelet.
Related Issues (20)
- Turn theory appendix in book into the Pikelet specification HOT 6
- Fix ambiguous dependent function syntax HOT 1
- Pattern match compilation
- Don't panic on mismatched number of record fields
- Get Pikelet to build on wasm HOT 14
- Terminology bikeshed: Universe shifting/lifting/embiggening HOT 5
- Rename signed integer types
- Allow fields to be shifted
- Add a list of keywords to the docs
- Remove `of` keyword from case expressions
- Pikelet driver/loader API HOT 12
- Package manager HOT 4
- Add a top-level integration test suite
- Move away from using Moniker for variable binding HOT 7
- Try using Logos for the lexer HOT 1
- Merge next branch into master
- Fix unfolding avoidance for local variables
- Experiment with Andras Korvacs' version of universe lifting HOT 5
- Workspace doesn't build on a headless linux system HOT 1
- Cannot build with modern versions of Rust
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 pikelet.