Age | Commit message (Collapse) | Author | Files | Lines |
|
... including concatenation.
This diverges significantly from the book, as I'm using std::String
instead of implementing the book's whole heap object management
system.
It's possible that Lox in Rust actually doesn't need a GC and the
ownership model works just fine.
Change-Id: I374a0461d627cfafc26b2b54bfefac8b7c574d00
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2577
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
|
|
What you see here is mostly the fallout of me implementing a correct
urlencode implementation in nix for Profpatsch's blog implementation
(although they'll probably keep it at arm's length).
Where I want to go from here:
* Extend this library towards general purpose nix™, mainly by
implementing missing interfaces which you'd still have to use
<nixpkgs/lib> for right now. Reexposing parts of <nixpkgs/lib>
with better naming is fine for now, at some point I'd contemplate
making this depend on nothing outside of depot, maybe even itself
(should be easy we only use yants for an easily replaceable check).
* Improve error messages possibly by carefully reintroducing yants. I
originally typed essentially everything using yants, but turns out
this can a) be dangerous when stuff you are handling throws because
type checking means evaluating and b) has a incredible performance
cost in some cases.
* Reexpose builtins with better naming and slightly wrapped so they
don't unrecoverably throw in cases where a null or something would
suffice.
Change-Id: I33ab08ca4e62dbc16b86c66c653935686e6b0e79
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2541
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
|
|
Change-Id: I03b751db52a3bd502fb4fbda6e89cad087ccad74
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2575
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
|
|
Change-Id: I5587a11646e228c5af4dc7ca6da026bb4a2592a6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2574
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
|
|
This makes it possible to specify the input & output types of the
binary_op macro. If only one type is specified, it is assumed that the
input and output types are the same.
Change-Id: Idfcc9ba462db3976b69379b6693d091e1a525a3b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2573
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
|
|
Change-Id: I9a5bd3581d4ed05371651697ec496341eb7971ae
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2572
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
|
|
Adds support for true, false & nil. These each come with a new
separate opcode and are pushed directly on the stack.
Change-Id: I405b5b09496dcf99d514d3411c083e0834377167
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2571
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
|
|
Introduces a new enum which represents the different types of possible
values, and modifies the rest of the existing code to wrap/unwrap
these enum variants correctly.
Notably in the vm module, a new macro has been introduced that makes
it possible to encode a type expectation and return a runtime error in
case of a type mismatch.
Change-Id: I325b5e31e395c62d8819ab2af6d398e1277333c0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2570
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
|
|
If I was adding any dependencies, this might be a good one for a
property-based test thing, but I'm not going to.
Change-Id: Ia801d041479d1a88c59ef9e0fe1460b3640382e3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2569
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
|
|
Change-Id: I71ae83101002f8fead3fa6cbd4cb229a2d6e3902
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2568
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
|
|
Without this fix we would keep parsing in the same precedence level
and get weird things like:
10 - -10 + 10
=> 10
Change-Id: If2bed4569fbf566027011037165a9b3c09b7427c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2567
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
|
|
This makes the bytecode interpreter actually usable.
Change-Id: I24afc7ce461c6673dc42581378f6e14da7aece5c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2566
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
|
|
Change-Id: I92253e875436bcb42732a157979a9d1e7ca0cd06
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2565
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
|
|
Change-Id: I99d2882ac9ef5ede85032132f6727e7bad8f24eb
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2564
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
|
|
This should clean up everything in the way of actually running this
end-to-end.
Change-Id: Ie89d82472a458256a251a4fddc1c36d88d21f5f2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2563
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
|
|
Change-Id: I42293b334248b5228dd90f13b9a400ccdca20a84
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2562
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
|
|
Change-Id: Idcf3c84126603086bbf7e8d54773bccb3ae3b5ab
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2561
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
|
|
Change-Id: I1b894d2f84d23ddddcd1bb8794f771512b7d677e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2560
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
|
|
Change-Id: I6f0bc9f58b51dec2673c918e08b199b52e793ed4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2559
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
|
|
Defines a new precedence levels enum which can be used to restrict the
parser precedence in any given location. As an example, unary
expressions and grouping are implemented, as these have a different
precedence from e.g. expression()
Change-Id: I91f299fc77530f76c3aba717f638985428104ee5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2558
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
|
|
This lets us suppress reporting of additional errors from the compiler
until a synchronisation point is reached.
Change-Id: Iacf90949f868fbdb4349750065b5e458cf74d32a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2557
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
|
|
This one necessarily has to diverge more from the book than the
treewalk interpreter did, so some of this is expected to change, but
I'm happy with the rough shape.
Since we're reusing the old scanner, the compiler/parser struct owns
an iterator over all tokens with which the pull-scanner from the
bytecode chapters is simulated.
Change-Id: Icfa0bd4729d9df786e08f7e49a25cba1b9989a91
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2556
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
|
|
This makes it easier to transition between the single/multi error
functions via ?
Change-Id: Ie027f4700da463a549be6f0d4a0022a9b8dc0d61
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2555
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
|
|
Change-Id: Ib64831c0b97c94fdfbdbae64f4dfccc86879ef73
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2554
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
|
|
Change-Id: I446c6e38cf239a132882d37df156884d319ca111
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2553
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
|
|
Go 1.16 makes "go list all" not work. "go list std" is what we should be
using instead anyway.
Change-Id: I3f867fde477030d2358085b3d64b5856fb9c421b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2551
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
|
|
hibernate on low battery, and when the power button is pressed
Change-Id: I6560fc770ee5707e59fb2763614de2b8000e156e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2550
Reviewed-by: glittershark <grfn@gws.fyi>
Tested-by: BuildkiteCI
|
|
Change-Id: I4b0ef2f5996b6cf34724a0ed6b1c8081baa4d929
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2549
Reviewed-by: glittershark <grfn@gws.fyi>
Tested-by: BuildkiteCI
|
|
Change-Id: I66820d3209f0ef6120f2946acc2063cfd638512f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2548
Reviewed-by: glittershark <grfn@gws.fyi>
Tested-by: BuildkiteCI
|
|
Change-Id: I4153911c4ef701c10106fddd5f3bef2263aac5c3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2547
Reviewed-by: glittershark <grfn@gws.fyi>
Tested-by: BuildkiteCI
|
|
Change-Id: I841b7407f80d5096a32ee9019c1e02d26c015fc0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2546
Reviewed-by: glittershark <grfn@gws.fyi>
Tested-by: BuildkiteCI
|
|
Change-Id: I764b810245b2ec0bb1b76f6641b9baf2fab08be6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2545
Reviewed-by: glittershark <grfn@gws.fyi>
Tested-by: BuildkiteCI
|
|
... to appease Profpatsch.
Change-Id: Id8576645a6920312c2304ea7880524d9cda8e21b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2544
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
|
|
Uses project.el to anchor the ripgrep search. In combination with my
project detection logic, this means that grepping in TVL subprojects
works automatically.
Change-Id: I2705466d1de156c08ff0401a71112864aa24f976
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2542
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
|
|
When a file is added to the depot tree that is picked up by read-tree,
but it’s not a function like ({...}: {}), `readTree` will fail on the
function application, leading to a bad error message.
We can do slightly better, by checking the type and throwing a nicer
trace message.
`assertMsg` is copied from `nixpkgs/lib/assert.nix`, since at this
point we don’t have a reference to the lib.
There is another evaluation failure that can happen, which is when the
function we try to call does not have dots; however, nix does not
provide any inflection capabilies for checking whether a function
attrset is open (`builtins.functionArgs` only tells us the attrs it
mentions explicitly). Maybe the locality of the error could be
improved somehow.
Change-Id: Ibe38ce78bb56902075f7c31f2eeeb93485b34be3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2469
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
|
|
We stopped using this in favour of //web/panettone quite a while ago,
so lets clean it up.
Change-Id: I8aa8d86288933d470ab3962ffbb60294eaddd27b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2540
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: lukegb <lukegb@tvl.fyi>
|
|
Previously, for types defined using typedef (like all primitive types)
type.checkType would return a boolean. This is largely fine since in
most places `type.checkToBool (type.checkType x)` or similar is used.
However, some functions actually take type.checkType up on the promise
that it returns a set of the form:
{
ok = <bool>;
err = <option string>;
}
This is the case for restrict which has checkToBool = v: v.ok; and will
generate a proper set except if `t.checkToBool (t.checkType v) == false`
in which case it will return t.checkType v. If t was a primitive type or
defined using typedef, previously `t.checkType v` would be a boolean
which meant as soon as (restrict …).checkToBool was called on a restrict
checkType result in cases where the wrapped type didn't match, an
unrelated error would be thrown:
nix-repl> with nix.yants; restrict "foo" (_: true) int "lol"
error: value is a boolean while a set was expected, at /home/lukas/src/depot/nix/yants/default.nix:38:39
This is fixed by making typedef return a proper set from checkType and
adjusting its checkToBool accordingly.
Unfortunately I don't think we can easily add test cases for this except
by using recursive nix or VM tests as there is no way to introspect
error messages.
Change-Id: I96a7be065630f04ca33358f21809284911ec14fe
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2536
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Reviewed-by: Profpatsch <mail@profpatsch.de>
|
|
Main motivation for this is to get the openldap update that fixes
10 CVEs: CVE-2020-36221 to including CVE-2020-36230. See also this
issue which lists them all: https://github.com/NixOS/nixpkgs/issues/113490
Someone should also redeploy whitby as soon as this lands in canon and
all build failures have been fixed.
Things done to resolve upstream breakages:
* grpc no longer takes abseil-cpp as an input, it has also been removed
in the override.
* Upgrade glittershark's kernel to 5.11 since the linuxPackages_5_9
attribute has been removed by upstream and the patch used by them is
available for 5.11 as well.
* The fixed output hash for third_patry.apereo-cas changed for some reason.
* Remove the pin of haskellPackages.vector from the haskell overlay. It
broke as the most recent version of vector in nixos-unstable no longer
depends on semigroups. This effectively updates vector from 0.12.1.2
to 0.12.2.0.
* Align two comments in tvix/libstore/worker-protocol.hh because the
updated clang-format now demands that.
Change-Id: I2ecf10a98de935e9222acf1feaea447d4c11ed2d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2538
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Reviewed-by: glittershark <grfn@gws.fyi>
Reviewed-by: sterni <sternenseemann@systemli.org>
|
|
Change-Id: I4c10e36250aa112d2dd0cebf4ed41e0b6fd8182d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2539
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
|
|
Was messing around with serde and trying to build serde_json something,
might as well commit this.
Change-Id: I60f87aa3180f750fa171eca7f9c375ed053f8456
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2537
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
|
|
Nix unfortunately has terrible escaping syntax: If something is an
escape sequence it does not know, like \0, it just swallows the
backslash and returns the second character (byte) as is (yes,
"\0" == "0" is true). This created the following bug in nixFileName
which should have resulted in at least a parse error: "(.*)\.nix" is
the same as "(.*).nix" which meant that nixFileName matched anything
that is at least 4 characters long and ends in "nix". This lead to
readTree creating double attributes when directories are involved or
attributes for non-nix files.
Change-Id: Ibf3be2bd189d48881c82ee795c50151bfb365627
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2535
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
|
|
This adds a trivial test case on the transitive lib in tests and builds
it by wrapping in with testRustSimple. This should check:
* testRustSimple doesn't change the output and other packages can just
use it as a normal dependency
* tests are built and executed
Change-Id: Ia4ea7425432b8b0da09f63054f51f0c480300aa4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2531
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
|
|
The rust tests are now automatically built and run if
users.Profpatsch.netencode-rs is built without changing the content of
its output. users.Profpatsch.netencode-rs-tests has been removed in
favor of this, but can still be accessed as
builtins.head users.Profpatsch.netencode.netencode-rs.drvDeps
Change-Id: I25e8191f5b9efa08ace4a584a75978565c79d8d0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2530
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
|
|
testRustSimple is intended to wrap rustSimpleLib and rustSimpleBin and
theoretically pkgs.buildRustCrate with { buildTests = false; } while
building and running their tests, making them fail if the tests don't
succeed.
This is implemented using nix.drvSeqL which is a perfect fit here:
* { buildTests = true; } only returns an output with the test binaries
and does not actually run the tests. With drvSeqL we can easily wrap
this derivation.
* { buildTests = true } doesn't contain anything other derivations want
to depend on, so it is an derivation output we don't want to have.
drvSeqL hides the tests derivation away and only requires us to build
it once.
* Usually drvSeqL has the issue that tests (or advantage) are not rebuilt
if the test derivation changes. This is no question in this case as
due to the embedded nature of Rust's test, both the derivation with
and without tests change anyways regardless of which part was changed.
Future work: Allow injecting other tests?
Change-Id: If6ecfb3a360ce059320dbb05642b391b617aede7
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2529
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
|
|
This adds the star of NixCon 2017 from vuizvui, slightly reformatted and
now using yants. While it has some flaws, I realized that it is ideal to
run the tests of rustSimple{Lib,Bin} where the normal and the -tests
variant would have to be rebuilt if either the tests or the library /
executable itself changes.
Change-Id: Ie8f84f98c51c9fafc046eff916c8f0df7e8f224b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2528
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
|
|
We forgot the special casing of derivations; if we recurse into a
derivation like we’d recurse into an attrset, it always ends in tears,
so dwim will just print the derivation path instead, which is usually
what you want anyway.
Change-Id: Ieed1b68dfcf8f2925ee3a75ae4f460fa5081da28
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2526
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
|
|
eprintenv is a debugging tool, as such the code should probably not
crash when the environment variable we want to look at is missing.
But we can print a warning instead.
Change-Id: I41a24dc0c1cc488587563b85c1adbd089dd364f2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2525
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
|
|
Change-Id: I7393f60e4b29f24399d681d4546ac35140650d1a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2524
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
|
|
The headers are not a scalar, so record-splice-env doesn’t know how to
convert them to an envvar; let’s just ignore everything that can’t be
converted to a scalar for now.
Change-Id: I74ed0aa942fcd26beb058705830bc2f2b516e93e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2523
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
|
|
Tries to decode the inner type, turning it into an Option.
Change-Id: I29d1286fe873c28d7c4a4b71f220acaf2d23f8e1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2522
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
|