Skip to content
This repository was archived by the owner on Apr 12, 2026. It is now read-only.
This repository was archived by the owner on Apr 12, 2026. It is now read-only.

Typedef-d type in generic module parameters cannot be used as a type for other parameters inside the same parameter list #34

Description

@r0mi

This module definition:

generic module ModuleM(typedef value_type @integer(), value_type value)

generates the following error for any integer type:

nesc1: cval.c:255: cval_uint_value: Assertion `0' failed.
nesC: Internal error.

in nesc 1.3.5

I believe this kind of module definition should be perfectly safe and sound and should not generate a compile error.

Sample code to reproduce the error:
Custom interface:

interface Test<t>
{
    command bool test(t value);
}

Custom module that uses the interface:

generic module ModuleM(typedef value_type @integer(), value_type value)
{
    provides interface Test<value_type>;
}
implementation
{
    command bool Test.test(value_type val)
    {
        return val == value;
    }
}

Test application configuration:

configuration TestAppC{}
implementation {
    components TestC, MainC, new ModuleM(uint8_t, 42);
    MainC.Boot <- TestC;
    TestC.Test -> ModuleM;
}

Test application itself:

module TestC
{
    uses interface Test<uint8_t>;
    uses interface Boot;
}
implementation
{
    event void Boot.booted() {
        call Test.test(42);
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions