repo
stringlengths
6
65
file_url
stringlengths
81
311
file_path
stringlengths
6
227
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:31:58
2026-01-04 20:25:31
truncated
bool
2 classes
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/test-project-compiler/src/lib.rs
test-project-compiler/src/lib.rs
#[cfg(test)] mod generated_tests; use camino::Utf8PathBuf; use gleam_core::{ analyse::TargetSupport, build::{Codegen, Compile, Mode, NullTelemetry, Options, ProjectCompiler, Telemetry}, config::PackageConfig, io::{FileSystemReader, FileSystemWriter}, paths::ProjectPaths, warning::VectorWarningE...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/test-project-compiler/src/generated_tests.rs
test-project-compiler/src/generated_tests.rs
//! This file is generated by build.rs //! Do not edit it directly, instead add new test cases to ./cases use gleam_core::build::Mode; #[rustfmt::skip] #[test] fn with_dep_dev() { let output = crate::prepare("./cases/with_dep", Mode::Dev); insta::assert_snapshot!( "with_dep_dev", output, ...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/build.rs
compiler-core/build.rs
fn main() { // capnpc::CompilerCommand::new() // .file("schema.capnp") // .output_path("generated/") // .run() // .expect("compiling schema.capnp"); }
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/reference.rs
compiler-core/src/reference.rs
use std::collections::{HashMap, HashSet}; use crate::ast::{Publicity, SrcSpan}; use bimap::{BiMap, Overwritten}; use ecow::EcoString; use petgraph::{ Directed, Direction, stable_graph::{NodeIndex, StableGraph}, }; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum ReferenceKind { Qualified, Unquali...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/config.rs
compiler-core/src/config.rs
mod stale_package_remover; use crate::error::{FileIoAction, FileKind}; use crate::io::FileSystemReader; use crate::io::ordered_map; use crate::manifest::Manifest; use crate::requirement::Requirement; use crate::version::COMPILER_VERSION; use crate::{Error, Result}; use camino::{Utf8Path, Utf8PathBuf}; use ecow::EcoStri...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/exhaustiveness.rs
compiler-core/src/exhaustiveness.rs
//! An implementation of the algorithm described in: //! //! - How to compile pattern matching, Jules Jacobs. //! <https://julesjacobs.com/notes/patternmatching/patternmatching.pdf> //! //! - Efficient manipulation of binary data using pattern matching, //! Per Gustafsson and Konstantinos Sagonas. //! <https://us...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/ast.rs
compiler-core/src/ast.rs
mod constant; mod typed; mod untyped; #[cfg(test)] mod tests; pub mod visit; pub use self::typed::{InvalidExpression, TypedExpr}; pub use self::untyped::{FunctionLiteralKind, UntypedExpr}; pub use self::constant::{Constant, TypedConstant, UntypedConstant}; use crate::analyse::Inferred; use crate::ast::typed::pairwi...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/javascript.rs
compiler-core/src/javascript.rs
mod decision; mod expression; mod import; #[cfg(test)] mod tests; mod typescript; use std::collections::HashMap; use num_bigint::BigInt; use num_traits::ToPrimitive; use crate::build::Target; use crate::build::package_compiler::StdlibPackage; use crate::codegen::TypeScriptDeclarations; use crate::type_::{PRELUDE_MOD...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_.rs
compiler-core/src/type_.rs
pub(crate) mod environment; pub mod error; pub(crate) mod expression; pub(crate) mod fields; pub(crate) mod hydrator; pub(crate) mod pattern; pub(crate) mod pipe; pub(crate) mod prelude; pub mod pretty; pub mod printer; #[cfg(test)] pub mod tests; use camino::Utf8PathBuf; use ecow::EcoString; pub use environment::*; p...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/lib.rs
compiler-core/src/lib.rs
#![warn( clippy::all, clippy::dbg_macro, clippy::todo, clippy::mem_forget, // TODO: enable once the false positive bug is solved // clippy::use_self, clippy::filter_map_next, clippy::needless_continue, clippy::needless_borrow, clippy::match_wildcard_for_single_variants, clipp...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/line_numbers.rs
compiler-core/src/line_numbers.rs
use crate::ast::SrcSpan; use lsp_types::Position; use std::collections::HashMap; /// A struct which contains information about line numbers of a source file, /// and can convert between byte offsets that are used in the compiler and /// line-column pairs used in LSP. #[derive(Debug, Clone, serde::Serialize, serde::Des...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/version.rs
compiler-core/src/version.rs
/// The current version of the gleam compiler. If this does not match what is /// already in the build folder we will not reuse any cached artifacts and /// instead build from scratch pub const COMPILER_VERSION: &str = env!("CARGO_PKG_VERSION");
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/parse.rs
compiler-core/src/parse.rs
// Gleam Parser // // Terminology: // Expression Unit: // Essentially a thing that goes between operators. // Int, Bool, function call, "{" expression-sequence "}", case x {}, ..etc // // Expression: // One or more Expression Units separated by an operator // // Binding: // (let|let assert|use) na...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/dependency.rs
compiler-core/src/dependency.rs
use std::{cell::RefCell, cmp::Reverse, collections::HashMap, rc::Rc}; use crate::{Error, Result, manifest}; use ecow::EcoString; use hexpm::{ Dependency, Release, version::{Range, Version}, }; use pubgrub::{Dependencies, Map}; use thiserror::Error; pub type PackageVersions = HashMap<String, Version>; type P...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/call_graph.rs
compiler-core/src/call_graph.rs
//! Graphs that represent the relationships between entities in a Gleam module, //! such as module functions or constants. #[cfg(test)] mod into_dependency_order_tests; use crate::{ Result, ast::{ AssignName, AssignmentKind, BitArrayOption, BitArraySize, ClauseGuard, Constant, Pattern, SrcSpan...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/fix.rs
compiler-core/src/fix.rs
use crate::{ Error, Result, format::{Formatter, Intermediate}, warning::WarningEmitter, }; use camino::Utf8Path; use ecow::EcoString; pub fn parse_fix_and_format(src: &EcoString, path: &Utf8Path) -> Result<String> { // Parse let parsed = crate::parse::parse_module(path.to_owned(), src, &WarningEmit...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/io.rs
compiler-core/src/io.rs
pub mod memory; use crate::error::{Error, FileIoAction, FileKind, Result}; use async_trait::async_trait; use debug_ignore::DebugIgnore; use flate2::read::GzDecoder; use std::{ collections::{HashMap, HashSet, VecDeque}, fmt::Debug, io, iter::Extend, time::SystemTime, vec::IntoIter, }; use tar::{...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/uid.rs
compiler-core/src/uid.rs
use std::sync::{ Arc, atomic::{AtomicU64, Ordering}, }; /// A generator of unique ids. Only one should be used per compilation run to /// ensure ids do not get reused. #[derive(Debug, Clone, Default)] pub struct UniqueIdGenerator { id: Arc<AtomicU64>, } impl UniqueIdGenerator { pub fn new() -> Self { ...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/manifest.rs
compiler-core/src/manifest.rs
use std::collections::HashMap; use std::fmt; use crate::Result; use crate::io::{make_relative, ordered_map}; use crate::requirement::Requirement; use camino::{Utf8Path, Utf8PathBuf}; use ecow::EcoString; use hexpm::version::Version; use itertools::Itertools; #[derive(Debug, Clone, serde::Serialize, serde::Deserialize...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/warning.rs
compiler-core/src/warning.rs
use crate::{ ast::{BitArraySegmentTruncation, SrcSpan, TodoKind}, build::Target, diagnostic::{self, Diagnostic, ExtraLabel, Location}, error::wrap, exhaustiveness::ImpossibleBitArraySegmentPattern, type_::{ self, error::{ AssertImpossiblePattern, FeatureKind, LiteralC...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/analyse.rs
compiler-core/src/analyse.rs
mod imports; pub mod name; #[cfg(test)] mod tests; use crate::{ GLEAM_CORE_PACKAGE_NAME, ast::{ self, Arg, BitArrayOption, CustomType, DefinitionLocation, Function, GroupedDefinitions, Import, ModuleConstant, Publicity, RecordConstructor, RecordConstructorArg, SrcSpan, Statement, TypeA...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/package_interface.rs
compiler-core/src/package_interface.rs
use std::{collections::HashMap, ops::Deref}; use ecow::EcoString; use serde::Serialize; #[cfg(test)] mod tests; use crate::{ io::ordered_map, type_::{ self, Deprecation, Opaque, Type, TypeConstructor, TypeVar, TypeVariantConstructors, ValueConstructorVariant, expression::Implementations, ...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/encryption.rs
compiler-core/src/encryption.rs
use thiserror::Error; pub fn encrypt_with_passphrase( message: &[u8], passphrase: &str, ) -> Result<String, age::EncryptError> { let passphrase = age::secrecy::SecretString::from(passphrase); let recipient = age::scrypt::Recipient::new(passphrase.clone()); let encrypted = age::encrypt_and_armor(&r...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/inline.rs
compiler-core/src/inline.rs
//! This module implements the function inlining optimisation. This allows //! function calls to be inlined at the callsite, and replaced with the contents //! of the function which is being called. //! //! Function inlining is useful for two main reasons: //! - It removes the overhead of calling other functions and ju...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/hex.rs
compiler-core/src/hex.rs
use camino::Utf8Path; use debug_ignore::DebugIgnore; use flate2::read::GzDecoder; use futures::future; use hexpm::{ApiError, version::Version}; use tar::Archive; use crate::{ Error, Result, io::{FileSystemReader, FileSystemWriter, HttpClient, TarUnpacker}, manifest::{ManifestPackage, ManifestPackageSource}...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/paths.rs
compiler-core/src/paths.rs
use crate::build::{Mode, Target}; use camino::{Utf8Path, Utf8PathBuf}; pub const ARTEFACT_DIRECTORY_NAME: &str = "_gleam_artefacts"; #[derive(Debug, Clone)] pub struct ProjectPaths { root: Utf8PathBuf, } impl ProjectPaths { pub fn new(root: Utf8PathBuf) -> Self { Self { root } } pub fn at_f...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/error.rs
compiler-core/src/error.rs
#![allow(clippy::unwrap_used, clippy::expect_used)] use crate::bit_array::UnsupportedOption; use crate::build::{Origin, Outcome, Runtime, Target}; use crate::dependency::{PackageFetcher, ResolutionError}; use crate::diagnostic::{Diagnostic, ExtraLabel, Label, Location}; use crate::derivation_tree::DerivationTreePrinte...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/build.rs
compiler-core/src/build.rs
#![allow(warnings)] mod elixir_libraries; mod module_loader; mod native_file_copier; pub mod package_compiler; mod package_loader; mod project_compiler; mod telemetry; #[cfg(test)] mod tests; pub use self::package_compiler::PackageCompiler; pub use self::package_loader::StaleTracker; pub use self::project_compiler::...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/dep_tree.rs
compiler-core/src/dep_tree.rs
use ecow::EcoString; use petgraph::{Direction, algo::Cycle, graph::NodeIndex}; use std::collections::{HashMap, HashSet}; #[cfg(test)] use pretty_assertions::assert_eq; /// Take a sequence of values and their deps, and return the values in /// order so that deps come before the dependants. /// /// Any deps that are no...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/format.rs
compiler-core/src/format.rs
#[cfg(test)] mod tests; use crate::{ Error, Result, ast::{ CustomType, Import, ModuleConstant, TypeAlias, TypeAstConstructor, TypeAstFn, TypeAstHole, TypeAstTuple, TypeAstVar, *, }, build::Target, docvec, io::Utf8Writer, parse::extra::{Comment, ModuleExtra}, pretty::{sel...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/bit_array.rs
compiler-core/src/bit_array.rs
use ecow::EcoString; use num_bigint::BigInt; use crate::ast::{self, BitArrayOption, SrcSpan}; use crate::build::Target; use crate::type_::Type; use std::sync::Arc; // // Public Interface // pub fn type_options_for_value<TypedValue>( input_options: &[BitArrayOption<TypedValue>], target: Target, ) -> Result<A...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/codegen.rs
compiler-core/src/codegen.rs
use crate::{ Result, build::{ ErlangAppCodegenConfiguration, Module, module_erlang_name, package_compiler::StdlibPackage, }, config::PackageConfig, erlang, io::FileSystemWriter, javascript::{self, ModuleConfig}, line_numbers::LineNumbers, }; use ecow::EcoString; use erlang::escap...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/strings.rs
compiler-core/src/strings.rs
use ecow::EcoString; use itertools::Itertools; use crate::ast::Endianness; /// Converts any escape sequences from the given string to their correct /// bytewise UTF-8 representation and returns the resulting string. pub fn convert_string_escape_chars(str: &EcoString) -> EcoString { let mut filtered_str = EcoStrin...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/requirement.rs
compiler-core/src/requirement.rs
use std::fmt; use std::str::FromStr; use crate::Error; use crate::error::Result; use crate::io::make_relative; use camino::{Utf8Path, Utf8PathBuf}; use ecow::EcoString; use hexpm::version::Range; use serde::Deserialize; use serde::de::{self, Deserializer, MapAccess, Visitor}; use serde::ser::{Serialize, SerializeMap, ...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/docs.rs
compiler-core/src/docs.rs
mod printer; mod source_links; #[cfg(test)] mod tests; use std::{collections::HashMap, time::SystemTime}; use camino::Utf8PathBuf; use hexpm::version::Version; use printer::Printer; use crate::{ build::{Module, Package}, config::{DocsPage, PackageConfig}, docs::source_links::SourceLinker, io::{Conten...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/graph.rs
compiler-core/src/graph.rs
//! General functions for working with graphs. use petgraph::{Direction, prelude::NodeIndex, stable_graph::StableGraph}; /// Sort a graph into a sequence from the leaves to the roots. /// /// Nodes are returned in their smallest possible groups, which is either a leaf /// or a cycle. /// /// This function is implemen...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/erlang.rs
compiler-core/src/erlang.rs
// TODO: Refactor this module to be methods on structs rather than free // functions with a load of arguments. See the JavaScript code generator and the // formatter for examples. mod pattern; #[cfg(test)] mod tests; use crate::build::{Target, module_erlang_name}; use crate::erlang::pattern::{PatternPrinter, StringPa...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/derivation_tree.rs
compiler-core/src/derivation_tree.rs
use crate::error::wrap; use ecow::EcoString; use hexpm::version::Version; use im::HashSet; use itertools::Itertools; use petgraph::Direction; use petgraph::algo::all_simple_paths; use petgraph::graph::NodeIndex; use petgraph::prelude::StableGraph; use pubgrub::External; use pubgrub::{DerivationTree, Derived, Ranges}; u...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/metadata.rs
compiler-core/src/metadata.rs
//! Seriaisation and deserialisation of Gleam compiler metadata into binary files //! using the Cap'n Proto schema. mod module_decoder; mod module_encoder; #[cfg(test)] mod tests; pub use self::{module_decoder::ModuleDecoder, module_encoder::ModuleEncoder};
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/ast_folder.rs
compiler-core/src/ast_folder.rs
use ecow::EcoString; use itertools::Itertools; use num_bigint::BigInt; use vec1::Vec1; use crate::{ analyse::Inferred, ast::{ Assert, AssignName, Assignment, BinOp, BitArraySize, CallArg, Constant, Definition, FunctionLiteralKind, InvalidExpression, Pattern, RecordBeingUpdated, RecordUpdateArg,...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/pretty.rs
compiler-core/src/pretty.rs
//! This module implements the functionality described in //! ["Strictly Pretty" (2000) by Christian Lindig][0], with a few //! extensions. //! //! This module is heavily influenced by Elixir's Inspect.Algebra and //! JavaScript's Prettier. //! //! [0]: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.34.2200 //...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/diagnostic.rs
compiler-core/src/diagnostic.rs
use std::collections::HashMap; use camino::Utf8PathBuf; pub use codespan_reporting::diagnostic::{LabelStyle, Severity}; use codespan_reporting::{diagnostic::Label as CodespanLabel, files::SimpleFiles}; use ecow::EcoString; use termcolor::Buffer; use crate::ast::SrcSpan; #[derive(Debug, Clone, Copy, PartialEq, Eq)] ...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/exhaustiveness/printer.rs
compiler-core/src/exhaustiveness/printer.rs
use std::collections::HashMap; use ecow::EcoString; use crate::type_::printer::{NameContextInformation, Names}; use super::{Variable, missing_patterns::Term}; #[derive(Debug)] pub struct Printer<'a> { names: &'a Names, } impl<'a> Printer<'a> { pub fn new(names: &'a Names) -> Self { Printer { names ...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/exhaustiveness/missing_patterns.rs
compiler-core/src/exhaustiveness/missing_patterns.rs
use super::{CompileCaseResult, Decision, FallbackCheck, RuntimeCheck, Variable, printer::Printer}; use crate::type_::environment::Environment; use ecow::EcoString; use indexmap::IndexSet; use std::collections::HashMap; /// Returns a list of patterns not covered by the match expression. pub fn missing_patterns( res...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/parse/lexer.rs
compiler-core/src/parse/lexer.rs
use ecow::EcoString; use crate::ast::SrcSpan; use crate::parse::LiteralFloatValue; use crate::parse::error::{LexicalError, LexicalErrorType}; use crate::parse::token::Token; use std::char; use super::error::InvalidUnicodeEscapeError; #[derive(Debug)] pub struct Lexer<T: Iterator<Item = (u32, char)>> { chars: T, ...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/parse/tests.rs
compiler-core/src/parse/tests.rs
use crate::ast::SrcSpan; use crate::parse::error::{ InvalidUnicodeEscapeError, LexicalError, LexicalErrorType, ParseError, ParseErrorType, }; use crate::parse::lexer::make_tokenizer; use crate::parse::token::Token; use crate::warning::WarningEmitter; use camino::Utf8PathBuf; use ecow::EcoString; use itertools::Ite...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/parse/error.rs
compiler-core/src/parse/error.rs
use crate::ast::{SrcSpan, TypeAst}; use crate::diagnostic::{ExtraLabel, Label}; use crate::error::wrap; use crate::parse::Token; use ecow::EcoString; use itertools::Itertools; #[derive(Debug, PartialEq, Eq, Clone, Copy)] pub struct LexicalError { pub error: LexicalErrorType, pub location: SrcSpan, } #[derive(...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/parse/extra.rs
compiler-core/src/parse/extra.rs
use std::cmp::Ordering; use ecow::EcoString; use crate::ast::SrcSpan; #[derive(Debug, PartialEq, Eq, Default)] pub struct ModuleExtra { pub module_comments: Vec<SrcSpan>, pub doc_comments: Vec<SrcSpan>, pub comments: Vec<SrcSpan>, pub empty_lines: Vec<u32>, pub new_lines: Vec<u32>, pub traili...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/parse/token.rs
compiler-core/src/parse/token.rs
use num_bigint::BigInt; use std::fmt; use ecow::EcoString; use crate::parse::LiteralFloatValue; #[derive(Clone, Debug, PartialEq, Eq)] pub enum Token { Name { name: EcoString, }, UpName { name: EcoString, }, DiscardName { name: EcoString, }, Int { value: Ec...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/metadata/tests.rs
compiler-core/src/metadata/tests.rs
use hexpm::version::Version; use rand::Rng; use type_::{AccessorsMap, FieldMap, RecordAccessor}; use super::*; use crate::{ analyse::Inferred, ast::{ BitArrayOption, BitArraySegment, CallArg, Constant, Publicity, SrcSpan, TypedConstant, TypedConstantBitArraySegmentOption, }, build::Orig...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/metadata/module_decoder.rs
compiler-core/src/metadata/module_decoder.rs
#![allow(clippy::unnecessary_wraps)] // Needed for macro use capnp::{text, text_list}; use ecow::EcoString; use itertools::Itertools; use crate::{ Result, analyse::Inferred, ast::{ BitArrayOption, BitArraySegment, CallArg, Constant, Publicity, SrcSpan, TypedConstant, TypedConstantBitArrayS...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/metadata/module_encoder.rs
compiler-core/src/metadata/module_encoder.rs
use ecow::EcoString; use crate::{ ast::{ Constant, Publicity, SrcSpan, TypedConstant, TypedConstantBitArraySegment, TypedConstantBitArraySegmentOption, }, reference::{Reference, ReferenceKind, ReferenceMap}, schema_capnp::{self as schema, *}, type_::{ self, AccessorsMap, Dep...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/error/tests.rs
compiler-core/src/error/tests.rs
use super::*; use insta::assert_snapshot; #[test] fn test_shell_program_not_found_error() { let cmds = vec!["erlc", "rebar3", "deno", "elixir", "node", "bun", "git"]; let oses = vec!["macos", "linux"]; let distros = vec!["ubuntu", "other"]; for cmd in &cmds { for os in &oses { if o...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/pretty/tests.rs
compiler-core/src/pretty/tests.rs
use super::Document::*; use super::Mode::*; use super::*; use im::vector; use pretty_assertions::assert_eq; #[test] fn fits_test() { // Negative limits never fit assert!(!fits(-1, 0, vector![])); // If no more documents it always fits assert!(fits(0, 0, vector![])); // ForceBreak never fits ...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/build/package_compiler.rs
compiler-core/src/build/package_compiler.rs
use crate::analyse::{ModuleAnalyzerConstructor, TargetSupport}; use crate::build::package_loader::CacheFiles; use crate::inline; use crate::io::files_with_extension; use crate::line_numbers::{self, LineNumbers}; use crate::type_::PRELUDE_MODULE_NAME; use crate::{ Error, Result, Warning, ast::{SrcSpan, TypedModu...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/build/project_compiler.rs
compiler-core/src/build/project_compiler.rs
use crate::{ Error, Result, Warning, analyse::TargetSupport, build::{ Mode, Module, Origin, Package, Target, package_compiler::{self, PackageCompiler}, package_loader::StaleTracker, project_compiler, telemetry::Telemetry, }, codegen::{self, ErlangApp}, con...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/build/module_loader.rs
compiler-core/src/build/module_loader.rs
#[cfg(test)] mod tests; use std::{collections::HashSet, time::SystemTime}; use camino::{Utf8Path, Utf8PathBuf}; use ecow::EcoString; use serde::{Deserialize, Serialize}; use super::{ Mode, Origin, SourceFingerprint, Target, package_compiler::{CacheMetadata, CachedModule, Input, UncompiledModule}, packag...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/build/native_file_copier.rs
compiler-core/src/build/native_file_copier.rs
#[cfg(test)] mod tests; use std::collections::{HashMap, HashSet}; use camino::{Utf8Path, Utf8PathBuf}; use ecow::{EcoString, eco_format}; use crate::{ Error, Result, io::{DirWalker, FileSystemReader, FileSystemWriter}, paths::ProjectPaths, }; use super::package_compiler::CheckModuleConflicts; #[derive(...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/build/tests.rs
compiler-core/src/build/tests.rs
use crate::{Error, manifest::ManifestPackage}; use super::project_compiler::{BuildTool, usable_build_tools}; #[test] fn usable_build_tool_unknown() { assert_eq!( usable_build_tools(&ManifestPackage::default().with_build_tools(&["unknown"])), Err(Error::UnsupportedBuildTool { package: "...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/build/telemetry.rs
compiler-core/src/build/telemetry.rs
use std::{ fmt::Debug, time::{Duration, Instant}, }; use crate::{ Warning, manifest::{PackageChanges, Resolved}, }; pub trait Telemetry: Debug { fn waiting_for_build_directory_lock(&self); fn running(&self, name: &str); fn resolving_package_versions(&self); fn resolved_package_versions...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/build/package_loader.rs
compiler-core/src/build/package_loader.rs
#[cfg(test)] mod tests; use std::{ collections::{HashMap, HashSet}, time::{Duration, SystemTime}, }; use camino::{Utf8Path, Utf8PathBuf}; // TODO: emit warnings for cached modules even if they are not compiled again. use ecow::EcoString; use itertools::Itertools; use vec1::Vec1; use crate::{ Error, Res...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/build/elixir_libraries.rs
compiler-core/src/build/elixir_libraries.rs
use crate::{ Error, error::ShellCommandFailureReason, io::{Command, CommandExecutor, FileSystemReader, FileSystemWriter, Stdio}, }; use camino::Utf8PathBuf; #[cfg(not(target_os = "windows"))] const ELIXIR_EXECUTABLE: &str = "elixir"; #[cfg(target_os = "windows")] const ELIXIR_EXECUTABLE: &str = "elixir.bat...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/build/module_loader/tests.rs
compiler-core/src/build/module_loader/tests.rs
use super::*; use crate::{ build::SourceFingerprint, io::{FileSystemWriter, memory::InMemoryFileSystem}, line_numbers::LineNumbers, }; use std::time::Duration; #[test] fn no_cache_present() { let name = "package".into(); let artefact = Utf8Path::new("/artefact"); let fs = InMemoryFileSystem::ne...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/build/native_file_copier/tests.rs
compiler-core/src/build/native_file_copier/tests.rs
use super::NativeFileCopier; use crate::{ build::{native_file_copier::CopiedNativeFiles, package_compiler::CheckModuleConflicts}, io::{FileSystemWriter, memory::InMemoryFileSystem}, }; use std::{ collections::HashMap, sync::OnceLock, time::{Duration, SystemTime, UNIX_EPOCH}, }; use camino::{Utf8Pat...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/build/package_loader/tests.rs
compiler-core/src/build/package_loader/tests.rs
use ecow::{EcoString, eco_format}; use hexpm::version::Version; use super::*; use crate::{ Warning, build::SourceFingerprint, io::{FileSystemWriter, memory::InMemoryFileSystem}, line_numbers, parse::extra::ModuleExtra, warning::NullWarningEmitterIO, }; use std::time::Duration; #[derive(Debug)...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/call_graph/into_dependency_order_tests.rs
compiler-core/src/call_graph/into_dependency_order_tests.rs
use super::*; use crate::{ ast::{Arg, Function, ModuleConstant, Publicity}, type_::{ Deprecation, expression::{Implementations, Purity}, }, }; use ecow::EcoString; type FuncInput = (&'static str, &'static [&'static str], &'static str); type ConstInput = (&'static str, &'static str); fn par...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/docs/source_links.rs
compiler-core/src/docs/source_links.rs
use crate::{ ast::SrcSpan, build, config::{PackageConfig, Repository}, line_numbers::LineNumbers, paths::ProjectPaths, }; use camino::{Utf8Component, Utf8Path, Utf8PathBuf}; pub struct SourceLinker { line_numbers: LineNumbers, url_pattern: Option<(String, String)>, } impl SourceLinker { ...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/docs/tests.rs
compiler-core/src/docs/tests.rs
use std::{ collections::{HashMap, HashSet}, time::SystemTime, }; use super::{ Dependency, DependencyKind, DocumentationConfig, SearchData, SearchItem, SearchItemType, SearchProgrammingLanguage, printer::{PrintOptions, Printer}, source_links::SourceLinker, }; use crate::{ build::{ se...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/docs/printer.rs
compiler-core/src/docs/printer.rs
use std::{ collections::{HashMap, HashSet}, ops::Deref, }; use ecow::{EcoString, eco_format}; use itertools::Itertools; use crate::{ ast::{ ArgNames, CustomType, Function, Publicity, RecordConstructorArg, SrcSpan, TypeAlias, TypedArg, TypedDefinitions, TypedModuleConstant, TypedRecordConst...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/analyse/imports.rs
compiler-core/src/analyse/imports.rs
use ecow::EcoString; use crate::{ ast::{Publicity, SrcSpan, UnqualifiedImport, UntypedImport}, build::Origin, reference::{EntityKind, ReferenceKind}, type_::{ Environment, Error, ModuleInterface, Problems, ValueConstructorVariant, Warning, error::InvalidImportKind, }, }; use super:...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/analyse/tests.rs
compiler-core/src/analyse/tests.rs
use super::*; #[test] fn module_name_validation() { assert!(validate_module_name(&"dream".into()).is_ok()); assert!(validate_module_name(&"gleam".into()).is_err()); assert!(validate_module_name(&"gleam/ok".into()).is_ok()); assert!(validate_module_name(&"ok/gleam".into()).is_ok()); assert!(vali...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/analyse/name.rs
compiler-core/src/analyse/name.rs
use std::sync::OnceLock; use ecow::{EcoString, eco_format}; use regex::Regex; use crate::{ ast::{ArgNames, SrcSpan}, strings::{to_snake_case, to_upper_camel_case}, type_::Problems, }; use super::{Error, Named}; static VALID_NAME_PATTERN: OnceLock<Regex> = OnceLock::new(); fn valid_name(name: &EcoString...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/prelude.rs
compiler-core/src/type_/prelude.rs
use hexpm::version::Version; use strum::{EnumIter, IntoEnumIterator}; use crate::{ ast::{Publicity, SrcSpan}, build::Origin, line_numbers::LineNumbers, uid::UniqueIdGenerator, }; use super::{ ModuleInterface, Opaque, References, Type, TypeConstructor, TypeValueConstructor, TypeValueConstructor...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/environment.rs
compiler-core/src/type_/environment.rs
use pubgrub::Range; use crate::{ analyse::TargetSupport, ast::{PIPE_VARIABLE, Publicity}, build::Target, error::edit_distance, reference::{EntityKind, ReferenceTracker}, uid::UniqueIdGenerator, }; use super::*; use std::collections::HashMap; #[derive(Debug)] pub struct EnvironmentArguments<'a...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/tests.rs
compiler-core/src/type_/tests.rs
use super::*; use crate::{ analyse::TargetSupport, ast::{TypedModule, TypedStatement, UntypedExpr, UntypedModule}, build::{Origin, Outcome, Target}, config::{GleamVersion, PackageConfig}, error::Error, type_::{build_prelude, expression::FunctionDefinition, pretty::Printer}, uid::UniqueIdGene...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/pattern.rs
compiler-core/src/type_/pattern.rs
use ecow::eco_format; use hexpm::version::{LowestVersion, Version}; use im::hashmap; use itertools::Itertools; use num_bigint::BigInt; /// Type inference and checking of patterns used in case expressions /// and variables bindings. /// use super::*; use crate::{ analyse::{self, Inferred, name::check_name_case}, ...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/fields.rs
compiler-core/src/type_/fields.rs
use super::Error; use crate::{ ast::{CallArg, SrcSpan}, type_::error::IncorrectArityContext, }; use ecow::EcoString; use itertools::Itertools; use std::collections::{HashMap, HashSet}; #[derive(Debug, Clone, PartialEq, Eq)] pub struct FieldMap { /// Number of accepted arguments, including unlabelled fields...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/error.rs
compiler-core/src/type_/error.rs
use super::{ FieldAccessUsage, expression::{ArgumentKind, CallKind}, }; use crate::{ ast::{BinOp, BitArraySegmentTruncation, Layer, SrcSpan, TodoKind}, build::Target, exhaustiveness::ImpossibleBitArraySegmentPattern, parse::LiteralFloatValue, type_::{Type, expression::ComparisonOutcome}, }; ...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/printer.rs
compiler-core/src/type_/printer.rs
use bimap::BiMap; use ecow::{EcoString, eco_format}; use im::HashMap; use std::{collections::HashSet, sync::Arc}; use crate::{ ast::SrcSpan, type_::{Type, TypeAliasConstructor, TypeVar}, }; /// This class keeps track of what names are used for modules in the current /// scope, so they can be printed in errors...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/expression.rs
compiler-core/src/type_/expression.rs
use super::{pipe::PipeTyper, *}; use crate::{ STDLIB_PACKAGE_NAME, analyse::{Inferred, infer_bit_array_option, name::check_argument_names}, ast::{ Arg, Assert, Assignment, AssignmentKind, BinOp, BitArrayOption, BitArraySegment, CAPTURE_VARIABLE, CallArg, Clause, ClauseGuard, Constant, Functi...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/pipe.rs
compiler-core/src/type_/pipe.rs
use self::expression::CallKind; use super::*; use crate::ast::{ FunctionLiteralKind, ImplicitCallArgOrigin, PIPE_VARIABLE, PipelineAssignmentKind, Statement, TypedPipelineAssignment, UntypedExpr, }; use vec1::Vec1; #[derive(Debug)] pub(crate) struct PipeTyper<'a, 'b, 'c> { size: usize, argument_type: ...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/hydrator.rs
compiler-core/src/type_/hydrator.rs
use super::*; use crate::{ analyse::name::check_name_case, ast::{Layer, TypeAst, TypeAstConstructor, TypeAstFn, TypeAstHole, TypeAstTuple, TypeAstVar}, reference::ReferenceKind, }; use std::sync::Arc; use im::hashmap; /// The Hydrator takes an AST representing a type (i.e. a type annotation /// for a func...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/pretty.rs
compiler-core/src/type_/pretty.rs
use super::{Type, TypeVar}; use crate::{ docvec, pretty::{nil, *}, }; use ecow::EcoString; use std::sync::Arc; #[cfg(test)] use super::*; #[cfg(test)] use std::cell::RefCell; #[cfg(test)] use pretty_assertions::assert_eq; const INDENT: isize = 2; #[derive(Debug, Default)] pub struct Printer { names: im:...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/tests/accessors.rs
compiler-core/src/type_/tests/accessors.rs
use crate::assert_module_infer; #[test] fn bug_3629() { assert_module_infer!( ("imported", "pub type Wibble"), r#" import imported pub type Exp { One(field: imported.Wibble) Two(field: imported.Wibble) } pub fn main() { let exp = One(todo) exp.field } "#, vec![ ...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/tests/errors.rs
compiler-core/src/type_/tests/errors.rs
use crate::{ assert_error, assert_internal_module_error, assert_js_module_error, assert_module_error, assert_module_syntax_error, }; #[test] fn bit_array_invalid_type() { assert_module_error!( "fn x() { \"test\" } fn main() { let a = <<1:size(x())>> a }" ); } #[test] fn bit_arrays2() ...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
true
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/tests/exhaustiveness.rs
compiler-core/src/type_/tests/exhaustiveness.rs
use crate::{assert_error, assert_module_error, assert_no_warnings, assert_warning}; #[test] fn whatever() { assert_no_warnings!( " pub fn main(x) { case x { _ -> 0 } } " ); } #[test] fn nil() { assert_no_warnings!( " pub fn main(x) { case x { Nil -> 0 } } " ); } #[test...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/tests/assert.rs
compiler-core/src/type_/tests/assert.rs
use crate::{assert_error, assert_infer, assert_module_infer, assert_warning}; #[test] fn bool_value() { assert_infer!( " let value = True assert value ", "Nil" ); } #[test] fn equality_check() { assert_infer!( " let value = 10 assert value == 10 ", "Nil" ); } #[test] f...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/tests/use_.rs
compiler-core/src/type_/tests/use_.rs
use crate::{assert_error, assert_infer, assert_module_error, assert_module_infer, assert_warning}; #[test] fn arity_1() { assert_module_infer!( r#" pub fn main() { use <- pair() 123 } fn pair(f) { let x = f() #(x, x) } "#, vec![("main", "fn() -> #(Int, Int)")], ) } #[test] fn arity_2(...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/tests/imports.rs
compiler-core/src/type_/tests/imports.rs
use crate::{assert_module_error, assert_module_infer}; // https://github.com/gleam-lang/gleam/issues/1760 #[test] fn import_value_with_same_name_as_imported_module() { assert_module_infer!( ("other", "pub const other = 1"), " import other.{other} pub const a = other ", vec![("a", "Int")], ...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/tests/dead_code_detection.rs
compiler-core/src/type_/tests/dead_code_detection.rs
use crate::{assert_no_warnings, assert_warning}; #[test] fn unused_recursive_function() { assert_warning!( " fn unused(value: Int) -> Int { case value { 0 -> 0 _ -> unused(value - 1) } } " ); } #[test] fn unused_mutually_recursive_functions() { assert_warning!( " fn wibble(valu...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/tests/guards.rs
compiler-core/src/type_/tests/guards.rs
use crate::{assert_module_error, assert_module_infer}; #[test] fn nested_record_access() { assert_module_infer!( r#" pub type A { A(b: B) } pub type B { B(c: C) } pub type C { C(d: Bool) } pub fn a(a: A) { case a { _ if a.b.c.d -> 1 _ -> 0 } } "#, vec![ ("A", "fn(B)...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/tests/let_assert.rs
compiler-core/src/type_/tests/let_assert.rs
use crate::{assert_error, assert_infer}; #[test] fn empty_list() { assert_infer!("let assert [] = [] 1", "Int"); } #[test] fn list_one() { assert_infer!("let assert [a] = [1] a", "Int"); } #[test] fn list_two() { assert_infer!("let assert [a, 2] = [1] a", "Int"); } #[test] fn list_spread() { assert_...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/tests/externals.rs
compiler-core/src/type_/tests/externals.rs
use crate::{ assert_js_module_error, assert_js_module_infer, assert_module_error, assert_module_infer, }; // https://github.com/gleam-lang/gleam/issues/2324 #[test] fn javascript_only_function_used_by_erlang_module() { let module = r#"@external(javascript, "one", "two") fn js_only() -> Int pub fn main() { j...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/tests/assignments.rs
compiler-core/src/type_/tests/assignments.rs
use crate::assert_infer; #[test] fn let_() { assert_infer!("let x = 1 2", "Int"); } #[test] fn let_1() { assert_infer!("let x = 1 x", "Int"); } #[test] fn let_2() { assert_infer!("let x = 2.0 x", "Float"); } #[test] fn let_3() { assert_infer!("let x = 2 let y = x y", "Int"); } #[test] fn let_4() { ...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/tests/functions.rs
compiler-core/src/type_/tests/functions.rs
use crate::{assert_module_error, assert_module_infer}; // https://github.com/gleam-lang/gleam/issues/1860 #[test] fn unlabelled_after_labelled() { assert_module_error!( "fn main(wibble wibber, wobber) { Nil }" ); } // https://github.com/gleam-lang/gleam/issues/1860 #[test] fn unlabelled_after_labell...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/tests/echo.rs
compiler-core/src/type_/tests/echo.rs
use crate::assert_module_infer; #[test] pub fn echo_has_same_type_as_printed_expression() { assert_module_infer!( r#" pub fn main() { echo 1 } "#, vec![("main", "fn() -> Int")] ); } #[test] pub fn echo_has_same_type_as_printed_expression_2() { assert_module_infer!( r#" pub fn mai...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/tests/pipes.rs
compiler-core/src/type_/tests/pipes.rs
use crate::{assert_module_error, assert_module_infer, assert_no_warnings}; // https://github.com/gleam-lang/gleam/issues/2392 #[test] fn empty_list() { assert_module_infer!( " pub fn a() { fn(_) { Nil } } pub fn b(_) { fn(_) { Nil } } pub fn c() { Nil |> b( Nil |> a(), ) }", vec...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/tests/conditional_compilation.rs
compiler-core/src/type_/tests/conditional_compilation.rs
use crate::assert_module_infer; #[test] fn excluded_error() { assert_module_infer!( "@target(javascript) pub type X = Y pub const x = 1 ", vec![("x", "Int")], ); } #[test] fn alias() { assert_module_infer!( "@target(erlang) pub type X = Int pub const x: X = 1 ", vec![("x"...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/tests/version_inference.rs
compiler-core/src/type_/tests/version_inference.rs
use hexpm::version::Version; use super::compile_module; fn infer_version(module: &str) -> Version { compile_module("test_module", module, None, vec![]) .expect("module to compile") .type_info .minimum_required_version } #[test] fn internal_annotation_on_constant_requires_v1_1() { let ...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false
gleam-lang/gleam
https://github.com/gleam-lang/gleam/blob/f424547f02e621f1c5f28749786e05eda7feb098/compiler-core/src/type_/tests/custom_types.rs
compiler-core/src/type_/tests/custom_types.rs
use crate::{assert_module_error, assert_module_infer, assert_warning}; // https://github.com/gleam-lang/gleam/issues/2215 #[test] fn generic_phantom() { assert_module_infer!( r#" pub type Test(a) { MakeTest(field: Test(Int)) } "#, vec![("MakeTest", "fn(Test(Int)) -> Test(a)")] ); } #[test] f...
rust
Apache-2.0
f424547f02e621f1c5f28749786e05eda7feb098
2026-01-04T15:40:22.554517Z
false