Changeset 7d7ef6f


Ignore:
Timestamp:
Feb 17, 2022, 2:35:23 PM (2 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
Children:
a556492
Parents:
51b8582
Message:

Revereted some changes and added a fix to get around the current issue (traits can't refer to traits with the same polymorphic arguments).

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/math.trait.hfa

    r51b8582 r7d7ef6f  
    1616#pragma once
    1717
    18 trait Not( T ) {
    19         void ?{}( T &, zero_t );
    20         int !?( T );
     18trait Not( U ) {
     19        void ?{}( U &, zero_t );
     20        int !?( U );
    2121}; // Not
    2222
     
    2626}; // Equality
    2727
    28 trait Relational( T | Equality( T ) ) {
    29         int ?<?( T, T );
    30         int ?<=?( T, T );
    31         int ?>?( T, T );
    32         int ?>=?( T, T );
     28trait Relational( U | Equality( U ) ) {
     29        int ?<?( U, U );
     30        int ?<=?( U, U );
     31        int ?>?( U, U );
     32        int ?>=?( U, U );
    3333}; // Relational
    3434
     
    3939}; // Signed
    4040
    41 trait Additive( T | Signed( T ) ) {
    42         T ?+?( T, T );
    43         T ?-?( T, T );
    44         T ?+=?( T &, T );
    45         T ?-=?( T &, T );
     41trait Additive( U | Signed( U ) ) {
     42        U ?+?( U, U );
     43        U ?-?( U, U );
     44        U ?+=?( U &, U );
     45        U ?-=?( U &, U );
    4646}; // Additive
    4747
     
    4949        void ?{}( T &, one_t );
    5050        // T ?++( T & );
    51         // T ++?( T &);
     51        // T ++?( T & );
    5252        // T ?--( T & );
    5353        // T --?( T & );
    5454}; // Incdec
    5555
    56 trait Multiplicative( T | Incdec( T ) ) {
    57         T ?*?( T, T );
    58         T ?/?( T, T );
    59         T ?%?( T, T );
    60         T ?/=?( T &, T );
     56trait Multiplicative( U | Incdec( U ) ) {
     57        U ?*?( U, U );
     58        U ?/?( U, U );
     59        U ?%?( U, U );
     60        U ?/=?( U &, U );
    6161}; // Multiplicative
    6262
  • src/AST/Decl.cpp

    r51b8582 r7d7ef6f  
    3939        if ( uniqueId ) return;  // ensure only set once
    4040        uniqueId = ++lastUniqueId;
    41         //idMap[ uniqueId ] = this;
     41        // The extra readonly pointer is causing some reference counting issues.
     42        // idMap[ uniqueId ] = this;
    4243}
    4344
    4445readonly<Decl> Decl::fromId( UniqueId id ) {
     46        // Right now this map is always empty, so don't use it.
    4547        assert( false );
    4648        IdMapType::const_iterator i = idMap.find( id );
  • src/SynTree/TypeSubstitution.cc

    r51b8582 r7d7ef6f  
    146146}
    147147
    148 static bool are_same( TypeInstType * left, TypeInstType * right ) {
    149         if ( left->baseType && right->baseType ) {
    150                 return left->baseType == right->baseType;
    151         } else {
    152                 return left->name == right->name;
    153         }
    154 }
    155 
    156148Type * TypeSubstitution::Substituter::postmutate( TypeInstType *inst ) {
    157149        BoundVarsType::const_iterator bound = boundVars.find( inst->name );
     
    166158                // TODO: investigate preventing type variables from being bound to themselves in the first place.
    167159                if ( TypeInstType * replacement = dynamic_cast< TypeInstType * >( i->second ) ) {
    168                         if ( are_same( inst, replacement ) ) {
     160                        if ( inst->name == replacement->name ) {
    169161                                return inst;
    170162                        }
Note: See TracChangeset for help on using the changeset viewer.