mirror of
https://github.com/HigherOrderCO/Bend.git
synced 2024-09-19 07:37:56 +03:00
Refactor range reporting system to be a simple Source
This commit is contained in:
parent
e263c98e6e
commit
d67080b631
@ -1,3 +1,4 @@
|
||||
use itertools::Itertools;
|
||||
use TSPL::ParseError;
|
||||
|
||||
use crate::fun::{display::DisplayFn, Name, Source};
|
||||
@ -33,7 +34,7 @@ pub struct DiagnosticsConfig {
|
||||
pub struct Diagnostic {
|
||||
pub message: String,
|
||||
pub severity: Severity,
|
||||
pub span: Option<FileSpan>,
|
||||
pub source: Source,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||
@ -74,30 +75,29 @@ impl Diagnostics {
|
||||
Self { err_counter: 0, diagnostics: Default::default(), config }
|
||||
}
|
||||
|
||||
pub fn add_parsing_error(&mut self, err: impl std::fmt::Display, span: FileSpan) {
|
||||
pub fn add_parsing_error(&mut self, err: impl std::fmt::Display, source: Source) {
|
||||
self.err_counter += 1;
|
||||
self.add_diagnostic(err, Severity::Error, DiagnosticOrigin::Parsing, Some(span));
|
||||
self.add_diagnostic(err, Severity::Error, DiagnosticOrigin::Parsing, source);
|
||||
}
|
||||
|
||||
pub fn add_book_error(&mut self, err: impl std::fmt::Display) {
|
||||
self.err_counter += 1;
|
||||
self.add_diagnostic(err, Severity::Error, DiagnosticOrigin::Book, None);
|
||||
self.add_diagnostic(err, Severity::Error, DiagnosticOrigin::Book, Default::default());
|
||||
}
|
||||
|
||||
pub fn add_function_error(&mut self, err: impl std::fmt::Display, name: Name, source: Option<&Source>) {
|
||||
pub fn add_function_error(&mut self, err: impl std::fmt::Display, name: Name, source: Source) {
|
||||
self.err_counter += 1;
|
||||
let span = source.and_then(|src| src.span()).map(|s| FileSpan::new(s, None));
|
||||
self.add_diagnostic(
|
||||
err,
|
||||
Severity::Error,
|
||||
DiagnosticOrigin::Function(name.def_name_from_generated()),
|
||||
span,
|
||||
source,
|
||||
);
|
||||
}
|
||||
|
||||
pub fn add_inet_error(&mut self, err: impl std::fmt::Display, def_name: String) {
|
||||
self.err_counter += 1;
|
||||
self.add_diagnostic(err, Severity::Error, DiagnosticOrigin::Inet(def_name), None);
|
||||
self.add_diagnostic(err, Severity::Error, DiagnosticOrigin::Inet(def_name), Default::default());
|
||||
}
|
||||
|
||||
pub fn add_function_warning(
|
||||
@ -105,14 +105,18 @@ impl Diagnostics {
|
||||
warn: impl std::fmt::Display,
|
||||
warn_type: WarningType,
|
||||
def_name: Name,
|
||||
source: Option<&Source>,
|
||||
source: Source,
|
||||
) {
|
||||
let severity = self.config.warning_severity(warn_type);
|
||||
if severity == Severity::Error {
|
||||
self.err_counter += 1;
|
||||
}
|
||||
let span = source.and_then(|src| src.span()).map(|s| FileSpan::new(s, None));
|
||||
self.add_diagnostic(warn, severity, DiagnosticOrigin::Function(def_name.def_name_from_generated()), span);
|
||||
self.add_diagnostic(
|
||||
warn,
|
||||
severity,
|
||||
DiagnosticOrigin::Function(def_name.def_name_from_generated()),
|
||||
source,
|
||||
);
|
||||
}
|
||||
|
||||
pub fn add_book_warning(&mut self, warn: impl std::fmt::Display, warn_type: WarningType) {
|
||||
@ -120,7 +124,7 @@ impl Diagnostics {
|
||||
if severity == Severity::Error {
|
||||
self.err_counter += 1;
|
||||
}
|
||||
self.add_diagnostic(warn, severity, DiagnosticOrigin::Book, None);
|
||||
self.add_diagnostic(warn, severity, DiagnosticOrigin::Book, Default::default());
|
||||
}
|
||||
|
||||
pub fn add_diagnostic(
|
||||
@ -128,9 +132,9 @@ impl Diagnostics {
|
||||
msg: impl std::fmt::Display,
|
||||
severity: Severity,
|
||||
orig: DiagnosticOrigin,
|
||||
range: Option<FileSpan>,
|
||||
source: Source,
|
||||
) {
|
||||
let diag = Diagnostic { message: msg.to_string(), severity, span: range };
|
||||
let diag = Diagnostic { message: msg.to_string(), severity, source };
|
||||
self.diagnostics.entry(orig).or_default().push(diag)
|
||||
}
|
||||
|
||||
@ -142,7 +146,7 @@ impl Diagnostics {
|
||||
match result {
|
||||
Ok(t) => Some(t),
|
||||
Err(e) => {
|
||||
self.add_function_error(e, def_name, None);
|
||||
self.add_function_error(e, def_name, Default::default());
|
||||
None
|
||||
}
|
||||
}
|
||||
@ -189,52 +193,90 @@ impl Diagnostics {
|
||||
/// Returns a Display that prints the diagnostics with one of the given severities.
|
||||
pub fn display_with_severity(&self, severity: Severity) -> impl std::fmt::Display + '_ {
|
||||
DisplayFn(move |f| {
|
||||
fn filter<'a>(
|
||||
errs: impl IntoIterator<Item = &'a Diagnostic>,
|
||||
severity: Severity,
|
||||
) -> impl Iterator<Item = &'a Diagnostic> {
|
||||
errs.into_iter().filter(move |err| err.severity == severity)
|
||||
}
|
||||
// We want to print diagnostics information somewhat like this:
|
||||
// ```
|
||||
// In file A :
|
||||
// In definition X :
|
||||
// {error}
|
||||
// In definition Y :
|
||||
// {error}
|
||||
//
|
||||
// In file B :
|
||||
// In compiled Inet Z :
|
||||
// {error}
|
||||
// {...}
|
||||
// ```
|
||||
// The problem is, diagnostics data is currently structured as a mapping from something like
|
||||
// DiagnosticOrigin to (DiagnosticMessage, DiagnosticFile), and we would need something
|
||||
// like a mapping from DiagnosticFile to DiagnosticOrigin to DiagnosticMessage in order
|
||||
// to print it cleanly. We might want to change it later to have this structure,
|
||||
// but meanwhile, we do the transformations below to make the goal possible.
|
||||
|
||||
let mut has_msg = false;
|
||||
for (orig, errs) in &self.diagnostics {
|
||||
let mut errs = filter(errs, severity).peekable();
|
||||
if errs.peek().is_some() {
|
||||
match orig {
|
||||
DiagnosticOrigin::Parsing => {
|
||||
for err in errs {
|
||||
writeln!(f, "{err}")?;
|
||||
}
|
||||
}
|
||||
DiagnosticOrigin::Book => {
|
||||
for err in errs {
|
||||
writeln!(f, "{err}")?;
|
||||
}
|
||||
}
|
||||
DiagnosticOrigin::Function(nam) => {
|
||||
writeln!(f, "\x1b[1mIn definition '\x1b[4m{}\x1b[0m\x1b[1m':\x1b[0m", nam)?;
|
||||
for err in errs {
|
||||
writeln!(f, "{:ERR_INDENT_SIZE$}{err}", "")?;
|
||||
}
|
||||
}
|
||||
DiagnosticOrigin::Inet(nam) => {
|
||||
writeln!(f, "\x1b[1mIn compiled inet '\x1b[4m{}\x1b[0m\x1b[1m':\x1b[0m", nam)?;
|
||||
for err in errs {
|
||||
writeln!(f, "{:ERR_INDENT_SIZE$}{err}", "")?;
|
||||
}
|
||||
}
|
||||
DiagnosticOrigin::Readback => {
|
||||
writeln!(f, "\x1b[1mDuring readback:\x1b[0m")?;
|
||||
for err in errs {
|
||||
writeln!(f, "{:ERR_INDENT_SIZE$}{err}", "")?;
|
||||
// Flatten Iter<(Origin, Vec<Diagnostic>)> into Iter<(Origin, Diagnostic)>
|
||||
let diagnostics = self
|
||||
.diagnostics
|
||||
.iter()
|
||||
.flat_map(|(origin, diagnostics)| diagnostics.iter().map(move |diagnostic| (origin, diagnostic)));
|
||||
// Remove diagnostics with unwanted Severity
|
||||
let diagnostics = diagnostics.filter(|(_, diag)| diag.severity == severity);
|
||||
// Group diagnostics by their file names
|
||||
let file_groups = diagnostics.group_by(|diag| diag.1.source.file.as_ref());
|
||||
|
||||
// Now, we have a mapping from DiagnosticFile to (DiagnosticOrigin, DiagnosticMessage).
|
||||
for (file, origins_and_diagnostics) in &file_groups {
|
||||
// We don't have to check if the amount of diagnostics in this file is greater than 0,
|
||||
// since we will only get a file if it was included in a diagnostic.
|
||||
match &file {
|
||||
Some(name) => writeln!(f, "\x1b[1mIn \x1b[4m{}\x1b[0m\x1b[1m :\x1b[0m", name)?,
|
||||
None => writeln!(f, "\x1b[1mDuring execution :\x1b[0m")?,
|
||||
};
|
||||
|
||||
// Group errors by their origin
|
||||
let origin_groups = origins_and_diagnostics.group_by(|(origin, _)| *origin);
|
||||
|
||||
let mut has_msg = false;
|
||||
// Finally, we have our mapping of DiagnosticOrigin to DiagnosticMessage back.
|
||||
for (origin, origins_and_diagnostics) in &origin_groups {
|
||||
// We don't care about DiagnosticOrigins here, so remove them.
|
||||
let mut diagnostics = origins_and_diagnostics.map(|(_, diag)| diag).peekable();
|
||||
|
||||
if diagnostics.peek().is_some() {
|
||||
match origin {
|
||||
DiagnosticOrigin::Parsing => {
|
||||
for err in diagnostics {
|
||||
writeln!(f, "{err}")?;
|
||||
}
|
||||
}
|
||||
DiagnosticOrigin::Book => {
|
||||
for err in diagnostics {
|
||||
writeln!(f, "{err}")?;
|
||||
}
|
||||
}
|
||||
DiagnosticOrigin::Function(nam) => {
|
||||
writeln!(f, "\x1b[1mIn definition '\x1b[4m{}\x1b[0m\x1b[1m':\x1b[0m", nam)?;
|
||||
for err in diagnostics {
|
||||
writeln!(f, "{:ERR_INDENT_SIZE$}{err}", "")?;
|
||||
}
|
||||
}
|
||||
DiagnosticOrigin::Inet(nam) => {
|
||||
writeln!(f, "\x1b[1mIn compiled inet '\x1b[4m{}\x1b[0m\x1b[1m':\x1b[0m", nam)?;
|
||||
for err in diagnostics {
|
||||
writeln!(f, "{:ERR_INDENT_SIZE$}{err}", "")?;
|
||||
}
|
||||
}
|
||||
DiagnosticOrigin::Readback => {
|
||||
writeln!(f, "\x1b[1mDuring readback:\x1b[0m")?;
|
||||
for err in diagnostics {
|
||||
writeln!(f, "{:ERR_INDENT_SIZE$}{err}", "")?;
|
||||
}
|
||||
}
|
||||
}
|
||||
has_msg = true;
|
||||
}
|
||||
has_msg = true;
|
||||
}
|
||||
}
|
||||
if has_msg {
|
||||
writeln!(f)?;
|
||||
if has_msg {
|
||||
writeln!(f)?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
@ -267,7 +309,7 @@ impl From<String> for Diagnostics {
|
||||
Self {
|
||||
diagnostics: BTreeMap::from_iter([(
|
||||
DiagnosticOrigin::Book,
|
||||
vec![Diagnostic { message: value, severity: Severity::Error, span: None }],
|
||||
vec![Diagnostic { message: value, severity: Severity::Error, source: Default::default() }],
|
||||
)]),
|
||||
..Default::default()
|
||||
}
|
||||
@ -284,7 +326,7 @@ impl From<ParseError> for Diagnostics {
|
||||
Self {
|
||||
diagnostics: BTreeMap::from_iter([(
|
||||
DiagnosticOrigin::Parsing,
|
||||
vec![Diagnostic { message: value.into(), severity: Severity::Error, span: None }],
|
||||
vec![Diagnostic { message: value.into(), severity: Severity::Error, source: Default::default() }],
|
||||
)]),
|
||||
..Default::default()
|
||||
}
|
||||
@ -331,12 +373,7 @@ impl Default for DiagnosticsConfig {
|
||||
|
||||
impl Display for Diagnostic {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
// TODO: this could be problematic when printing multiple errors from the same file
|
||||
// currently, there shouldn't be any `Diagnostics` with multiple problems `FileSpan`s
|
||||
match &self.span {
|
||||
Some(FileSpan { file: Some(file), .. }) => write!(f, "In {} :\n{}", file, self.message),
|
||||
_ => write!(f, "{}", self.message),
|
||||
}
|
||||
write!(f, "{}", self.message)
|
||||
}
|
||||
}
|
||||
|
||||
@ -443,17 +480,3 @@ impl TextSpan {
|
||||
TextSpan::new(TextLocation::new(start_line, start_char), TextLocation::new(end_line, end_char))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Hash, PartialEq, PartialOrd, Ord, Eq)]
|
||||
pub struct FileSpan {
|
||||
pub span: TextSpan,
|
||||
// Storing files as Strings, could be done as file IDs in the future
|
||||
// This is currently optional, we might want to change it later
|
||||
pub file: Option<String>,
|
||||
}
|
||||
|
||||
impl FileSpan {
|
||||
pub fn new(span: TextSpan, origin: Option<&str>) -> Self {
|
||||
FileSpan { span, file: origin.map(|s| s.into()) }
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ impl Ctx<'_> {
|
||||
self.info.add_function_error(
|
||||
format!("Reference to undefined function '{unbound}'"),
|
||||
def.name.clone(),
|
||||
Some(&def.source),
|
||||
def.source.clone(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ impl Ctx<'_> {
|
||||
}
|
||||
|
||||
for err in errs {
|
||||
self.info.add_function_error(err, def_name.clone(), Some(&def.source));
|
||||
self.info.add_function_error(err, def_name.clone(), def.source.clone());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
use super::{
|
||||
parser::{ParseBook, TermParser},
|
||||
Book, Name,
|
||||
Book, Name, Source, SourceKind,
|
||||
};
|
||||
use crate::{
|
||||
diagnostics::{Diagnostics, DiagnosticsConfig, FileSpan, TextSpan},
|
||||
diagnostics::{Diagnostics, DiagnosticsConfig, TextSpan},
|
||||
imports::PackageLoader,
|
||||
};
|
||||
use std::path::Path;
|
||||
@ -44,7 +44,9 @@ pub fn do_parse_book(code: &str, origin: &Path, mut book: ParseBook) -> Result<P
|
||||
TermParser::new(code).parse_book(book, false).map_err(|err| {
|
||||
let mut diagnostics = Diagnostics::default();
|
||||
let span = TextSpan::from_byte_span(code, err.span.0..err.span.1);
|
||||
diagnostics.add_parsing_error(err, FileSpan { span, file: Some(origin.to_string_lossy().into()) });
|
||||
let source =
|
||||
Source { file: Some(origin.to_string_lossy().into()), span: Some(span), kind: SourceKind::User };
|
||||
diagnostics.add_parsing_error(err, source);
|
||||
diagnostics
|
||||
})
|
||||
}
|
||||
|
@ -69,14 +69,24 @@ pub struct Definition {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub enum Source {
|
||||
pub struct Source {
|
||||
pub file: Option<String>,
|
||||
pub span: Option<TextSpan>,
|
||||
pub kind: SourceKind,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub enum SourceKind {
|
||||
/// Built into the language.
|
||||
Builtin,
|
||||
/// Was generated by the compiler.
|
||||
Generated,
|
||||
/// Source code location from the current book.
|
||||
Local(TextSpan),
|
||||
/// Imported from another package.
|
||||
/// Source code from a local book.
|
||||
User,
|
||||
/// Source code from an imported book.
|
||||
Imported,
|
||||
/// Unknown by the compiler at this stage.
|
||||
Unknown,
|
||||
}
|
||||
|
||||
/// An HVM native definition.
|
||||
@ -1022,7 +1032,8 @@ impl Definition {
|
||||
}
|
||||
|
||||
pub fn new_gen(name: Name, rules: Vec<Rule>, builtin: bool) -> Self {
|
||||
let source = if builtin { Source::Builtin } else { Source::Generated };
|
||||
let kind = if builtin { SourceKind::Builtin } else { SourceKind::Generated };
|
||||
let source = Source { file: None, span: None, kind };
|
||||
Self { name, rules, source }
|
||||
}
|
||||
|
||||
@ -1117,18 +1128,17 @@ impl Book {
|
||||
|
||||
impl Source {
|
||||
pub fn is_builtin(&self) -> bool {
|
||||
matches!(self, Source::Builtin)
|
||||
matches!(self.kind, SourceKind::Builtin)
|
||||
}
|
||||
|
||||
pub fn is_local(&self) -> bool {
|
||||
matches!(self, Source::Local(..))
|
||||
matches!(self.kind, SourceKind::User)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn span(&self) -> Option<TextSpan> {
|
||||
match self {
|
||||
Source::Local(span) => Some(*span),
|
||||
_ => None,
|
||||
}
|
||||
impl Default for Source {
|
||||
fn default() -> Self {
|
||||
Self { file: None, span: None, kind: SourceKind::Unknown }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -550,7 +550,12 @@ impl Reader<'_> {
|
||||
for (err, count) in err_counts {
|
||||
let count_msg = if count > 1 { format!(" ({count} occurrences)") } else { "".to_string() };
|
||||
let msg = format!("{}{}", err, count_msg);
|
||||
diagnostics.add_diagnostic(msg.as_str(), Severity::Warning, DiagnosticOrigin::Readback, None);
|
||||
diagnostics.add_diagnostic(
|
||||
msg.as_str(),
|
||||
Severity::Warning,
|
||||
DiagnosticOrigin::Readback,
|
||||
Default::default(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,8 @@ use indexmap::IndexMap;
|
||||
use itertools::Itertools;
|
||||
use TSPL::{ParseError, Parser};
|
||||
|
||||
use super::SourceKind;
|
||||
|
||||
type FunDefinition = super::Definition;
|
||||
type ImpDefinition = crate::imp::Definition;
|
||||
|
||||
@ -165,8 +167,12 @@ impl<'a> TermParser<'a> {
|
||||
self.index = rewind_index;
|
||||
let (nam, ctrs) = self.parse_datatype()?;
|
||||
let end_idx = *self.index();
|
||||
let span = TextSpan::from_byte_span(self.input(), ini_idx..end_idx);
|
||||
let source = if builtin { Source::Builtin } else { Source::Local(span) };
|
||||
|
||||
let span = Some(TextSpan::from_byte_span(self.input(), ini_idx..end_idx));
|
||||
let kind = if builtin { SourceKind::Builtin } else { SourceKind::User };
|
||||
let file = Some(book.source.to_string());
|
||||
let source = Source { file, span, kind };
|
||||
|
||||
let adt = Adt { ctrs, source };
|
||||
self.add_fun_type(&mut book, nam, adt, ini_idx..end_idx)?;
|
||||
indent = self.advance_newlines()?;
|
||||
@ -278,8 +284,12 @@ impl<'a> TermParser<'a> {
|
||||
let body = p.parse_net()?;
|
||||
*self.index() = ini_idx + *p.index();
|
||||
let end_idx = *self.index();
|
||||
let span = TextSpan::from_byte_span(self.input(), ini_idx..end_idx);
|
||||
let source = if builtin { Source::Builtin } else { Source::Local(span) };
|
||||
|
||||
let span = Some(TextSpan::from_byte_span(self.input(), ini_idx..end_idx));
|
||||
let kind = if builtin { SourceKind::Builtin } else { SourceKind::User };
|
||||
let file = None; // should we pass the book's source here?
|
||||
let source = Source { file, span, kind };
|
||||
|
||||
let def = HvmDefinition { name: name.clone(), body, source };
|
||||
Ok(def)
|
||||
}
|
||||
@ -653,8 +663,9 @@ impl<'a> TermParser<'a> {
|
||||
if name == "def" {
|
||||
// parse the nxt def term.
|
||||
self.index = nxt_def;
|
||||
let span = TextSpan::from_byte_span(self.input(), nxt_def..*self.index());
|
||||
let def = FunDefinition::new(name, rules, Source::Local(span));
|
||||
let span = Some(TextSpan::from_byte_span(self.input(), nxt_def..*self.index()));
|
||||
let source = Source { span, file: None, kind: SourceKind::User };
|
||||
let def = FunDefinition::new(name, rules, source);
|
||||
return Ok(Term::Def { def, nxt: Box::new(self.parse_term()?) });
|
||||
}
|
||||
if name == cur_name {
|
||||
@ -672,8 +683,8 @@ impl<'a> TermParser<'a> {
|
||||
}
|
||||
}
|
||||
let nxt = self.parse_term()?;
|
||||
let span = TextSpan::from_byte_span(self.input(), nxt_term..*self.index());
|
||||
let def = FunDefinition::new(cur_name, rules, Source::Local(span));
|
||||
let span = Some(TextSpan::from_byte_span(self.input(), nxt_term..*self.index()));
|
||||
let def = FunDefinition::new(cur_name, rules, Source { span, file: None, kind: SourceKind::User });
|
||||
return Ok(Term::Def { def, nxt: Box::new(nxt) });
|
||||
}
|
||||
|
||||
@ -938,7 +949,7 @@ impl<'a> TermParser<'a> {
|
||||
// Continuing with a new rule to the current definition
|
||||
(Some(def), Some(last_rule)) if last_rule == name => {
|
||||
def.rules.push(rule);
|
||||
if let Source::Local(s) = &mut def.source {
|
||||
if let Some(s) = &mut def.source.span {
|
||||
s.end = TextLocation::from_byte_loc(self.input(), span.end);
|
||||
}
|
||||
}
|
||||
@ -955,8 +966,10 @@ impl<'a> TermParser<'a> {
|
||||
// Adding the first rule of a new definition
|
||||
(None, _) => {
|
||||
self.check_top_level_redefinition(name, book, span.clone())?;
|
||||
let span = TextSpan::from_byte_span(self.input(), span.start..span.end);
|
||||
let source = if builtin { Source::Builtin } else { Source::Local(span) };
|
||||
let span = Some(TextSpan::from_byte_span(self.input(), span.start..span.end));
|
||||
let file = Some(book.source.to_string());
|
||||
let kind = if builtin { SourceKind::Builtin } else { SourceKind::User };
|
||||
let source = Source { file, span, kind };
|
||||
book.fun_defs.insert(name.clone(), FunDefinition::new(name.clone(), vec![rule], source));
|
||||
}
|
||||
}
|
||||
@ -971,8 +984,10 @@ impl<'a> TermParser<'a> {
|
||||
builtin: bool,
|
||||
) -> ParseResult<()> {
|
||||
self.check_top_level_redefinition(&def.name, book, span.clone())?;
|
||||
let span = TextSpan::from_byte_span(self.input(), span.start..span.end);
|
||||
let source = if builtin { Source::Builtin } else { Source::Local(span) };
|
||||
let span = Some(TextSpan::from_byte_span(self.input(), span.start..span.end));
|
||||
let kind = if builtin { SourceKind::Builtin } else { SourceKind::User };
|
||||
let file = Some(book.source.to_string());
|
||||
let source = Source { file, span, kind };
|
||||
def.source = source;
|
||||
book.imp_defs.insert(def.name.clone(), def);
|
||||
Ok(())
|
||||
@ -988,15 +1003,19 @@ impl<'a> TermParser<'a> {
|
||||
&mut self,
|
||||
enum_: Enum,
|
||||
book: &mut ParseBook,
|
||||
span: Range<usize>,
|
||||
range: Range<usize>,
|
||||
builtin: bool,
|
||||
) -> ParseResult<()> {
|
||||
self.check_type_redefinition(&enum_.name, book, span.clone())?;
|
||||
let text_span = TextSpan::from_byte_span(self.input(), span.start..span.end);
|
||||
let source = if builtin { Source::Builtin } else { Source::Local(text_span) };
|
||||
self.check_type_redefinition(&enum_.name, book, range.clone())?;
|
||||
|
||||
let span = Some(TextSpan::from_byte_span(self.input(), range.start..range.end));
|
||||
let kind = if builtin { SourceKind::Builtin } else { SourceKind::User };
|
||||
let file = Some(book.source.to_string());
|
||||
let source = Source { file, span, kind };
|
||||
|
||||
let mut adt = Adt { ctrs: Default::default(), source };
|
||||
for variant in enum_.variants {
|
||||
self.check_top_level_redefinition(&enum_.name, book, span.clone())?;
|
||||
self.check_top_level_redefinition(&enum_.name, book, range.clone())?;
|
||||
book.ctrs.insert(variant.name.clone(), enum_.name.clone());
|
||||
adt.ctrs.insert(variant.name, variant.fields);
|
||||
}
|
||||
@ -1042,8 +1061,12 @@ impl<'a> TermParser<'a> {
|
||||
) -> ParseResult<()> {
|
||||
self.check_type_redefinition(&obj.name, book, span.clone())?;
|
||||
self.check_top_level_redefinition(&obj.name, book, span.clone())?;
|
||||
let span = TextSpan::from_byte_span(self.input(), span.start..span.end);
|
||||
let source = if builtin { Source::Builtin } else { Source::Local(span) };
|
||||
|
||||
let span = Some(TextSpan::from_byte_span(self.input(), span.start..span.end));
|
||||
let kind = if builtin { SourceKind::Builtin } else { SourceKind::User };
|
||||
let file = Some(book.source.to_string());
|
||||
let source = Source { file, span, kind };
|
||||
|
||||
let mut adt = Adt { ctrs: Default::default(), source };
|
||||
book.ctrs.insert(obj.name.clone(), obj.name.clone());
|
||||
adt.ctrs.insert(obj.name.clone(), obj.fields);
|
||||
|
@ -26,7 +26,7 @@ impl Ctx<'_> {
|
||||
self.info.add_function_error(
|
||||
format!("Expected the entrypoint function to have only one rule, found {n_rules}."),
|
||||
entrypoint.clone(),
|
||||
None,
|
||||
main_def.source.clone(),
|
||||
);
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ impl Ctx<'_> {
|
||||
self.info.add_function_error(
|
||||
format!("Expected the entrypoint function to only have variable patterns, found '{pat}'."),
|
||||
entrypoint.clone(),
|
||||
None,
|
||||
main_def.source.clone(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
diagnostics::WarningType,
|
||||
fun::{Book, Ctx, Name, Source, Term},
|
||||
fun::{Book, Ctx, Name, SourceKind, Term},
|
||||
maybe_grow,
|
||||
};
|
||||
use hvm::ast::{Net, Tree};
|
||||
@ -77,12 +77,12 @@ impl Ctx<'_> {
|
||||
// Prune if `prune_all`, otherwise show a warning.
|
||||
if prune_all {
|
||||
rm_def(self.book, &def);
|
||||
} else if !def.is_generated() && !matches!(src, Source::Generated) {
|
||||
} else if !def.is_generated() && !matches!(src.kind, SourceKind::Generated) {
|
||||
self.info.add_function_warning(
|
||||
"Definition is unused.",
|
||||
WarningType::UnusedDefinition,
|
||||
def,
|
||||
Some(&src),
|
||||
src,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ impl Ctx<'_> {
|
||||
let mut fresh = 0;
|
||||
for rule in def.rules.iter_mut() {
|
||||
if let Err(err) = rule.body.desugar_bend(&def.name, &mut fresh, &mut new_defs, &def.source) {
|
||||
self.info.add_function_error(err, def.name.clone(), Some(&def.source));
|
||||
self.info.add_function_error(err, def.name.clone(), def.source.clone());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ impl Ctx<'_> {
|
||||
&def.source,
|
||||
);
|
||||
if let Err(e) = res {
|
||||
self.info.add_function_error(e, def.name.clone(), Some(&def.source));
|
||||
self.info.add_function_error(e, def.name.clone(), def.source.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,13 +24,13 @@ impl Ctx<'_> {
|
||||
DesugarMatchDefErr::AdtNotExhaustive { .. }
|
||||
| DesugarMatchDefErr::NumMissingDefault
|
||||
| DesugarMatchDefErr::TypeMismatch { .. } => {
|
||||
self.info.add_function_error(err, def_name.clone(), Some(&def.source))
|
||||
self.info.add_function_error(err, def_name.clone(), def.source.clone())
|
||||
}
|
||||
DesugarMatchDefErr::RepeatedBind { .. } => self.info.add_function_warning(
|
||||
err,
|
||||
WarningType::RepeatedBind,
|
||||
def_name.clone(),
|
||||
Some(&def.source),
|
||||
def.source.clone(),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ impl Ctx<'_> {
|
||||
for def in self.book.defs.values_mut() {
|
||||
for rule in def.rules.iter_mut() {
|
||||
if let Err(err) = rule.body.desugar_open(&self.book.adts) {
|
||||
self.info.add_function_error(err, def.name.clone(), Some(&def.source));
|
||||
self.info.add_function_error(err, def.name.clone(), def.source.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ impl Ctx<'_> {
|
||||
for def in self.book.defs.values_mut() {
|
||||
for rule in def.rules.iter_mut() {
|
||||
if let Err(e) = rule.body.desugar_with_blocks(None, &def_names) {
|
||||
self.info.add_function_error(e, def.name.clone(), Some(&def.source));
|
||||
self.info.add_function_error(e, def.name.clone(), def.source.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ impl Ctx<'_> {
|
||||
}
|
||||
|
||||
for err in errs {
|
||||
self.info.add_function_error(err, def.name.clone(), Some(&def.source));
|
||||
self.info.add_function_error(err, def.name.clone(), def.source.clone());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,25 +51,25 @@ impl Ctx<'_> {
|
||||
for err in errs {
|
||||
match err {
|
||||
FixMatchErr::AdtMismatch { .. } | FixMatchErr::NonExhaustiveMatch { .. } => {
|
||||
self.info.add_function_error(err, def.name.clone(), Some(&def.source))
|
||||
self.info.add_function_error(err, def.name.clone(), def.source.clone())
|
||||
}
|
||||
FixMatchErr::IrrefutableMatch { .. } => self.info.add_function_warning(
|
||||
err,
|
||||
WarningType::IrrefutableMatch,
|
||||
def.name.clone(),
|
||||
Some(&def.source),
|
||||
def.source.clone(),
|
||||
),
|
||||
FixMatchErr::UnreachableMatchArms { .. } => self.info.add_function_warning(
|
||||
err,
|
||||
WarningType::UnreachableMatch,
|
||||
def.name.clone(),
|
||||
Some(&def.source),
|
||||
def.source.clone(),
|
||||
),
|
||||
FixMatchErr::RedundantArm { .. } => self.info.add_function_warning(
|
||||
err,
|
||||
WarningType::RedundantMatch,
|
||||
def.name.clone(),
|
||||
Some(&def.source),
|
||||
def.source.clone(),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ pub fn check_net_sizes(
|
||||
diagnostics.add_function_error(
|
||||
format!("Definition is too large for HVM {target_lang} (size={nodes}, max size={net_size_bound}). Please break it into smaller pieces."),
|
||||
Name::new(name),
|
||||
None
|
||||
Default::default()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::{
|
||||
fun::{
|
||||
parser::{is_num_char, Indent, ParseResult, ParserCommons},
|
||||
CtrField, Name, Num, Op, STRINGS,
|
||||
CtrField, Name, Num, Op, Source, SourceKind, STRINGS,
|
||||
},
|
||||
imp::{AssignPattern, Definition, Enum, Expr, InPlaceOp, MatchArm, Stmt, Variant},
|
||||
maybe_grow,
|
||||
@ -1037,7 +1037,8 @@ impl<'a> PyParser<'a> {
|
||||
indent.exit_level();
|
||||
|
||||
// Temporary source, should be overwritten later
|
||||
let def = Definition { name, params, body, source: crate::fun::Source::Generated };
|
||||
let source = Source { file: None, span: None, kind: SourceKind::Generated };
|
||||
let def = Definition { name, params, body, source };
|
||||
Ok((def, nxt_indent))
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ impl Definition {
|
||||
pub fn to_fun(self) -> Result<fun::Definition, Diagnostics> {
|
||||
let body = self.body.into_fun().map_err(|e| {
|
||||
let mut diags = Diagnostics::default();
|
||||
diags.add_function_error(e, self.name.clone(), Some(&self.source));
|
||||
diags.add_function_error(e, self.name.clone(), self.source.clone());
|
||||
diags
|
||||
})?;
|
||||
|
||||
@ -43,7 +43,7 @@ impl Definition {
|
||||
diags.add_function_error(
|
||||
"Function doesn't end with a return statement",
|
||||
self.name,
|
||||
Some(&self.source),
|
||||
self.source.clone(),
|
||||
);
|
||||
return Err(diags);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
use super::{BindMap, ImportsMap, PackageLoader};
|
||||
use crate::{
|
||||
diagnostics::{Diagnostics, DiagnosticsConfig},
|
||||
fun::{parser::ParseBook, Adt, Book, Definition, HvmDefinition, Name, Rule, Source, Term},
|
||||
fun::{parser::ParseBook, Adt, Book, Definition, HvmDefinition, Name, Rule, Source, SourceKind, Term},
|
||||
imp::{self, Expr, Stmt},
|
||||
imports::packages::Packages,
|
||||
};
|
||||
@ -166,7 +166,7 @@ impl ParseBook {
|
||||
// starting with `__` if not imported by the main book.
|
||||
for (mut name, mut adt) in adts {
|
||||
if adt.source.is_local() {
|
||||
adt.source = Source::Imported;
|
||||
adt.source.kind = SourceKind::Imported;
|
||||
name = Name::new(format!("{}/{}", src, name));
|
||||
|
||||
let mangle_name = !main_imports.contains_source(&name);
|
||||
@ -217,7 +217,7 @@ impl ParseBook {
|
||||
// Applies the binds for the new names for every definition
|
||||
for (_, def) in self.local_defs_mut() {
|
||||
def.apply_binds(false, &canonical_map);
|
||||
*def.source_mut() = Source::Imported;
|
||||
def.source_mut().kind = SourceKind::Imported;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/cli/desugar_merge.bend
|
||||
---
|
||||
[4m[1m[33mWarnings:[0m
|
||||
[1mIn [4mtests/golden_tests/cli/desugar_merge.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mZ[0m[1m':[0m
|
||||
Definition is unused.
|
||||
|
||||
|
@ -3,6 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/cli/desugar_pretty.bend
|
||||
---
|
||||
[4m[1m[33mWarnings:[0m
|
||||
[1mIn [4mtests/golden_tests/cli/desugar_pretty.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mFoo[0m[1m':[0m
|
||||
Definition is unused.
|
||||
|
||||
|
@ -3,4 +3,5 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/cli/input_file_not_found.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mDuring execution :[0m
|
||||
The file 'tests/golden_tests/missing_dir/input_file_not_found.bend' was not found.
|
||||
|
@ -3,9 +3,11 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/cli/warn_and_err.bend
|
||||
---
|
||||
[4m[1m[33mWarnings:[0m
|
||||
[1mIn [4mtests/golden_tests/cli/warn_and_err.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mFoo[0m[1m':[0m
|
||||
Repeated bind in pattern matching rule: 'a'.
|
||||
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mIn [4mtests/golden_tests/cli/warn_and_err.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mMain[0m[1m':[0m
|
||||
Unbound variable 'a'.
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/360_no_scope.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/compile_file/360_no_scope.bend :
|
||||
[1mIn [4mtests/golden_tests/compile_file/360_no_scope.bend[0m[1m :[0m
|
||||
[1m- expected:[0m '='
|
||||
[1m- detected:[0m end of input
|
||||
[0m 6 | [4m[31m [0m
|
||||
|
@ -3,5 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/ask_outside_do.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mIn [4mtests/golden_tests/compile_file/ask_outside_do.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mmain[0m[1m':[0m
|
||||
Monadic bind operation 'x <- ...' used outside of a `do` block.
|
||||
|
@ -3,5 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/cyclic_global_lam.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mDuring execution :[0m
|
||||
[1mIn compiled inet '[4mmain[0m[1m':[0m
|
||||
Found term that compiles into an inet with a vicious cycle
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/elif_no_else.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/compile_file/elif_no_else.bend :
|
||||
[1mIn [4mtests/golden_tests/compile_file/elif_no_else.bend[0m[1m :[0m
|
||||
[1m- expected:[0m 'else' or 'elif'
|
||||
[1m- detected:[0m end of input
|
||||
[0m 6 | [4m[31m [0m
|
||||
|
@ -3,6 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/error_data_def_name.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/compile_file/error_data_def_name.bend :
|
||||
[1mIn [4mtests/golden_tests/compile_file/error_data_def_name.bend[0m[1m :[0m
|
||||
Redefinition of constructor 'A/A'.
|
||||
[0m 2 | [4m[31mA/A = 0[0m
|
||||
|
@ -3,6 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/error_messages.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mIn [4mtests/golden_tests/compile_file/error_messages.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mFoo[0m[1m':[0m
|
||||
Unbound constructor 'C' in pattern matching rule.
|
||||
Unbound constructor 'D' in pattern matching rule.
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/just_a_name.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/compile_file/just_a_name.bend :
|
||||
[1mIn [4mtests/golden_tests/compile_file/just_a_name.bend[0m[1m :[0m
|
||||
[1m- expected:[0m pattern or '='
|
||||
[1m- detected:[0m end of input
|
||||
[0m 1 | asdf[0m
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/just_data.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/compile_file/just_data.bend :
|
||||
[1mIn [4mtests/golden_tests/compile_file/just_data.bend[0m[1m :[0m
|
||||
[1m- expected:[0m datatype name
|
||||
[1m- detected:[0m end of input
|
||||
[0m 1 | type[4m[31m [0m
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/just_paren.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/compile_file/just_paren.bend :
|
||||
[1mIn [4mtests/golden_tests/compile_file/just_paren.bend[0m[1m :[0m
|
||||
[1m- expected:[0m function name
|
||||
[1m- detected:[0m end of input
|
||||
[0m 2 | ([4m[31m [0m
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/just_rule_paren.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/compile_file/just_rule_paren.bend :
|
||||
[1mIn [4mtests/golden_tests/compile_file/just_rule_paren.bend[0m[1m :[0m
|
||||
[1m- expected:[0m '='
|
||||
[1m- detected:[0m end of input
|
||||
[0m 1 | (rule)[4m[31m [0m
|
||||
|
@ -3,5 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/mismatched_ask_statements.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mIn [4mtests/golden_tests/compile_file/mismatched_ask_statements.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mmain[0m[1m':[0m
|
||||
'match' arms end with different assignments.
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/missing_adt_eq.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/compile_file/missing_adt_eq.bend :
|
||||
[1mIn [4mtests/golden_tests/compile_file/missing_adt_eq.bend[0m[1m :[0m
|
||||
[1m- expected:[0m '='
|
||||
[1m- detected:[0m end of input
|
||||
[0m 1 | type Adt[4m[31m [0m
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/missing_ctrs.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/compile_file/missing_ctrs.bend :
|
||||
[1mIn [4mtests/golden_tests/compile_file/missing_ctrs.bend[0m[1m :[0m
|
||||
[1m- expected:[0m datatype constructor name
|
||||
[1m- detected:[0m end of input
|
||||
[0m 1 | type Adt =[4m[31m [0m
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/missing_pat.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/compile_file/missing_pat.bend :
|
||||
[1mIn [4mtests/golden_tests/compile_file/missing_pat.bend[0m[1m :[0m
|
||||
[1m- expected:[0m name or '*'
|
||||
[1m- detected:[0m
|
||||
[0m 2 | [4m[31m:[0m *[0m
|
||||
|
@ -3,5 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/nested_ctr_wrong_arity.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mIn [4mtests/golden_tests/compile_file/nested_ctr_wrong_arity.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mfst_fst[0m[1m':[0m
|
||||
Incorrect arity for constructor 'Pair/Pair' of type 'Pair' in pattern matching rule. Expected 2 fields, found 1
|
||||
|
@ -3,6 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/number_too_large.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/compile_file/number_too_large.bend :
|
||||
[1mIn [4mtests/golden_tests/compile_file/number_too_large.bend[0m[1m :[0m
|
||||
[1mNumber literal outside of range for U24.[0m
|
||||
[0m 1 | main = [4m[31m0x10000000[0m
|
||||
|
@ -3,5 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/ref_to_main.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mDuring execution :[0m
|
||||
[1mIn definition '[4mFoo[0m[1m':[0m
|
||||
Main definition can't be referenced inside the program.
|
||||
|
@ -3,6 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/repeated_bind_rule.bend
|
||||
---
|
||||
[4m[1m[33mWarnings:[0m
|
||||
[1mIn [4mtests/golden_tests/compile_file/repeated_bind_rule.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mFoo[0m[1m':[0m
|
||||
Repeated bind in pattern matching rule: 'a'.
|
||||
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/switch_all_patterns.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/compile_file/switch_all_patterns.bend :
|
||||
[1mIn [4mtests/golden_tests/compile_file/switch_all_patterns.bend[0m[1m :[0m
|
||||
[1m- expected:[0m '0'
|
||||
[1m- detected:[0m
|
||||
[0m 7 | [4m[31m_[0m: x-1[0m
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/switch_incomplete.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/compile_file/switch_incomplete.bend :
|
||||
[1mIn [4mtests/golden_tests/compile_file/switch_incomplete.bend[0m[1m :[0m
|
||||
[1m- expected:[0m term
|
||||
[1m- detected:[0m
|
||||
[0m 2 | main = switch {[4m[31m}[0m
|
||||
|
@ -3,6 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/top_level_name_slashslash.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/compile_file/top_level_name_slashslash.bend :
|
||||
[1mIn [4mtests/golden_tests/compile_file/top_level_name_slashslash.bend[0m[1m :[0m
|
||||
Top-level names are not allowed to start with "//".
|
||||
[0m 4 | def [4m[31m//thisshouldfail[0m():[0m
|
||||
|
@ -3,5 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/unbound_unscoped_var.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mIn [4mtests/golden_tests/compile_file/unbound_unscoped_var.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mmain[0m[1m':[0m
|
||||
Unbound unscoped variable '$a'.
|
||||
|
@ -3,5 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/unbound_var.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mIn [4mtests/golden_tests/compile_file/unbound_var.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mmain[0m[1m':[0m
|
||||
Unbound variable 'a'.
|
||||
|
@ -3,5 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/unbound_var_scope.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mIn [4mtests/golden_tests/compile_file/unbound_var_scope.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mmain[0m[1m':[0m
|
||||
Unbound variable 'b'.
|
||||
|
@ -3,5 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/unbound_with_tup_pattern.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mIn [4mtests/golden_tests/compile_file/unbound_with_tup_pattern.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mFoo[0m[1m':[0m
|
||||
Unbound variable 'a'.
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/unexpected_top_char.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/compile_file/unexpected_top_char.bend :
|
||||
[1mIn [4mtests/golden_tests/compile_file/unexpected_top_char.bend[0m[1m :[0m
|
||||
[1m- expected:[0m top-level definition
|
||||
[1m- detected:[0m
|
||||
[0m 1 | [4m[31m*[0m
|
||||
|
@ -3,5 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/unscoped_dup_use.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mIn [4mtests/golden_tests/compile_file/unscoped_dup_use.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mmain[0m[1m':[0m
|
||||
Unscoped variable '$a' used more than once.
|
||||
|
@ -3,5 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/unused_unscoped_bind.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mIn [4mtests/golden_tests/compile_file/unused_unscoped_bind.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mmain[0m[1m':[0m
|
||||
Unscoped variable from lambda 'λ$a' is never used.
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/variable_name_double_underscore.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/compile_file/variable_name_double_underscore.bend :
|
||||
[1mIn [4mtests/golden_tests/compile_file/variable_name_double_underscore.bend[0m[1m :[0m
|
||||
[1m- expected:[0m expression
|
||||
[1m- detected:[0m
|
||||
[0m 2 | return __this_should_fail__[4m[31m([0m*)[0m
|
||||
|
@ -3,6 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/vicious_circles.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mDuring execution :[0m
|
||||
[1mIn compiled inet '[4mdisconnected_self_lam[0m[1m':[0m
|
||||
Found term that compiles into an inet with a vicious cycle
|
||||
[1mIn compiled inet '[4mdup_self[0m[1m':[0m
|
||||
|
@ -3,9 +3,11 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/warn_and_err.bend
|
||||
---
|
||||
[4m[1m[33mWarnings:[0m
|
||||
[1mIn [4mtests/golden_tests/compile_file/warn_and_err.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mFoo[0m[1m':[0m
|
||||
Repeated bind in pattern matching rule: 'a'.
|
||||
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mIn [4mtests/golden_tests/compile_file/warn_and_err.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mMain[0m[1m':[0m
|
||||
Unbound variable 'a'.
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/with_clause_parse_err.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/compile_file/with_clause_parse_err.bend :
|
||||
[1mIn [4mtests/golden_tests/compile_file/with_clause_parse_err.bend[0m[1m :[0m
|
||||
[1m- expected:[0m '{'
|
||||
[1m- detected:[0m
|
||||
[0m 1 | main = @a @b switch b [4m[31mw[0mitha{[0m
|
||||
|
@ -3,5 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/wrong_ctr_arity.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mIn [4mtests/golden_tests/compile_file/wrong_ctr_arity.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mBar[0m[1m':[0m
|
||||
Incorrect arity for constructor 'Boxed/Box' of type 'Boxed' in pattern matching rule. Expected 1 fields, found 2
|
||||
|
@ -3,5 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/wrong_ctr_var_arity.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mIn [4mtests/golden_tests/compile_file/wrong_ctr_var_arity.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mfoo[0m[1m':[0m
|
||||
Incorrect arity for constructor 'Tup/pair' of type 'Tup' in pattern matching rule. Expected 2 fields, found 0
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/wrong_nums.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/compile_file/wrong_nums.bend :
|
||||
[1mIn [4mtests/golden_tests/compile_file/wrong_nums.bend[0m[1m :[0m
|
||||
[1m- expected:[0m valid binary digit
|
||||
[1m- detected:[0m
|
||||
[0m 1 | main = (+ 0b01[4m[31m2[0m345 0FA)[0m
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/wrong_unicode_escape.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/compile_file/wrong_unicode_escape.bend :
|
||||
[1mIn [4mtests/golden_tests/compile_file/wrong_unicode_escape.bend[0m[1m :[0m
|
||||
[1m- expected:[0m '}'
|
||||
[1m- detected:[0m
|
||||
[0m 1 | main = (String.cons '\u{1[4m[31m'[0m "\u2}\u{zxcx}")[0m
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file_o_all/adt_string.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/compile_file_o_all/adt_string.bend :
|
||||
[1mIn [4mtests/golden_tests/compile_file_o_all/adt_string.bend[0m[1m :[0m
|
||||
Redefinition of builtin (type) 'String'.
|
||||
[0m 1 | [4m[31mtype String = S
|
||||
[0m 2 | [4m[31m
|
||||
|
@ -3,6 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file_o_all/bad_parens_making_erased_let.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mIn [4mtests/golden_tests/compile_file_o_all/bad_parens_making_erased_let.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mmain[0m[1m':[0m
|
||||
Unbound variable 'two'.
|
||||
Unbound variable 'qua'.
|
||||
|
@ -3,5 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file_o_all/cyclic_dup.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mIn [4mtests/golden_tests/compile_file_o_all/cyclic_dup.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mmain[0m[1m':[0m
|
||||
Unbound variable 'y1'.
|
||||
|
@ -3,4 +3,5 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file_o_all/double_main.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mDuring execution :[0m
|
||||
File has both 'main' and 'Main' definitions.
|
||||
|
@ -3,5 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file_o_all/match_adt_non_exhaustive.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mIn [4mtests/golden_tests/compile_file_o_all/match_adt_non_exhaustive.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mmain[0m[1m':[0m
|
||||
Non-exhaustive 'match' expression of type 'Maybe'. Case 'Maybe/Some' not covered.
|
||||
|
@ -3,5 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file_o_all/non_exhaustive_and.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mIn [4mtests/golden_tests/compile_file_o_all/non_exhaustive_and.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mBool.and[0m[1m':[0m
|
||||
Non-exhaustive pattern matching rule. Constructor 'Bool/F' of type 'Bool' not covered
|
||||
|
@ -3,5 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file_o_all/non_exhaustive_different_types.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mIn [4mtests/golden_tests/compile_file_o_all/non_exhaustive_different_types.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mfoo[0m[1m':[0m
|
||||
Non-exhaustive pattern matching rule. Constructor 'b3/t3' of type 'b3' not covered
|
||||
|
@ -3,5 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file_o_all/non_exhaustive_pattern.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mIn [4mtests/golden_tests/compile_file_o_all/non_exhaustive_pattern.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mFoo[0m[1m':[0m
|
||||
Non-exhaustive pattern matching rule. Constructor 'Type/A' of type 'Type' not covered
|
||||
|
@ -3,5 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file_o_all/non_exhaustive_tree.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mIn [4mtests/golden_tests/compile_file_o_all/non_exhaustive_tree.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mWarp[0m[1m':[0m
|
||||
Non-exhaustive pattern matching rule. Constructor 'Tree/Leaf' of type 'Tree' not covered
|
||||
|
@ -3,6 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file_o_all/repeated_name_trucation.bend
|
||||
---
|
||||
[4m[1m[33mWarnings:[0m
|
||||
[1mDuring execution :[0m
|
||||
[1mThe following functions contain recursive cycles incompatible with HVM's strict evaluation:[0m
|
||||
* long_name_that_truncates -> long_name_that_truncates
|
||||
|
||||
|
@ -3,6 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file_o_all/self_ref.bend
|
||||
---
|
||||
[4m[1m[33mWarnings:[0m
|
||||
[1mDuring execution :[0m
|
||||
[1mThe following functions contain recursive cycles incompatible with HVM's strict evaluation:[0m
|
||||
* Foo -> Foo
|
||||
|
||||
@ -32,5 +33,6 @@ To disable this check, use the "-Arecursion-cycle" compiler option.
|
||||
|
||||
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mDuring execution :[0m
|
||||
During inlining:
|
||||
infinite reference cycle in `@Foo`
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file_o_all/tagged_dup.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/compile_file_o_all/tagged_dup.bend :
|
||||
[1mIn [4mtests/golden_tests/compile_file_o_all/tagged_dup.bend[0m[1m :[0m
|
||||
[1m- expected:[0m '='
|
||||
[1m- detected:[0m
|
||||
[0m 4 | [4m[31ml[0met #i {e f} = @x x;[0m
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file_o_all/tagged_lam.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/compile_file_o_all/tagged_lam.bend :
|
||||
[1mIn [4mtests/golden_tests/compile_file_o_all/tagged_lam.bend[0m[1m :[0m
|
||||
[1m- expected:[0m term
|
||||
[1m- detected:[0m end of input
|
||||
[0m 2 | [4m[31m [0m
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file_o_all/tagged_sup.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/compile_file_o_all/tagged_sup.bend :
|
||||
[1mIn [4mtests/golden_tests/compile_file_o_all/tagged_sup.bend[0m[1m :[0m
|
||||
[1m- expected:[0m top-level definition
|
||||
[1m- detected:[0m
|
||||
[0m 2 | b [4m[31m=[0m #i {λx x λx x}[0m
|
||||
|
@ -3,6 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file_o_no_all/bitonic_sort.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mDuring execution :[0m
|
||||
[1mThe following functions contain recursive cycles incompatible with HVM's strict evaluation:[0m
|
||||
* Down -> Flow -> Down
|
||||
* Warp -> Warp
|
||||
|
@ -3,6 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file_o_no_all/list_reverse.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mDuring execution :[0m
|
||||
[1mThe following functions contain recursive cycles incompatible with HVM's strict evaluation:[0m
|
||||
* concat -> concat
|
||||
* reverse -> reverse
|
||||
|
@ -3,6 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file_o_no_all/sum_tree.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mDuring execution :[0m
|
||||
[1mThe following functions contain recursive cycles incompatible with HVM's strict evaluation:[0m
|
||||
* gen -> gen
|
||||
* sum -> sum
|
||||
|
@ -3,5 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_long/huge_tree.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mDuring execution :[0m
|
||||
[1mIn definition '[4mmain[0m[1m':[0m
|
||||
Definition is too large for HVM C (size=120002, max size=4095). Please break it into smaller pieces.
|
||||
|
@ -3,5 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_long/long_str_file.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mDuring execution :[0m
|
||||
[1mIn definition '[4mmain[0m[1m':[0m
|
||||
Definition is too large for HVM C (size=1461028, max size=4095). Please break it into smaller pieces.
|
||||
|
@ -3,5 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/desugar_file/non_exaustive_limit.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mIn [4mtests/golden_tests/desugar_file/non_exaustive_limit.bend[0m[1m :[0m
|
||||
[1mIn definition '[4mBar[0m[1m':[0m
|
||||
Non-exhaustive pattern matching rule. Constructor 'Foo/B' of type 'Foo' not covered
|
||||
|
@ -3,4 +3,5 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/import_system/import_main.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mDuring execution :[0m
|
||||
Can not import the entry point of the program.
|
||||
|
@ -3,4 +3,5 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/import_system/import_main2.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mDuring execution :[0m
|
||||
Can not import the entry point of the program.
|
||||
|
@ -3,4 +3,5 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/import_system/import_main3.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mDuring execution :[0m
|
||||
Can not import the entry point of the program.
|
||||
|
@ -3,4 +3,5 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/import_system/imports_alias_shadow.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mDuring execution :[0m
|
||||
The import 'lib/nums/two' shadows the imported name 'lib/nums/one'
|
||||
|
@ -3,5 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/import_system/imports_conflict.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mDuring execution :[0m
|
||||
The imported definition 'lib/a/b/C' conflicts with the definition 'lib/a/b/C'.
|
||||
The imported constructor 'lib/a/b/C' conflicts with the definition 'lib/a/b/C'.
|
||||
|
@ -3,4 +3,5 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/import_system/imports_file_and_dir_conflict.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mDuring execution :[0m
|
||||
Both file 'lib/file_and_dir.bend' and folder 'lib/file_and_dir' contains the import 'w'
|
||||
|
@ -3,4 +3,5 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/import_system/imports_shadow.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mDuring execution :[0m
|
||||
The import 'lib/myFun/myFun' shadows the imported name 'lib/folder/myFun/myFun'
|
||||
|
@ -3,4 +3,5 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/import_system/imports_shadow2.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mDuring execution :[0m
|
||||
The import 'lib/folder/myFun/myFun' shadows the imported name 'lib/myFun/myFun'
|
||||
|
@ -3,6 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/mutual_recursion/a_b_c.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mDuring execution :[0m
|
||||
[1mThe following functions contain recursive cycles incompatible with HVM's strict evaluation:[0m
|
||||
* A -> B -> C -> A
|
||||
|
||||
|
@ -3,6 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/mutual_recursion/merged.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mDuring execution :[0m
|
||||
[1mThe following functions contain recursive cycles incompatible with HVM's strict evaluation:[0m
|
||||
* Rec -> X -> Rec
|
||||
* Rec -> Y -> Rec
|
||||
|
@ -3,6 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/mutual_recursion/multiple.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mDuring execution :[0m
|
||||
[1mThe following functions contain recursive cycles incompatible with HVM's strict evaluation:[0m
|
||||
* A -> B -> C -> A
|
||||
* H -> I -> H
|
||||
|
@ -3,6 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/mutual_recursion/odd_even.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mDuring execution :[0m
|
||||
[1mThe following functions contain recursive cycles incompatible with HVM's strict evaluation:[0m
|
||||
* isEven -> isOdd -> isEven
|
||||
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/parse_file/bad_floating.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/parse_file/bad_floating.bend :
|
||||
[1mIn [4mtests/golden_tests/parse_file/bad_floating.bend[0m[1m :[0m
|
||||
[1m- expected:[0m newline
|
||||
[1m- detected:[0m
|
||||
[0m 2 | return 0xA.0[4m[31mx[0mA[0m
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/parse_file/bend_missing_else.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/parse_file/bend_missing_else.bend :
|
||||
[1mIn [4mtests/golden_tests/parse_file/bend_missing_else.bend[0m[1m :[0m
|
||||
[1m- expected:[0m 'else'
|
||||
[1m- detected:[0m
|
||||
[0m 14 | [4m[31md[0mef main():[0m
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/parse_file/fold_missing_case.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/parse_file/fold_missing_case.bend :
|
||||
[1mIn [4mtests/golden_tests/parse_file/fold_missing_case.bend[0m[1m :[0m
|
||||
[1m- expected:[0m 'case'
|
||||
[1m- detected:[0m end of input
|
||||
[0m 4 | [4m[31m [0m
|
||||
|
@ -3,6 +3,6 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/parse_file/fun_def_name.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/parse_file/fun_def_name.bend :
|
||||
[1mIn [4mtests/golden_tests/parse_file/fun_def_name.bend[0m[1m :[0m
|
||||
Expected a rule with name 'aux'.
|
||||
[0m 4 | [4m[31maux2 (List/Cons head tail) = (+ head (aux tail))[0m
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/parse_file/if_missing_else.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/parse_file/if_missing_else.bend :
|
||||
[1mIn [4mtests/golden_tests/parse_file/if_missing_else.bend[0m[1m :[0m
|
||||
[1m- expected:[0m 'else' or 'elif'
|
||||
[1m- detected:[0m end of input
|
||||
[0m 5 | [4m[31m [0m
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/parse_file/match_missing_case.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/parse_file/match_missing_case.bend :
|
||||
[1mIn [4mtests/golden_tests/parse_file/match_missing_case.bend[0m[1m :[0m
|
||||
[1m- expected:[0m 'case'
|
||||
[1m- detected:[0m end of input
|
||||
[0m 4 | [4m[31m [0m
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/parse_file/redefinition_builtin.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/parse_file/redefinition_builtin.bend :
|
||||
[1mIn [4mtests/golden_tests/parse_file/redefinition_builtin.bend[0m[1m :[0m
|
||||
Redefinition of builtin (function) 'Map/get'.
|
||||
[0m 1 | [4m[31mdef Map/get(m):
|
||||
[0m 2 | [4m[31m return m
|
||||
|
@ -3,7 +3,7 @@ source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/parse_file/redefinition_ctr_with_fun.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
In tests/golden_tests/parse_file/redefinition_ctr_with_fun.bend :
|
||||
[1mIn [4mtests/golden_tests/parse_file/redefinition_ctr_with_fun.bend[0m[1m :[0m
|
||||
Redefinition of builtin (constructor) 'String/Cons'.
|
||||
[0m 1 | [4m[31mdef String/Cons(x):
|
||||
[0m 2 | [4m[31m return x
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user