Changeset - c79f28079eb9
[Not reviewed]
MH - 4 years ago 2021-07-27 13:37:59
contact@maxhenger.nl
make all tests work again
3 files changed with 13 insertions and 10 deletions:
0 comments (0 inline, 0 general)
src/protocol/parser/pass_typing.rs
Show inline comments
 
@@ -3525,25 +3525,28 @@ impl PassTyping {
 
        InferenceType::new(has_markers, !has_inferred, infer_type)
 
    }
 

	
 
    /// Determines the inference type from an already concrete type. Applies the
 
    /// various type "hacks" inside the type inferencer.
 
    fn determine_inference_type_from_concrete_type(parser_type: &mut Vec<InferenceTypePart>, concrete_type: &[ConcreteTypePart]) {
 
        use InferenceTypePart as ITP;
 
        use ConcreteTypePart as CTP;
 

	
 
        for concrete_part in concrete_type {
 
            match concrete_part {
 
                CTP::Void => parser_type.push(ITP::Void),
 
                CTP::Message => parser_type.push(ITP::Message),
 
                CTP::Message => {
 
                    parser_type.push(ITP::Message);
 
                    parser_type.push(ITP::UInt8)
 
                },
 
                CTP::Bool => parser_type.push(ITP::Bool),
 
                CTP::UInt8 => parser_type.push(ITP::UInt8),
 
                CTP::UInt16 => parser_type.push(ITP::UInt16),
 
                CTP::UInt32 => parser_type.push(ITP::UInt32),
 
                CTP::UInt64 => parser_type.push(ITP::UInt64),
 
                CTP::SInt8 => parser_type.push(ITP::SInt8),
 
                CTP::SInt16 => parser_type.push(ITP::SInt16),
 
                CTP::SInt32 => parser_type.push(ITP::SInt32),
 
                CTP::SInt64 => parser_type.push(ITP::SInt64),
 
                CTP::Character => parser_type.push(ITP::Character),
 
                CTP::String => {
 
                    parser_type.push(ITP::String);
src/protocol/parser/type_table.rs
Show inline comments
 
@@ -918,25 +918,25 @@ impl TypeTable {
 
                arguments,
 
                monomorphs: Vec::new(),
 
            }),
 
            poly_vars,
 
            is_polymorph
 
        });
 

	
 
        return Ok(());
 
    }
 

	
 
    /// Builds base component type.
 
    fn build_base_component_definition(&mut self, modules: &[Module], ctx: &mut PassCtx, definition_id: DefinitionId) -> Result<(), ParseError> {
 
        debug_assert!(self.lookup.contains_key(&definition_id), "base component already built");
 
        debug_assert!(!self.lookup.contains_key(&definition_id), "base component already built");
 

	
 
        let definition = &ctx.heap[definition_id].as_component();
 
        let root_id = definition.defined_in;
 

	
 
        // Check the argument types
 
        let mut arguments = Vec::with_capacity(definition.parameters.len());
 
        for parameter_id in &definition.parameters {
 
            let parameter = &ctx.heap[*parameter_id];
 
            Self::check_member_parser_type(
 
                modules, ctx, root_id, &parameter.parser_type, false
 
            )?;
 

	
src/protocol/tests/eval_silly.rs
Show inline comments
 
@@ -126,32 +126,32 @@ fn test_slicing_magic() {
 
                result_u16[0] + result_u16[1] == 6 &&
 
                result_u32[0] + result_u32[1] == 6 &&
 
                result_u64[0] + result_u64[1] == 6 &&
 
                result_s08[0] + result_s08[1] == 6 &&
 
                result_s16[0] + result_s16[1] == 6 &&
 
                result_s32[0] + result_s32[1] == 6 &&
 
                result_s64[0] + result_s64[1] == 6;
 
        }
 
    ").for_function("foo", |f| {
 
        f.call_ok(Some(Value::Bool(true)));
 
    }).for_struct("Holder", |s| { s
 
        .assert_num_monomorphs(8)
 
        .assert_has_monomorph("u8")
 
        .assert_has_monomorph("u16")
 
        .assert_has_monomorph("u32")
 
        .assert_has_monomorph("u64")
 
        .assert_has_monomorph("s8")
 
        .assert_has_monomorph("s16")
 
        .assert_has_monomorph("s32")
 
        .assert_has_monomorph("s64");
 
        .assert_has_monomorph("Holder<u8>")
 
        .assert_has_monomorph("Holder<u16>")
 
        .assert_has_monomorph("Holder<u32>")
 
        .assert_has_monomorph("Holder<u64>")
 
        .assert_has_monomorph("Holder<s8>")
 
        .assert_has_monomorph("Holder<s16>")
 
        .assert_has_monomorph("Holder<s32>")
 
        .assert_has_monomorph("Holder<s64>");
 
    });
 
}
 

	
 
#[test]
 
fn test_struct_fields() {
 
    Tester::new_single_source_expect_ok("struct field access", "
 
        struct Nester<T> {
 
            T v,
 
        }
 

	
 
        func make<T>(T inner) -> Nester<T> {
 
            return Nester{ v: inner };
0 comments (0 inline, 0 general)