Skip to content

Extending exn-info fails C compilation if the module is explicitly named #711

@timbertson

Description

@timbertson

It seems unlikely I've captured the real reason, because I've seen other modules successfully extend exn-info. But I've seen this error a number of times, and this is the simplest way to reproduce that I found.

// extend-test.kk
// module extend-test
extend type exception-info
  ExtraInfo(s: string)

fun main() { () }

That compiles and runs, but if I uncomment the module extend-test line, it fails with:

check   : extend-test
.koka/v3.1.3/clang-debug-23345a/extend_dash_test.c:3:35: error: static declaration of 'kk_extend_dash_test__tag_ExtraInfo' follows non-static declaration
kk_declare_string_literal(static, kk_extend_dash_test__tag_ExtraInfo, 21, "extend-test/ExtraInfo")
                                  ^
.koka/v3.1.3/clang-debug-23345a/extend_dash_test.h:38:20: note: previous declaration is here
extern kk_string_t kk_extend_dash_test__tag_ExtraInfo;
                   ^
1 error generated.
extend-test(1, 1): build error: user error (error  : command failed (exit code 1)
command: /usr/bin/clang -Wall -Wextra -Wpointer-arith -Wshadow -Wstrict-aliasing -Wno-unknown-pragmas -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-variable -Wno-unused-value -Wno-unused-but-set-variable -Wno-cast-qual -Wno-undef -Wno-reserved-id-macro -Wno-unused-macros -Wno-cast-align -Wno-unknown-warning-option -g -Og -c -I /Users/tcuthbertson/.local/share/koka/v3.1.3/kklib/include -DKK_MIMALLOC=8 -o .koka/v3.1.3/clang-debug-23345a/extend_dash_test.o .koka/v3.1.3/clang-debug-23345a/extend_dash_test.c)

Failed to compile extend-test.kk

Koka version dev (8d9004e), although I'm pretty sure I've seen this same error on previous versions too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions