Compare commits

...

11 Commits

Author SHA1 Message Date
c66d860542 Try generating types.
All checks were successful
Matrix / Format (pull_request) Successful in 2s
Matrix / Test - beta (pull_request) Successful in 4s
Matrix / Clippy check (pull_request) Successful in 11s
Matrix / Build - beta (pull_request) Successful in 17s
Matrix / Build - stable (pull_request) Successful in 17s
Matrix / Build - nightly (pull_request) Successful in 18s
Matrix / Test - nightly (pull_request) Successful in 18s
Matrix / Test - stable (pull_request) Successful in 17s
2025-11-26 15:55:47 -08:00
cfeffb7f24 Formatting.
Some checks failed
Matrix / Format (pull_request) Successful in 3s
Matrix / Clippy check (pull_request) Failing after 8s
Matrix / Build - nightly (pull_request) Successful in 7s
Matrix / Build - stable (pull_request) Successful in 7s
Matrix / Test - beta (pull_request) Successful in 7s
Matrix / Test - nightly (pull_request) Successful in 8s
Matrix / Test - stable (pull_request) Successful in 8s
Matrix / Build - beta (pull_request) Successful in 18s
2025-11-26 15:31:41 -08:00
01d8ff3123 Foo4
Some checks failed
Matrix / Clippy check (pull_request) Failing after 6s
Matrix / Build - beta (pull_request) Successful in 6s
Matrix / Test - stable (pull_request) Successful in 5s
Matrix / Format (pull_request) Failing after 13s
Matrix / Test - nightly (pull_request) Successful in 15s
Matrix / Test - beta (pull_request) Successful in 15s
Matrix / Build - nightly (pull_request) Successful in 15s
Matrix / Build - stable (pull_request) Successful in 18s
2025-11-26 15:30:38 -08:00
3b24fd1d05 Foo3
Some checks failed
Matrix / Format (pull_request) Has been cancelled
Matrix / Clippy check (pull_request) Has been cancelled
Matrix / Build - beta (pull_request) Has been cancelled
Matrix / Build - nightly (pull_request) Has been cancelled
Matrix / Build - stable (pull_request) Has been cancelled
Matrix / Test - beta (pull_request) Has been cancelled
Matrix / Test - nightly (pull_request) Has been cancelled
Matrix / Test - stable (pull_request) Has been cancelled
2025-11-26 15:28:45 -08:00
dd402d13c7 Foo2
Some checks failed
Matrix / strategy (pull_request) Failing after 0s
Matrix / ${{matrix.rust}} (pull_request) Failing after 1s
2025-11-26 15:24:26 -08:00
0ea2fa03f5 Foo 2025-11-26 15:20:45 -08:00
3fd0ef52b9 Play with strategies and such. 2025-11-26 15:18:46 -08:00
d597cacb2d up the versions
Some checks failed
Matrix / nightly (push) Failing after 8s
Matrix / beta (push) Failing after 9s
Matrix / stable (push) Failing after 16s
Matrix / nightly (pull_request) Failing after 0s
Matrix / beta (pull_request) Failing after 21s
Matrix / stable (pull_request) Failing after 5s
2025-11-24 19:26:38 -08:00
dfb88f0dd7 path found
Some checks failed
Matrix / nightly (push) Failing after 10s
Matrix / stable (push) Failing after 10s
Matrix / beta (push) Failing after 13s
Matrix / beta (pull_request) Failing after 9s
Matrix / nightly (pull_request) Failing after 9s
Matrix / stable (pull_request) Failing after 9s
2025-11-24 19:22:21 -08:00
e6422d22e0 Yay CI fails.
Some checks failed
Matrix / stable (push) Failing after 1s
Matrix / beta (pull_request) Failing after 0s
Matrix / nightly (pull_request) Failing after 0s
Matrix / nightly (push) Failing after 6s
Matrix / stable (pull_request) Failing after 1s
Matrix / beta (push) Failing after 1s
2025-11-24 19:04:09 -08:00
60c0dcf35f Yay CI fails.
Some checks failed
Matrix / beta (push) Failing after 1s
Matrix / nightly (push) Failing after 1s
Matrix / stable (push) Failing after 1s
Matrix / beta (pull_request) Failing after 1s
Matrix / nightly (pull_request) Failing after 1s
Matrix / stable (pull_request) Failing after 1s
2025-11-24 18:58:11 -08:00
2 changed files with 85 additions and 34 deletions

View File

@@ -1,26 +1,64 @@
name: Matrix
on:
- pull_request
- push
push:
branches:
- main
pull_request:
jobs:
main:
format:
name: Format
runs-on: native
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- run: cargo fmt --all -- --check
clippy:
name: Clippy check
runs-on: native
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- run: cargo clippy --all-targets -- -D warnings
build:
strategy:
matrix:
rust:
- stable
- beta
- nightly
name: ${{matrix.rust}}
runs-on: x86_64-linux
name: Build - ${{matrix.rust}}
runs-on: native
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.rust}}
components: rustfmt, clippy
- run: rustup --version
- run: rustc -vV
- run: cargo build
test:
strategy:
matrix:
rust:
- stable
- beta
- nightly
name: Test - ${{matrix.rust}}
runs-on: native
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.rust}}
components: rustfmt, clippy
- run: cargo build
- run: cargo clippy -- --deny clippy::pedantic
- run: cargo fmt --all -- --check
- run: cargo test

View File

@@ -1,12 +1,9 @@
use std::fmt::Arguments;
use crate::syntax::ast::{ConstantValue, IntegerWithBase, Type};
use crate::syntax::location::Location;
use crate::syntax::name::Name;
use itertools::Itertools;
use proptest::arbitrary::Arbitrary;
use proptest::prelude::{BoxedStrategy, Rng};
use proptest::prop_oneof;
use proptest::strategy::{NewTree, Strategy, ValueTree};
use proptest::test_runner::TestRunner;
@@ -24,24 +21,18 @@ pub struct TypeGenerationContext {
}
impl TypeGenerationContext {
fn generate_type(&mut self, runner: &mut TestRunner, depth: usize) -> Type {
fn generate_type(&self, runner: &mut TestRunner, depth: usize) -> Type {
let mut leaf_options = vec![];
if !self.available_constructors.is_empty() {
for name in self.available_constructors.iter() {
leaf_options.push(Type::Constructor(
Location::manufactured(),
name.clone(),
));
leaf_options.push(Type::Constructor(Location::manufactured(), name.clone()));
}
}
if !self.available_variables.is_empty() {
for name in self.available_variables.iter() {
leaf_options.push(Type::Variable(
Location::manufactured(),
name.clone(),
));
leaf_options.push(Type::Variable(Location::manufactured(), name.clone()));
}
}
@@ -52,13 +43,33 @@ impl TypeGenerationContext {
));
}
let mut possibilities = leaf_options.len();
if depth < MAXIMUM_TYPE_DEPTH && runner.rng().random_bool(0.5) {
possibilities += 2;
}
let index = runner.rng().random_range(0..leaf_options.len());
let index = runner.rng().random_range(0..possibilities);
if index >= leaf_options.len() {
let argument_count = runner.rng().random_range(0..MAXIMUM_TYPE_WIDTH);
let final_type = self.generate_type(runner, depth + 1);
let mut args = vec![];
for _ in 0..argument_count {
args.push(self.generate_type(runner, depth + 1));
}
if index - leaf_options.len() == 0 {
Type::Function(args, Box::new(final_type))
} else {
Type::Application(Box::new(final_type), args)
}
} else {
leaf_options.remove(index)
}
}
}
#[derive(Clone)]
pub struct TypeGenerationTree {
@@ -79,10 +90,6 @@ impl TypeGenerationTree {
}
}
fn generate_powerset(_: &[Type]) -> Vec<Vec<Type>> {
vec![]
}
fn simplify_type(incoming: &Type) -> Vec<Type> {
match incoming {
Type::Primitive(_, _) => vec![],
@@ -282,8 +289,14 @@ impl Strategy for TypeGenerationContext {
type Tree = TypeGenerationTree;
type Value = Type;
fn new_tree(&self, _runner: &mut TestRunner) -> NewTree<Self> {
unimplemented!()
fn new_tree(&self, runner: &mut TestRunner) -> NewTree<Self> {
let initial_type = self.generate_type(runner, 0);
Ok(TypeGenerationTree {
current_value: initial_type,
parent: None,
untried_simplified_items: None,
})
}
}