#2768 JS: Compiler Error with Generic Types

SlimerDude Wed 21 Aug 2019

Hi, when trying to compile the following snippet:

@Js 
class Meh {
    Void meh() {
        map  := (Map) [:]
        keys := map.keys
        keys.removeAll(Str[,])
    }
}

the compiler (v1.0.71 at least) spits out:

sys::UnsupportedErr
    at fan.sys.UnsupportedErr.make(UnsupportedErr.java:25)
    at fan.sys.UnsupportedErr.make(UnsupportedErr.java:21)
    at fan.compiler.GenericParameterType.slots(GenericTypes.fan:417)
    at fan.compilerJs.JsTypeRef.makePriv$(JsType.fan:165)
    at fan.compilerJs.JsTypeRef.makePriv(JsType.fan:159)
    at fan.compilerJs.JsTypeRef.make(JsType.fan:155)
    at fan.compilerJs.JsTypeRef.makePriv$(JsType.fan:174)
    at fan.compilerJs.JsTypeRef.makePriv(JsType.fan:159)
    at fan.compilerJs.JsTypeRef.make(JsType.fan:155)
    at fan.compilerJs.JsCallExpr.make$(JsExpr.fan:654)
    at fan.compilerJs.JsCallExpr.make(JsExpr.fan:641)
    at fan.compilerJs.JsExpr.makeFor(JsExpr.fan:57)
    at fan.compilerJs.JsExprStmt.make$(JsStmt.fan:59)
    at fan.compilerJs.JsExprStmt.make(JsStmt.fan:57)
    at fan.compilerJs.JsStmt.makeFor(JsStmt.fan:25)
    at fan.compilerJs.JsBlock$make$0.doCall(JsBlock.fan:18)
    at fan.compilerJs.JsBlock$make$0.call(JsBlock.fan:18)
    at fan.sys.List.map(List.java:816)
    ...

Without the @Js it compiles just fine.

matthew Wed 21 Aug 2019

I can look into this, but in the meantime you can just change

map := (Map) [:]

to

map := [:]

And it will compile

andy Mon 9 Sep 2019

Ticket promoted to #2768 and assigned to andy

Login or Signup to reply.