From 86b6d01242b01bf76127fe1f7fd2823b6e2e99e7 Mon Sep 17 00:00:00 2001 From: Phil Date: Tue, 6 Sep 2022 11:02:53 -0700 Subject: [PATCH 1/2] fix polymorphic proc parameters error handling --- src/check_type.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/check_type.cpp b/src/check_type.cpp index da0a9706b..66417f97e 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -1643,8 +1643,10 @@ Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_params, bool *is bool valid = false; if (is_type_proc(op.type)) { Entity *proc_entity = entity_from_expr(op.expr); - valid = proc_entity != nullptr; - poly_const = exact_value_procedure(proc_entity->identifier.load() ? proc_entity->identifier.load() : op.expr); + valid = (proc_entity != nullptr) && (op.value.kind == ExactValue_Procedure); + if (valid) { + poly_const = exact_value_procedure(proc_entity->identifier.load() ? proc_entity->identifier.load() : op.expr); + } } if (!valid) { if (op.mode == Addressing_Constant) { From 2239e43faf116d54bc9f8f3a14f8c390cfe81bf9 Mon Sep 17 00:00:00 2001 From: Ricardo Silva Date: Wed, 7 Sep 2022 08:56:23 +0100 Subject: [PATCH 2/2] Fix strings.*_justify --- core/strings/strings.odin | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/strings/strings.odin b/core/strings/strings.odin index 603917698..fcfc133f3 100644 --- a/core/strings/strings.odin +++ b/core/strings/strings.odin @@ -1686,7 +1686,7 @@ centre_justify :: proc(str: string, length: int, pad: string, allocator := conte return clone(str, allocator) } - remains := length-1 + remains := length-n pad_len := rune_count(pad) b: Builder @@ -1702,14 +1702,14 @@ centre_justify :: proc(str: string, length: int, pad: string, allocator := conte return to_string(b) } -// left_justify returns a string with a pad string at left side if the str's rune length is smaller than length +// left_justify returns a string with a pad string at right side if the str's rune length is smaller than length left_justify :: proc(str: string, length: int, pad: string, allocator := context.allocator) -> string { n := rune_count(str) if n >= length || pad == "" { return clone(str, allocator) } - remains := length-1 + remains := length-n pad_len := rune_count(pad) b: Builder @@ -1724,14 +1724,14 @@ left_justify :: proc(str: string, length: int, pad: string, allocator := context return to_string(b) } -// right_justify returns a string with a pad string at right side if the str's rune length is smaller than length +// right_justify returns a string with a pad string at left side if the str's rune length is smaller than length right_justify :: proc(str: string, length: int, pad: string, allocator := context.allocator) -> string { n := rune_count(str) if n >= length || pad == "" { return clone(str, allocator) } - remains := length-1 + remains := length-n pad_len := rune_count(pad) b: Builder