Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conditional checking in defaults and add bodies #87

@pbroadbery

Description

@pbroadbery

Currently, the following code compiles. It shouldn't for the reasons indicated.

#include "foamlib"

ZZZ(A: with): Category == 
 with {
  if A has BasicType then
     foo: () -> ();
  default {
     if A has BasicType then {
        foo(): () == never
    }
  }
}
X: with == add;

QQQ(T: with): ZZZ X == add;

zzz(): () == {
   import from QQQ X;
   foo() -- this should be an error, as X is not a BasicType
}

zzz();

MMM(T: with): Category == with { if T has BasicType then { x: () -> () } }

--- PPP does not export 'x' in all cases where T has BasicType.  Thus it 
-- should fail
PPP(T: with): MMM T with == add { if T has Logic then { x(): () == never; }}

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