Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • C compiler
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 15
    • Issues 15
    • List
    • Boards
    • Service Desk
    • Milestones
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • clean-compiler-and-rts
  • compiler
  • Issues
  • #3

Closed
Open
Created Dec 01, 2018 by Camil Staps@cstapsContributor

Issues with multiple instances of the same class in class contexts

The 2018-12-01 itask compiler has several possibly related issues when a class dictionary contains instances of the same class, as in the example below.

  • In build_context_fields of checktypes, fields are generated using only the names of the classes, causing duplicate symbols. When not using the optimising linker, this triggers a multiple definition error for the example below (Clean System Files/test.o:(.data.m7+0x8): multiple definition of `e__test__dconvertable_I_Pconvert')
  • Overloading is not correctly resolved for some members of the context. This can be seen in the function f below. If it has the type a -> Int | convertable a all is well, with result type String the overloading cannot be resolved (internal overloading of "convert" could not be solved)

Implementation module:

implementation module test

import StdEnv

class convert a b :: a -> b
class convertable a | convert a Int & convert a String

instance convert Int Int where convert i = i
instance convert Int String where convert i = toString i

f :: a -> Int | convertable a
f i = convert i

Start = f 10

Definition module:

definition module test

class convert a b :: a -> b
class convertable a | convert a Int & convert a String

instance convert Int Int
instance convert Int String

f :: a -> Int | convertable a

@johnvg

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking