Conlang/stdlib/test.cl
John fe2b816f27 cl-typeck: Crate-spanning refactor part 2
- Removed all unreferenced files
- Reimplemented missing/nonfunctional behavior
- Added module documentation for most things
  - TODO: item-level docs on Entry(Mut)
- Reparented the stages of Table population into the `stage` module.
  - TODO: rewrite type inference to use only the tools provided by Table.
2024-07-25 05:55:11 -05:00

80 lines
1.3 KiB
Common Lisp

//! Tests for funky behavior
use super::preamble::*;
struct UnitLike;
struct TupleLike(super::num::i32, super::self::test::char)
struct StructLike {
pub member1: UnitLike,
member2: TupleLike,
}
enum NeverLike;
enum EmptyLike {
Empty,
}
enum Hodgepodge {
Empty,
UnitLike (),
Tuple (TupleLike),
StructEmpty {},
StructLike { member1: UnitLike, member2: TupleLike },
}
fn noop () -> bool {
loop if false {
} else break loop if false {
} else break loop if false {
} else break true;
}
fn while_else() -> i32 {
while conditional {
pass
} else {
fail
}
}
fn if_else() -> i32 {
// block 1
let x = 10;
let y = x + 2;
if x > 10
// compare x and 10
// end block 1, goto block 2 else goto block 3
{
// block 2
4
// end block 2, goto block 4
} else {
// block 3
5
// end block 3, goto block 4
}
// block 4
}
mod horrible_imports {
mod foo {
use super::{bar::*, baz::*};
struct Foo(&Foo, &Bar)
}
mod bar {
use super::{foo::*, baz::*};
struct Bar(&Foo, &Baz)
}
mod baz {
use super::{foo::*, bar::*};
struct Baz(&Foo, &Bar)
}
}