这是indexloc提供的服务,不要输入任何密码
Skip to content

Double code emission of sumtype in match #1318

@eriksvedang

Description

@eriksvedang

This code:

(defn f [] ())

(def funs [f])

(defn main []
  (let [i 0]
    (match (Array.nth &funs i)
      (Just fun) (fun)
      Nothing (println* "No function found at index " i))))

emits this code twice in the resulting main.c:

// Depth 4
typedef struct {
    union {
    struct {
        Lambda member0;
    } Just;
    // Nothing
    char __dummy;
    } u;
    char _tag;
} Maybe__Fn___void;
#define Maybe__Fn___void_Just_tag 0
#define Maybe__Fn___void_Nothing_tag 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions