After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 764041 - Classes have an enforced minimum length of 3 chars but structs don't
Classes have an enforced minimum length of 3 chars but structs don't
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Structs
unspecified
Other All
: High minor
: 1.0
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2016-03-22 19:56 UTC by Dmitry Golovin
Modified: 2017-11-19 15:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
codegen: Enforce name-length >= 3 for structs using GType (1.83 KB, patch)
2017-11-19 14:35 UTC, Rico Tzschichholz
committed Details | Review

Description Dmitry Golovin 2016-03-22 19:56:20 UTC
Example:

The following code compiles and works:
    struct Nanana {
      int i;
    }

    class Main {
      static void main() {
        Nanana n = { 42 };
        Value v = n;
        print("%d\n", n.i);
        print("%d\n", ((Nanana)v).i);
      }
    }

The following code compiles, but doesn't work (GLib-GObject-CRITICAL, infinite loop):
    struct N {
      int i;
    }

    class Main {
      static void main() {
        N n = { 42 };
        Value v = n;
        print("%d\n", n.i);
        print("%d\n", ((N)v).i);
      }
    }
Comment 1 Rico Tzschichholz 2017-11-19 14:35:42 UTC
Created attachment 364007 [details] [review]
codegen: Enforce name-length >= 3 for structs using GType
Comment 2 Rico Tzschichholz 2017-11-19 15:52:51 UTC
Attachment 364007 [details] pushed as be9e795 - codegen: Enforce name-length >= 3 for structs using GType