mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-25 23:36:16 +02:00
Merge pull request #9874 from pennae/error-reports
improve error reports somewhat
This commit is contained in:
commit
a200ee6bf7
37 changed files with 336 additions and 142 deletions
7
doc/manual/rl-next/formal-order.md
Normal file
7
doc/manual/rl-next/formal-order.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
synopsis: consistent order of lambda formals in printed expressions
|
||||||
|
prs: 9874
|
||||||
|
---
|
||||||
|
|
||||||
|
Always print lambda formals in lexicographic order rather than the internal, creation-time based symbol order.
|
||||||
|
This makes printed formals independent of the context they appear in.
|
6
doc/manual/rl-next/inherit-error-positions.md
Normal file
6
doc/manual/rl-next/inherit-error-positions.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
synopsis: fix duplicate attribute error positions for `inherit`
|
||||||
|
prs: 9874
|
||||||
|
---
|
||||||
|
|
||||||
|
When an inherit caused a duplicate attribute error the position of the error was not reported correctly, placing the error with the inherit itself or at the start of the bindings block instead of the offending attribute name.
|
|
@ -949,12 +949,11 @@ void EvalState::mkThunk_(Value & v, Expr * expr)
|
||||||
|
|
||||||
void EvalState::mkPos(Value & v, PosIdx p)
|
void EvalState::mkPos(Value & v, PosIdx p)
|
||||||
{
|
{
|
||||||
auto pos = positions[p];
|
auto origin = positions.originOf(p);
|
||||||
if (auto path = std::get_if<SourcePath>(&pos.origin)) {
|
if (auto path = std::get_if<SourcePath>(&origin)) {
|
||||||
auto attrs = buildBindings(3);
|
auto attrs = buildBindings(3);
|
||||||
attrs.alloc(sFile).mkString(path->path.abs());
|
attrs.alloc(sFile).mkString(path->path.abs());
|
||||||
attrs.alloc(sLine).mkInt(pos.line);
|
makePositionThunks(*this, p, attrs.alloc(sLine), attrs.alloc(sColumn));
|
||||||
attrs.alloc(sColumn).mkInt(pos.column);
|
|
||||||
v.mkAttrs(attrs);
|
v.mkAttrs(attrs);
|
||||||
} else
|
} else
|
||||||
v.mkNull();
|
v.mkNull();
|
||||||
|
@ -2777,9 +2776,12 @@ Expr * EvalState::parseExprFromFile(const SourcePath & path, std::shared_ptr<Sta
|
||||||
|
|
||||||
Expr * EvalState::parseExprFromString(std::string s_, const SourcePath & basePath, std::shared_ptr<StaticEnv> & staticEnv)
|
Expr * EvalState::parseExprFromString(std::string s_, const SourcePath & basePath, std::shared_ptr<StaticEnv> & staticEnv)
|
||||||
{
|
{
|
||||||
auto s = make_ref<std::string>(std::move(s_));
|
// NOTE this method (and parseStdin) must take care to *fully copy* their input
|
||||||
s->append("\0\0", 2);
|
// into their respective Pos::Origin until the parser stops overwriting its input
|
||||||
return parse(s->data(), s->size(), Pos::String{.source = s}, basePath, staticEnv);
|
// data.
|
||||||
|
auto s = make_ref<std::string>(s_);
|
||||||
|
s_.append("\0\0", 2);
|
||||||
|
return parse(s_.data(), s_.size(), Pos::String{.source = s}, basePath, staticEnv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2791,12 +2793,15 @@ Expr * EvalState::parseExprFromString(std::string s, const SourcePath & basePath
|
||||||
|
|
||||||
Expr * EvalState::parseStdin()
|
Expr * EvalState::parseStdin()
|
||||||
{
|
{
|
||||||
|
// NOTE this method (and parseExprFromString) must take care to *fully copy* their
|
||||||
|
// input into their respective Pos::Origin until the parser stops overwriting its
|
||||||
|
// input data.
|
||||||
//Activity act(*logger, lvlTalkative, "parsing standard input");
|
//Activity act(*logger, lvlTalkative, "parsing standard input");
|
||||||
auto buffer = drainFD(0);
|
auto buffer = drainFD(0);
|
||||||
// drainFD should have left some extra space for terminators
|
// drainFD should have left some extra space for terminators
|
||||||
buffer.append("\0\0", 2);
|
buffer.append("\0\0", 2);
|
||||||
auto s = make_ref<std::string>(std::move(buffer));
|
auto s = make_ref<std::string>(buffer);
|
||||||
return parse(s->data(), s->size(), Pos::Stdin{.source = s}, rootPath("."), staticBaseEnv);
|
return parse(buffer.data(), buffer.size(), Pos::Stdin{.source = s}, rootPath("."), staticBaseEnv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -212,11 +212,10 @@ static Flake readFlake(
|
||||||
{
|
{
|
||||||
auto flakePath = rootDir / CanonPath(resolvedRef.subdir) / "flake.nix";
|
auto flakePath = rootDir / CanonPath(resolvedRef.subdir) / "flake.nix";
|
||||||
|
|
||||||
|
// NOTE evalFile forces vInfo to be an attrset because mustBeTrivial is true.
|
||||||
Value vInfo;
|
Value vInfo;
|
||||||
state.evalFile(flakePath, vInfo, true);
|
state.evalFile(flakePath, vInfo, true);
|
||||||
|
|
||||||
expectType(state, nAttrs, vInfo, state.positions.add(Pos::Origin(rootDir), 1, 1));
|
|
||||||
|
|
||||||
Flake flake {
|
Flake flake {
|
||||||
.originalRef = originalRef,
|
.originalRef = originalRef,
|
||||||
.resolvedRef = resolvedRef,
|
.resolvedRef = resolvedRef,
|
||||||
|
|
|
@ -33,33 +33,16 @@ namespace nix {
|
||||||
|
|
||||||
static void initLoc(YYLTYPE * loc)
|
static void initLoc(YYLTYPE * loc)
|
||||||
{
|
{
|
||||||
loc->first_line = loc->last_line = 1;
|
loc->first_line = loc->last_line = 0;
|
||||||
loc->first_column = loc->last_column = 1;
|
loc->first_column = loc->last_column = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void adjustLoc(YYLTYPE * loc, const char * s, size_t len)
|
static void adjustLoc(YYLTYPE * loc, const char * s, size_t len)
|
||||||
{
|
{
|
||||||
loc->stash();
|
loc->stash();
|
||||||
|
|
||||||
loc->first_line = loc->last_line;
|
|
||||||
loc->first_column = loc->last_column;
|
loc->first_column = loc->last_column;
|
||||||
|
loc->last_column += len;
|
||||||
for (size_t i = 0; i < len; i++) {
|
|
||||||
switch (*s++) {
|
|
||||||
case '\r':
|
|
||||||
if (*s == '\n') { /* cr/lf */
|
|
||||||
i++;
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
/* fall through */
|
|
||||||
case '\n':
|
|
||||||
++loc->last_line;
|
|
||||||
loc->last_column = 1;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
++loc->last_column;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,10 @@ void ExprLambda::show(const SymbolTable & symbols, std::ostream & str) const
|
||||||
if (hasFormals()) {
|
if (hasFormals()) {
|
||||||
str << "{ ";
|
str << "{ ";
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (auto & i : formals->formals) {
|
// the natural Symbol ordering is by creation time, which can lead to the
|
||||||
|
// same expression being printed in two different ways depending on its
|
||||||
|
// context. always use lexicographic ordering to avoid this.
|
||||||
|
for (auto & i : formals->lexicographicOrder(symbols)) {
|
||||||
if (first) first = false; else str << ", ";
|
if (first) first = false; else str << ", ";
|
||||||
str << symbols[i.name];
|
str << symbols[i.name];
|
||||||
if (i.def) {
|
if (i.def) {
|
||||||
|
@ -580,6 +583,39 @@ std::string ExprLambda::showNamePos(const EvalState & state) const
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Position table. */
|
||||||
|
|
||||||
|
Pos PosTable::operator[](PosIdx p) const
|
||||||
|
{
|
||||||
|
auto origin = resolve(p);
|
||||||
|
if (!origin)
|
||||||
|
return {};
|
||||||
|
|
||||||
|
const auto offset = origin->offsetOf(p);
|
||||||
|
|
||||||
|
Pos result{0, 0, origin->origin};
|
||||||
|
auto lines = this->lines.lock();
|
||||||
|
auto linesForInput = (*lines)[origin->offset];
|
||||||
|
|
||||||
|
if (linesForInput.empty()) {
|
||||||
|
auto source = result.getSource().value_or("");
|
||||||
|
const char * begin = source.data();
|
||||||
|
for (Pos::LinesIterator it(source), end; it != end; it++)
|
||||||
|
linesForInput.push_back(it->data() - begin);
|
||||||
|
if (linesForInput.empty())
|
||||||
|
linesForInput.push_back(0);
|
||||||
|
}
|
||||||
|
// as above: the first line starts at byte 0 and is always present
|
||||||
|
auto lineStartOffset = std::prev(
|
||||||
|
std::upper_bound(linesForInput.begin(), linesForInput.end(), offset));
|
||||||
|
|
||||||
|
result.line = 1 + (lineStartOffset - linesForInput.begin());
|
||||||
|
result.column = 1 + (offset - *lineStartOffset);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Symbol table. */
|
/* Symbol table. */
|
||||||
|
|
||||||
size_t SymbolTable::totalSize() const
|
size_t SymbolTable::totalSize() const
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include "value.hh"
|
#include "value.hh"
|
||||||
#include "symbol-table.hh"
|
#include "symbol-table.hh"
|
||||||
#include "error.hh"
|
#include "error.hh"
|
||||||
#include "chunked-vector.hh"
|
|
||||||
#include "position.hh"
|
#include "position.hh"
|
||||||
#include "eval-error.hh"
|
#include "eval-error.hh"
|
||||||
#include "pos-idx.hh"
|
#include "pos-idx.hh"
|
||||||
|
|
|
@ -24,20 +24,15 @@ struct ParserLocation
|
||||||
int last_line, last_column;
|
int last_line, last_column;
|
||||||
|
|
||||||
// backup to recover from yyless(0)
|
// backup to recover from yyless(0)
|
||||||
int stashed_first_line, stashed_first_column;
|
int stashed_first_column, stashed_last_column;
|
||||||
int stashed_last_line, stashed_last_column;
|
|
||||||
|
|
||||||
void stash() {
|
void stash() {
|
||||||
stashed_first_line = first_line;
|
|
||||||
stashed_first_column = first_column;
|
stashed_first_column = first_column;
|
||||||
stashed_last_line = last_line;
|
|
||||||
stashed_last_column = last_column;
|
stashed_last_column = last_column;
|
||||||
}
|
}
|
||||||
|
|
||||||
void unstash() {
|
void unstash() {
|
||||||
first_line = stashed_first_line;
|
|
||||||
first_column = stashed_first_column;
|
first_column = stashed_first_column;
|
||||||
last_line = stashed_last_line;
|
|
||||||
last_column = stashed_last_column;
|
last_column = stashed_last_column;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -276,7 +271,7 @@ inline Expr * ParserState::stripIndentation(const PosIdx pos,
|
||||||
|
|
||||||
inline PosIdx ParserState::at(const ParserLocation & loc)
|
inline PosIdx ParserState::at(const ParserLocation & loc)
|
||||||
{
|
{
|
||||||
return positions.add(origin, loc.first_line, loc.first_column);
|
return positions.add(origin, loc.first_column);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,10 @@ using namespace nix;
|
||||||
|
|
||||||
void yyerror(YYLTYPE * loc, yyscan_t scanner, ParserState * state, const char * error)
|
void yyerror(YYLTYPE * loc, yyscan_t scanner, ParserState * state, const char * error)
|
||||||
{
|
{
|
||||||
|
if (std::string_view(error).starts_with("syntax error, unexpected end of file")) {
|
||||||
|
loc->first_column = loc->last_column;
|
||||||
|
loc->first_line = loc->last_line;
|
||||||
|
}
|
||||||
throw ParseError({
|
throw ParseError({
|
||||||
.msg = HintFmt(error),
|
.msg = HintFmt(error),
|
||||||
.pos = state->positions[state->at(*loc)]
|
.pos = state->positions[state->at(*loc)]
|
||||||
|
@ -87,6 +91,7 @@ void yyerror(YYLTYPE * loc, yyscan_t scanner, ParserState * state, const char *
|
||||||
nix::StringToken uri;
|
nix::StringToken uri;
|
||||||
nix::StringToken str;
|
nix::StringToken str;
|
||||||
std::vector<nix::AttrName> * attrNames;
|
std::vector<nix::AttrName> * attrNames;
|
||||||
|
std::vector<std::pair<nix::AttrName, nix::PosIdx>> * inheritAttrs;
|
||||||
std::vector<std::pair<nix::PosIdx, nix::Expr *>> * string_parts;
|
std::vector<std::pair<nix::PosIdx, nix::Expr *>> * string_parts;
|
||||||
std::vector<std::pair<nix::PosIdx, std::variant<nix::Expr *, nix::StringToken>>> * ind_string_parts;
|
std::vector<std::pair<nix::PosIdx, std::variant<nix::Expr *, nix::StringToken>>> * ind_string_parts;
|
||||||
}
|
}
|
||||||
|
@ -97,7 +102,8 @@ void yyerror(YYLTYPE * loc, yyscan_t scanner, ParserState * state, const char *
|
||||||
%type <attrs> binds
|
%type <attrs> binds
|
||||||
%type <formals> formals
|
%type <formals> formals
|
||||||
%type <formal> formal
|
%type <formal> formal
|
||||||
%type <attrNames> attrs attrpath
|
%type <attrNames> attrpath
|
||||||
|
%type <inheritAttrs> attrs
|
||||||
%type <string_parts> string_parts_interpolated
|
%type <string_parts> string_parts_interpolated
|
||||||
%type <ind_string_parts> ind_string_parts
|
%type <ind_string_parts> ind_string_parts
|
||||||
%type <e> path_start string_parts string_attr
|
%type <e> path_start string_parts string_attr
|
||||||
|
@ -309,13 +315,12 @@ binds
|
||||||
: binds attrpath '=' expr ';' { $$ = $1; state->addAttr($$, std::move(*$2), $4, state->at(@2)); delete $2; }
|
: binds attrpath '=' expr ';' { $$ = $1; state->addAttr($$, std::move(*$2), $4, state->at(@2)); delete $2; }
|
||||||
| binds INHERIT attrs ';'
|
| binds INHERIT attrs ';'
|
||||||
{ $$ = $1;
|
{ $$ = $1;
|
||||||
for (auto & i : *$3) {
|
for (auto & [i, iPos] : *$3) {
|
||||||
if ($$->attrs.find(i.symbol) != $$->attrs.end())
|
if ($$->attrs.find(i.symbol) != $$->attrs.end())
|
||||||
state->dupAttr(i.symbol, state->at(@3), $$->attrs[i.symbol].pos);
|
state->dupAttr(i.symbol, iPos, $$->attrs[i.symbol].pos);
|
||||||
auto pos = state->at(@3);
|
|
||||||
$$->attrs.emplace(
|
$$->attrs.emplace(
|
||||||
i.symbol,
|
i.symbol,
|
||||||
ExprAttrs::AttrDef(new ExprVar(CUR_POS, i.symbol), pos, ExprAttrs::AttrDef::Kind::Inherited));
|
ExprAttrs::AttrDef(new ExprVar(iPos, i.symbol), iPos, ExprAttrs::AttrDef::Kind::Inherited));
|
||||||
}
|
}
|
||||||
delete $3;
|
delete $3;
|
||||||
}
|
}
|
||||||
|
@ -325,14 +330,14 @@ binds
|
||||||
$$->inheritFromExprs = std::make_unique<std::vector<Expr *>>();
|
$$->inheritFromExprs = std::make_unique<std::vector<Expr *>>();
|
||||||
$$->inheritFromExprs->push_back($4);
|
$$->inheritFromExprs->push_back($4);
|
||||||
auto from = new nix::ExprInheritFrom(state->at(@4), $$->inheritFromExprs->size() - 1);
|
auto from = new nix::ExprInheritFrom(state->at(@4), $$->inheritFromExprs->size() - 1);
|
||||||
for (auto & i : *$6) {
|
for (auto & [i, iPos] : *$6) {
|
||||||
if ($$->attrs.find(i.symbol) != $$->attrs.end())
|
if ($$->attrs.find(i.symbol) != $$->attrs.end())
|
||||||
state->dupAttr(i.symbol, state->at(@6), $$->attrs[i.symbol].pos);
|
state->dupAttr(i.symbol, iPos, $$->attrs[i.symbol].pos);
|
||||||
$$->attrs.emplace(
|
$$->attrs.emplace(
|
||||||
i.symbol,
|
i.symbol,
|
||||||
ExprAttrs::AttrDef(
|
ExprAttrs::AttrDef(
|
||||||
new ExprSelect(CUR_POS, from, i.symbol),
|
new ExprSelect(iPos, from, i.symbol),
|
||||||
state->at(@6),
|
iPos,
|
||||||
ExprAttrs::AttrDef::Kind::InheritedFrom));
|
ExprAttrs::AttrDef::Kind::InheritedFrom));
|
||||||
}
|
}
|
||||||
delete $6;
|
delete $6;
|
||||||
|
@ -341,12 +346,12 @@ binds
|
||||||
;
|
;
|
||||||
|
|
||||||
attrs
|
attrs
|
||||||
: attrs attr { $$ = $1; $1->push_back(AttrName(state->symbols.create($2))); }
|
: attrs attr { $$ = $1; $1->emplace_back(AttrName(state->symbols.create($2)), state->at(@2)); }
|
||||||
| attrs string_attr
|
| attrs string_attr
|
||||||
{ $$ = $1;
|
{ $$ = $1;
|
||||||
ExprString * str = dynamic_cast<ExprString *>($2);
|
ExprString * str = dynamic_cast<ExprString *>($2);
|
||||||
if (str) {
|
if (str) {
|
||||||
$$->push_back(AttrName(state->symbols.create(str->s)));
|
$$->emplace_back(AttrName(state->symbols.create(str->s)), state->at(@2));
|
||||||
delete str;
|
delete str;
|
||||||
} else
|
} else
|
||||||
throw ParseError({
|
throw ParseError({
|
||||||
|
@ -354,7 +359,7 @@ attrs
|
||||||
.pos = state->positions[state->at(@2)]
|
.pos = state->positions[state->at(@2)]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
| { $$ = new AttrPath; }
|
| { $$ = new std::vector<std::pair<AttrName, PosIdx>>; }
|
||||||
;
|
;
|
||||||
|
|
||||||
attrpath
|
attrpath
|
||||||
|
@ -433,7 +438,7 @@ Expr * parseExprFromBuf(
|
||||||
.symbols = symbols,
|
.symbols = symbols,
|
||||||
.positions = positions,
|
.positions = positions,
|
||||||
.basePath = basePath,
|
.basePath = basePath,
|
||||||
.origin = {origin},
|
.origin = positions.addOrigin(origin, length),
|
||||||
.rootFS = rootFS,
|
.rootFS = rootFS,
|
||||||
.s = astSymbols,
|
.s = astSymbols,
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,6 +6,7 @@ namespace nix {
|
||||||
|
|
||||||
class PosIdx
|
class PosIdx
|
||||||
{
|
{
|
||||||
|
friend struct LazyPosAcessors;
|
||||||
friend class PosTable;
|
friend class PosTable;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "chunked-vector.hh"
|
#include "chunked-vector.hh"
|
||||||
#include "pos-idx.hh"
|
#include "pos-idx.hh"
|
||||||
#include "position.hh"
|
#include "position.hh"
|
||||||
|
#include "sync.hh"
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
|
@ -17,66 +18,69 @@ public:
|
||||||
{
|
{
|
||||||
friend PosTable;
|
friend PosTable;
|
||||||
private:
|
private:
|
||||||
// must always be invalid by default, add() replaces this with the actual value.
|
uint32_t offset;
|
||||||
// subsequent add() calls use this index as a token to quickly check whether the
|
|
||||||
// current origins.back() can be reused or not.
|
|
||||||
mutable uint32_t idx = std::numeric_limits<uint32_t>::max();
|
|
||||||
|
|
||||||
// Used for searching in PosTable::[].
|
Origin(Pos::Origin origin, uint32_t offset, size_t size):
|
||||||
explicit Origin(uint32_t idx)
|
offset(offset), origin(origin), size(size)
|
||||||
: idx(idx)
|
{}
|
||||||
, origin{std::monostate()}
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const Pos::Origin origin;
|
const Pos::Origin origin;
|
||||||
|
const size_t size;
|
||||||
|
|
||||||
Origin(Pos::Origin origin)
|
uint32_t offsetOf(PosIdx p) const
|
||||||
: origin(origin)
|
|
||||||
{
|
{
|
||||||
|
return p.id - 1 - offset;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Offset
|
|
||||||
{
|
|
||||||
uint32_t line, column;
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<Origin> origins;
|
using Lines = std::vector<uint32_t>;
|
||||||
ChunkedVector<Offset, 8192> offsets;
|
|
||||||
|
|
||||||
public:
|
std::map<uint32_t, Origin> origins;
|
||||||
PosTable()
|
mutable Sync<std::map<uint32_t, Lines>> lines;
|
||||||
: offsets(1024)
|
|
||||||
{
|
|
||||||
origins.reserve(1024);
|
|
||||||
}
|
|
||||||
|
|
||||||
PosIdx add(const Origin & origin, uint32_t line, uint32_t column)
|
const Origin * resolve(PosIdx p) const
|
||||||
{
|
{
|
||||||
const auto idx = offsets.add({line, column}).second;
|
if (p.id == 0)
|
||||||
if (origins.empty() || origins.back().idx != origin.idx) {
|
return nullptr;
|
||||||
origin.idx = idx;
|
|
||||||
origins.push_back(origin);
|
|
||||||
}
|
|
||||||
return PosIdx(idx + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
Pos operator[](PosIdx p) const
|
|
||||||
{
|
|
||||||
if (p.id == 0 || p.id > offsets.size())
|
|
||||||
return {};
|
|
||||||
const auto idx = p.id - 1;
|
const auto idx = p.id - 1;
|
||||||
/* we want the last key <= idx, so we'll take prev(first key > idx).
|
/* we want the last key <= idx, so we'll take prev(first key > idx).
|
||||||
this is guaranteed to never rewind origin.begin because the first
|
this is guaranteed to never rewind origin.begin because the first
|
||||||
key is always 0. */
|
key is always 0. */
|
||||||
const auto pastOrigin = std::upper_bound(
|
const auto pastOrigin = origins.upper_bound(idx);
|
||||||
origins.begin(), origins.end(), Origin(idx), [](const auto & a, const auto & b) { return a.idx < b.idx; });
|
return &std::prev(pastOrigin)->second;
|
||||||
const auto origin = *std::prev(pastOrigin);
|
}
|
||||||
const auto offset = offsets[idx];
|
|
||||||
return {offset.line, offset.column, origin.origin};
|
public:
|
||||||
|
Origin addOrigin(Pos::Origin origin, size_t size)
|
||||||
|
{
|
||||||
|
uint32_t offset = 0;
|
||||||
|
if (auto it = origins.rbegin(); it != origins.rend())
|
||||||
|
offset = it->first + it->second.size;
|
||||||
|
// +1 because all PosIdx are offset by 1 to begin with, and
|
||||||
|
// another +1 to ensure that all origins can point to EOF, eg
|
||||||
|
// on (invalid) empty inputs.
|
||||||
|
if (2 + offset + size < offset)
|
||||||
|
return Origin{origin, offset, 0};
|
||||||
|
return origins.emplace(offset, Origin{origin, offset, size}).first->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
PosIdx add(const Origin & origin, size_t offset)
|
||||||
|
{
|
||||||
|
if (offset > origin.size)
|
||||||
|
return PosIdx();
|
||||||
|
return PosIdx(1 + origin.offset + offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
Pos operator[](PosIdx p) const;
|
||||||
|
|
||||||
|
Pos::Origin originOf(PosIdx p) const
|
||||||
|
{
|
||||||
|
if (auto o = resolve(p))
|
||||||
|
return o->origin;
|
||||||
|
return std::monostate{};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2524,6 +2524,54 @@ static RegisterPrimOp primop_unsafeGetAttrPos(PrimOp {
|
||||||
.fun = prim_unsafeGetAttrPos,
|
.fun = prim_unsafeGetAttrPos,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// access to exact position information (ie, line and colum numbers) is deferred
|
||||||
|
// due to the cost associated with calculating that information and how rarely
|
||||||
|
// it is used in practice. this is achieved by creating thunks to otherwise
|
||||||
|
// inaccessible primops that are not exposed as __op or under builtins to turn
|
||||||
|
// the internal PosIdx back into a line and column number, respectively. exposing
|
||||||
|
// these primops in any way would at best be not useful and at worst create wildly
|
||||||
|
// indeterministic eval results depending on parse order of files.
|
||||||
|
//
|
||||||
|
// in a simpler world this would instead be implemented as another kind of thunk,
|
||||||
|
// but each type of thunk has an associated runtime cost in the current evaluator.
|
||||||
|
// as with black holes this cost is too high to justify another thunk type to check
|
||||||
|
// for in the very hot path that is forceValue.
|
||||||
|
static struct LazyPosAcessors {
|
||||||
|
PrimOp primop_lineOfPos{
|
||||||
|
.arity = 1,
|
||||||
|
.fun = [] (EvalState & state, PosIdx pos, Value * * args, Value & v) {
|
||||||
|
v.mkInt(state.positions[PosIdx(args[0]->integer)].line);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
PrimOp primop_columnOfPos{
|
||||||
|
.arity = 1,
|
||||||
|
.fun = [] (EvalState & state, PosIdx pos, Value * * args, Value & v) {
|
||||||
|
v.mkInt(state.positions[PosIdx(args[0]->integer)].column);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Value lineOfPos, columnOfPos;
|
||||||
|
|
||||||
|
LazyPosAcessors()
|
||||||
|
{
|
||||||
|
lineOfPos.mkPrimOp(&primop_lineOfPos);
|
||||||
|
columnOfPos.mkPrimOp(&primop_columnOfPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator()(EvalState & state, const PosIdx pos, Value & line, Value & column)
|
||||||
|
{
|
||||||
|
Value * posV = state.allocValue();
|
||||||
|
posV->mkInt(pos.id);
|
||||||
|
line.mkApp(&lineOfPos, posV);
|
||||||
|
column.mkApp(&columnOfPos, posV);
|
||||||
|
}
|
||||||
|
} makeLazyPosAccessors;
|
||||||
|
|
||||||
|
void makePositionThunks(EvalState & state, const PosIdx pos, Value & line, Value & column)
|
||||||
|
{
|
||||||
|
makeLazyPosAccessors(state, pos, line, column);
|
||||||
|
}
|
||||||
|
|
||||||
/* Dynamic version of the `?' operator. */
|
/* Dynamic version of the `?' operator. */
|
||||||
static void prim_hasAttr(EvalState & state, const PosIdx pos, Value * * args, Value & v)
|
static void prim_hasAttr(EvalState & state, const PosIdx pos, Value * * args, Value & v)
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,4 +51,6 @@ void prim_importNative(EvalState & state, const PosIdx pos, Value * * args, Valu
|
||||||
*/
|
*/
|
||||||
void prim_exec(EvalState & state, const PosIdx pos, Value * * args, Value & v);
|
void prim_exec(EvalState & state, const PosIdx pos, Value * * args, Value & v);
|
||||||
|
|
||||||
|
void makePositionThunks(EvalState & state, const PosIdx pos, Value & line, Value & column);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,32 +29,17 @@ std::optional<LinesOfCode> Pos::getCodeLines() const
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
|
||||||
if (auto source = getSource()) {
|
if (auto source = getSource()) {
|
||||||
|
LinesIterator lines(*source), end;
|
||||||
std::istringstream iss(*source);
|
|
||||||
// count the newlines.
|
|
||||||
int count = 0;
|
|
||||||
std::string curLine;
|
|
||||||
int pl = line - 1;
|
|
||||||
|
|
||||||
LinesOfCode loc;
|
LinesOfCode loc;
|
||||||
|
|
||||||
do {
|
if (line > 1)
|
||||||
std::getline(iss, curLine);
|
std::advance(lines, line - 2);
|
||||||
++count;
|
if (lines != end && line > 1)
|
||||||
if (count < pl)
|
loc.prevLineOfCode = *lines++;
|
||||||
;
|
if (lines != end)
|
||||||
else if (count == pl) {
|
loc.errLineOfCode = *lines++;
|
||||||
loc.prevLineOfCode = curLine;
|
if (lines != end)
|
||||||
} else if (count == pl + 1) {
|
loc.nextLineOfCode = *lines++;
|
||||||
loc.errLineOfCode = curLine;
|
|
||||||
} else if (count == pl + 2) {
|
|
||||||
loc.nextLineOfCode = curLine;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!iss.good())
|
|
||||||
break;
|
|
||||||
} while (true);
|
|
||||||
|
|
||||||
return loc;
|
return loc;
|
||||||
}
|
}
|
||||||
|
@ -109,4 +94,26 @@ std::ostream & operator<<(std::ostream & str, const Pos & pos)
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Pos::LinesIterator::bump(bool atFirst)
|
||||||
|
{
|
||||||
|
if (!atFirst) {
|
||||||
|
pastEnd = input.empty();
|
||||||
|
if (!input.empty() && input[0] == '\r')
|
||||||
|
input.remove_prefix(1);
|
||||||
|
if (!input.empty() && input[0] == '\n')
|
||||||
|
input.remove_prefix(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// nix line endings are not only \n as eg std::getline assumes, but also
|
||||||
|
// \r\n **and \r alone**. not treating them all the same causes error
|
||||||
|
// reports to not match with line numbers as the parser expects them.
|
||||||
|
auto eol = input.find_first_of("\r\n");
|
||||||
|
|
||||||
|
if (eol > input.size())
|
||||||
|
eol = input.size();
|
||||||
|
|
||||||
|
curLine = input.substr(0, eol);
|
||||||
|
input.remove_prefix(eol);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,48 @@ struct Pos
|
||||||
bool operator==(const Pos & rhs) const = default;
|
bool operator==(const Pos & rhs) const = default;
|
||||||
bool operator!=(const Pos & rhs) const = default;
|
bool operator!=(const Pos & rhs) const = default;
|
||||||
bool operator<(const Pos & rhs) const;
|
bool operator<(const Pos & rhs) const;
|
||||||
|
|
||||||
|
struct LinesIterator {
|
||||||
|
using difference_type = size_t;
|
||||||
|
using value_type = std::string_view;
|
||||||
|
using reference = const std::string_view &;
|
||||||
|
using pointer = const std::string_view *;
|
||||||
|
using iterator_category = std::input_iterator_tag;
|
||||||
|
|
||||||
|
LinesIterator(): pastEnd(true) {}
|
||||||
|
explicit LinesIterator(std::string_view input): input(input), pastEnd(input.empty()) {
|
||||||
|
if (!pastEnd)
|
||||||
|
bump(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
LinesIterator & operator++() {
|
||||||
|
bump(false);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
LinesIterator operator++(int) {
|
||||||
|
auto result = *this;
|
||||||
|
++*this;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
reference operator*() const { return curLine; }
|
||||||
|
pointer operator->() const { return &curLine; }
|
||||||
|
|
||||||
|
bool operator!=(const LinesIterator & other) const {
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
|
bool operator==(const LinesIterator & other) const {
|
||||||
|
return (pastEnd && other.pastEnd)
|
||||||
|
|| (std::forward_as_tuple(input.size(), input.data())
|
||||||
|
== std::forward_as_tuple(other.input.size(), other.input.data()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string_view input, curLine;
|
||||||
|
bool pastEnd = false;
|
||||||
|
|
||||||
|
void bump(bool atFirst);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream & operator<<(std::ostream & str, const Pos & pos);
|
std::ostream & operator<<(std::ostream & str, const Pos & pos);
|
||||||
|
|
6
tests/functional/lang/eval-fail-eol-1.err.exp
Normal file
6
tests/functional/lang/eval-fail-eol-1.err.exp
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
error: undefined variable 'invalid'
|
||||||
|
at /pwd/lang/eval-fail-eol-1.nix:2:1:
|
||||||
|
1| # foo
|
||||||
|
2| invalid
|
||||||
|
| ^
|
||||||
|
3| # bar
|
3
tests/functional/lang/eval-fail-eol-1.nix
Normal file
3
tests/functional/lang/eval-fail-eol-1.nix
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# foo
|
||||||
|
invalid
|
||||||
|
# bar
|
6
tests/functional/lang/eval-fail-eol-2.err.exp
Normal file
6
tests/functional/lang/eval-fail-eol-2.err.exp
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
error: undefined variable 'invalid'
|
||||||
|
at /pwd/lang/eval-fail-eol-2.nix:2:1:
|
||||||
|
1| # foo
|
||||||
|
2| invalid
|
||||||
|
| ^
|
||||||
|
3| # bar
|
2
tests/functional/lang/eval-fail-eol-2.nix
Normal file
2
tests/functional/lang/eval-fail-eol-2.nix
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# foo
invalid
|
||||||
|
# bar
|
6
tests/functional/lang/eval-fail-eol-3.err.exp
Normal file
6
tests/functional/lang/eval-fail-eol-3.err.exp
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
error: undefined variable 'invalid'
|
||||||
|
at /pwd/lang/eval-fail-eol-3.nix:2:1:
|
||||||
|
1| # foo
|
||||||
|
2| invalid
|
||||||
|
| ^
|
||||||
|
3| # bar
|
3
tests/functional/lang/eval-fail-eol-3.nix
Normal file
3
tests/functional/lang/eval-fail-eol-3.nix
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# foo
|
||||||
|
invalid
|
||||||
|
# bar
|
1
tests/functional/lang/eval-okay-inherit-attr-pos.exp
Normal file
1
tests/functional/lang/eval-okay-inherit-attr-pos.exp
Normal file
|
@ -0,0 +1 @@
|
||||||
|
[ { column = 17; file = "/pwd/lang/eval-okay-inherit-attr-pos.nix"; line = 4; } { column = 19; file = "/pwd/lang/eval-okay-inherit-attr-pos.nix"; line = 4; } { column = 21; file = "/pwd/lang/eval-okay-inherit-attr-pos.nix"; line = 5; } { column = 23; file = "/pwd/lang/eval-okay-inherit-attr-pos.nix"; line = 5; } ]
|
12
tests/functional/lang/eval-okay-inherit-attr-pos.nix
Normal file
12
tests/functional/lang/eval-okay-inherit-attr-pos.nix
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
let
|
||||||
|
d = 0;
|
||||||
|
x = 1;
|
||||||
|
y = { inherit d x; };
|
||||||
|
z = { inherit (y) d x; };
|
||||||
|
in
|
||||||
|
[
|
||||||
|
(builtins.unsafeGetAttrPos "d" y)
|
||||||
|
(builtins.unsafeGetAttrPos "x" y)
|
||||||
|
(builtins.unsafeGetAttrPos "d" z)
|
||||||
|
(builtins.unsafeGetAttrPos "x" z)
|
||||||
|
]
|
|
@ -3,3 +3,4 @@ error: attribute 'x' already defined at «stdin»:1:3
|
||||||
2| y = 456;
|
2| y = 456;
|
||||||
3| x = 789;
|
3| x = 789;
|
||||||
| ^
|
| ^
|
||||||
|
4| }
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
error: attribute 'x' already defined at «stdin»:9:5
|
error: attribute 'x' already defined at «stdin»:9:5
|
||||||
at «stdin»:10:17:
|
at «stdin»:10:18:
|
||||||
9| x = 789;
|
9| x = 789;
|
||||||
10| inherit (as) x;
|
10| inherit (as) x;
|
||||||
| ^
|
| ^
|
||||||
|
11| };
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
error: attribute 'x' already defined at «stdin»:9:5
|
error: attribute 'x' already defined at «stdin»:9:5
|
||||||
at «stdin»:10:17:
|
at «stdin»:10:18:
|
||||||
9| x = 789;
|
9| x = 789;
|
||||||
10| inherit (as) x;
|
10| inherit (as) x;
|
||||||
| ^
|
| ^
|
||||||
|
11| };
|
||||||
|
|
|
@ -3,3 +3,4 @@ error: attribute 'services.ssh.port' already defined at «stdin»:2:3
|
||||||
2| services.ssh.port = 22;
|
2| services.ssh.port = 22;
|
||||||
3| services.ssh.port = 23;
|
3| services.ssh.port = 23;
|
||||||
| ^
|
| ^
|
||||||
|
4| }
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
error: attribute 'x' already defined at «stdin»:6:12
|
error: attribute 'x' already defined at «stdin»:6:13
|
||||||
at «stdin»:7:12:
|
at «stdin»:7:13:
|
||||||
6| inherit x;
|
6| inherit x;
|
||||||
7| inherit x;
|
7| inherit x;
|
||||||
| ^
|
| ^
|
||||||
|
8| };
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error: syntax error, unexpected end of file, expecting '"'
|
error: syntax error, unexpected end of file, expecting '"'
|
||||||
at «stdin»:3:5:
|
at «stdin»:3:6:
|
||||||
2| # Note that this file must not end with a newline.
|
2| # Note that this file must not end with a newline.
|
||||||
3| a 1"$
|
3| a 1"$
|
||||||
| ^
|
| ^
|
||||||
|
|
5
tests/functional/lang/parse-fail-eof-pos.err.exp
Normal file
5
tests/functional/lang/parse-fail-eof-pos.err.exp
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
error: syntax error, unexpected end of file
|
||||||
|
at «stdin»:3:1:
|
||||||
|
2| # no content
|
||||||
|
3|
|
||||||
|
| ^
|
2
tests/functional/lang/parse-fail-eof-pos.nix
Normal file
2
tests/functional/lang/parse-fail-eof-pos.nix
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
(
|
||||||
|
# no content
|
|
@ -1,6 +1,6 @@
|
||||||
error: undefined variable 'gcc'
|
error: undefined variable 'gcc'
|
||||||
at «stdin»:8:12:
|
at «stdin»:9:13:
|
||||||
7|
|
|
||||||
8| body = ({
|
8| body = ({
|
||||||
| ^
|
|
||||||
9| inherit gcc;
|
9| inherit gcc;
|
||||||
|
| ^
|
||||||
|
10| }).gcc;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
error: syntax error, unexpected ':', expecting '}'
|
error: syntax error, unexpected ':', expecting '}'
|
||||||
at «stdin»:3:13:
|
at «stdin»:3:13:
|
||||||
2|
|
2|
|
||||||
3| f = {x, y :
|
3| f = {x, y : ["baz" "bar" z "bat"]}: x + y;
|
||||||
| ^
|
| ^
|
||||||
|
4|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
error: syntax error, unexpected invalid token, expecting end of file
|
error: syntax error, unexpected invalid token, expecting end of file
|
||||||
at «stdin»:1:5:
|
at «stdin»:1:5:
|
||||||
1| 123 テ
|
1| 123 é 4
|
||||||
| ^
|
| ^
|
||||||
|
2|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
({ fetchurl, localServer ? false, httpServer ? false, sslSupport ? false, pythonBindings ? false, javaSwigBindings ? false, javahlBindings ? false, stdenv, openssl ? null, httpd ? null, db4 ? null, expat, swig ? null, j2sdk ? null }: assert (expat != null); assert (localServer -> (db4 != null)); assert (httpServer -> ((httpd != null) && ((httpd).expat == expat))); assert (sslSupport -> ((openssl != null) && (httpServer -> ((httpd).openssl == openssl)))); assert (pythonBindings -> ((swig != null) && (swig).pythonSupport)); assert (javaSwigBindings -> ((swig != null) && (swig).javaSupport)); assert (javahlBindings -> (j2sdk != null)); ((stdenv).mkDerivation { inherit expat httpServer javaSwigBindings javahlBindings localServer pythonBindings sslSupport; builder = /foo/bar; db4 = (if localServer then db4 else null); httpd = (if httpServer then httpd else null); j2sdk = (if javaSwigBindings then (swig).j2sdk else (if javahlBindings then j2sdk else null)); name = "subversion-1.1.1"; openssl = (if sslSupport then openssl else null); patches = (if javahlBindings then [ (/javahl.patch) ] else [ ]); python = (if pythonBindings then (swig).python else null); src = (fetchurl { md5 = "a180c3fe91680389c210c99def54d9e0"; url = "http://subversion.tigris.org/tarballs/subversion-1.1.1.tar.bz2"; }); swig = (if (pythonBindings || javaSwigBindings) then swig else null); }))
|
({ db4 ? null, expat, fetchurl, httpServer ? false, httpd ? null, j2sdk ? null, javaSwigBindings ? false, javahlBindings ? false, localServer ? false, openssl ? null, pythonBindings ? false, sslSupport ? false, stdenv, swig ? null }: assert (expat != null); assert (localServer -> (db4 != null)); assert (httpServer -> ((httpd != null) && ((httpd).expat == expat))); assert (sslSupport -> ((openssl != null) && (httpServer -> ((httpd).openssl == openssl)))); assert (pythonBindings -> ((swig != null) && (swig).pythonSupport)); assert (javaSwigBindings -> ((swig != null) && (swig).javaSupport)); assert (javahlBindings -> (j2sdk != null)); ((stdenv).mkDerivation { inherit expat httpServer javaSwigBindings javahlBindings localServer pythonBindings sslSupport; builder = /foo/bar; db4 = (if localServer then db4 else null); httpd = (if httpServer then httpd else null); j2sdk = (if javaSwigBindings then (swig).j2sdk else (if javahlBindings then j2sdk else null)); name = "subversion-1.1.1"; openssl = (if sslSupport then openssl else null); patches = (if javahlBindings then [ (/javahl.patch) ] else [ ]); python = (if pythonBindings then (swig).python else null); src = (fetchurl { md5 = "a180c3fe91680389c210c99def54d9e0"; url = "http://subversion.tigris.org/tarballs/subversion-1.1.1.tar.bz2"; }); swig = (if (pythonBindings || javaSwigBindings) then swig else null); }))
|
||||||
|
|
|
@ -151,7 +151,7 @@ namespace nix {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(PrimOpTest, unsafeGetAttrPos) {
|
TEST_F(PrimOpTest, unsafeGetAttrPos) {
|
||||||
state.corepkgsFS->addFile(CanonPath("foo.nix"), "{ y = \"x\"; }");
|
state.corepkgsFS->addFile(CanonPath("foo.nix"), "\n\r\n\r{ y = \"x\"; }");
|
||||||
|
|
||||||
auto expr = "builtins.unsafeGetAttrPos \"y\" (import <nix/foo.nix>)";
|
auto expr = "builtins.unsafeGetAttrPos \"y\" (import <nix/foo.nix>)";
|
||||||
auto v = eval(expr);
|
auto v = eval(expr);
|
||||||
|
@ -165,10 +165,12 @@ namespace nix {
|
||||||
|
|
||||||
auto line = v.attrs->find(createSymbol("line"));
|
auto line = v.attrs->find(createSymbol("line"));
|
||||||
ASSERT_NE(line, nullptr);
|
ASSERT_NE(line, nullptr);
|
||||||
ASSERT_THAT(*line->value, IsIntEq(1));
|
state.forceValue(*line->value, noPos);
|
||||||
|
ASSERT_THAT(*line->value, IsIntEq(4));
|
||||||
|
|
||||||
auto column = v.attrs->find(createSymbol("column"));
|
auto column = v.attrs->find(createSymbol("column"));
|
||||||
ASSERT_NE(column, nullptr);
|
ASSERT_NE(column, nullptr);
|
||||||
|
state.forceValue(*column->value, noPos);
|
||||||
ASSERT_THAT(*column->value, IsIntEq(3));
|
ASSERT_THAT(*column->value, IsIntEq(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,8 +110,8 @@ TEST_F(ValuePrintingTests, vLambda)
|
||||||
.up = nullptr,
|
.up = nullptr,
|
||||||
.values = { }
|
.values = { }
|
||||||
};
|
};
|
||||||
PosTable::Origin origin((std::monostate()));
|
PosTable::Origin origin = state.positions.addOrigin(std::monostate(), 1);
|
||||||
auto posIdx = state.positions.add(origin, 1, 1);
|
auto posIdx = state.positions.add(origin, 0);
|
||||||
auto body = ExprInt(0);
|
auto body = ExprInt(0);
|
||||||
auto formals = Formals {};
|
auto formals = Formals {};
|
||||||
|
|
||||||
|
@ -558,8 +558,8 @@ TEST_F(ValuePrintingTests, ansiColorsLambda)
|
||||||
.up = nullptr,
|
.up = nullptr,
|
||||||
.values = { }
|
.values = { }
|
||||||
};
|
};
|
||||||
PosTable::Origin origin((std::monostate()));
|
PosTable::Origin origin = state.positions.addOrigin(std::monostate(), 1);
|
||||||
auto posIdx = state.positions.add(origin, 1, 1);
|
auto posIdx = state.positions.add(origin, 0);
|
||||||
auto body = ExprInt(0);
|
auto body = ExprInt(0);
|
||||||
auto formals = Formals {};
|
auto formals = Formals {};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue