ponyc icon indicating copy to clipboard operation
ponyc copied to clipboard

`Y->Z` is outside empty contraint

Open plietar opened this issue 8 years ago • 1 comments

trait Bar[X]
class Foo
  fun foo[X: Bar[Y->Z], Y, Z]() => None
Error:
main.pony:4:17: type argument is outside its constraint
  fun foo[X: Bar[Y->Z], Y, Z]() => None
                ^
    Info:
    main.pony:4:18: argument: Y #any->Z #any
      fun foo[X: Bar[Y->Z], Y, Z]() => None
                     ^
    main.pony:1:11: constraint: Y #any->Z #any
    trait Bar[X]
              ^
    main.pony:4:18: Y tag->Z iso is not a subtype of Y tag->Z iso: the subtype has no upper bounds
      fun foo[X: Bar[Y->Z], Y, Z]() => None
                     ^
    main.pony:4:18: Y tag->Z iso is not a subtype of Y tag->Z iso: the supertype has no lower bounds
      fun foo[X: Bar[Y->Z], Y, Z]() => None
                     ^
    main.pony:4:18: Y tag->Z trn is not a subtype of Y tag->Z trn: the subtype has no upper bounds
      fun foo[X: Bar[Y->Z], Y, Z]() => None
                     ^
    main.pony:4:18: Y tag->Z trn is not a subtype of Y tag->Z trn: the supertype has no lower bounds
      fun foo[X: Bar[Y->Z], Y, Z]() => None
                     ^
    main.pony:4:18: Y tag->Z ref is not a subtype of Y tag->Z ref: the subtype has no upper bounds
      fun foo[X: Bar[Y->Z], Y, Z]() => None
                     ^
    main.pony:4:18: Y tag->Z ref is not a subtype of Y tag->Z ref: the supertype has no lower bounds
      fun foo[X: Bar[Y->Z], Y, Z]() => None
                     ^
    main.pony:4:18: Y tag->Z val is not a subtype of Y tag->Z val: the subtype has no upper bounds
      fun foo[X: Bar[Y->Z], Y, Z]() => None
                     ^
    main.pony:4:18: Y tag->Z val is not a subtype of Y tag->Z val: the supertype has no lower bounds
      fun foo[X: Bar[Y->Z], Y, Z]() => None
                     ^
    main.pony:4:18: Y tag->Z box is not a subtype of Y tag->Z box: the subtype has no upper bounds
      fun foo[X: Bar[Y->Z], Y, Z]() => None
                     ^
    main.pony:4:18: Y tag->Z box is not a subtype of Y tag->Z box: the supertype has no lower bounds
      fun foo[X: Bar[Y->Z], Y, Z]() => None
                     ^
    main.pony:4:18: Y tag->Z tag is not a subtype of Y tag->Z tag: the subtype has no upper bounds
      fun foo[X: Bar[Y->Z], Y, Z]() => None
                     ^
    main.pony:4:18: Y tag->Z tag is not a subtype of Y tag->Z tag: the supertype has no lower bounds
      fun foo[X: Bar[Y->Z], Y, Z]() => None
                     ^
    main.pony:4:18: (Y tag->Z iso, Y tag->Z trn, Y tag->Z ref, Y tag->Z val, Y tag->Z box, Y tag->Z tag) is not a pairwise subtype of (Y tag->Z iso, Y tag->Z trn, Y tag->Z ref, Y tag->Z val, Y tag->Z box, Y tag->Z tag)
      fun foo[X: Bar[Y->Z], Y, Z]() => None
                     ^
    main.pony:4:18: (Y iso->Z #any, Y trn->Z #any, Z #any, Y val->Z #any, Y box->Z #any, Y tag->Z #any) is not a pairwise subtype of (Y iso->Z #any, Y trn->Z #any, Z #any, Y val->Z #any, Y box->Z #any, Y tag->Z #any)
      fun foo[X: Bar[Y->Z], Y, Z]() => None

Given that Bar's type argument is unconstrained, anything should be allowed as an argument.

plietar avatar Apr 05 '17 18:04 plietar

Discussed in sync - we need a better error for saying that tag cannot be used as a left hand side of a viewpoint, because it can't view anything.

jemc avatar Apr 26 '17 20:04 jemc