Type castType = getHeaderType( typeOf0( typeSym ));
Type castType = getHeaderType( typeOf0( typeSym )).asSeenFrom(typeOf(casted), typeSym.owner());
    public PatternNode enter1(Tree pat,                              int index,                              //Symbol typeSym,                              PatternNode target,                              Symbol casted,                              CaseEnv env,                              int case_index) {	//System.out.println("enter(" + pat + ", " + /*typeSym*/ index + ", " + target + ", " + casted + ")");        // get pattern arguments (if applicable)        Tree[] patArgs = patternArgs(pat);        // get case fields        //assert patArgs.length == nCaseComponents(pat); // commented out also in new matcher        // advance one step in pattern        Header curHeader = (Header)target.and;        // check if we have to add a new header        if (curHeader == null) {              //assert index >= 0 : casted;              // <casted>.as[ <caseFieldAccessor[ index ]> ]                            //assert typeSym != null;                            Symbol typeSym = ((ClassSymbol) casted.type().symbol())                    .caseFieldAccessor(index);                            Type castType = getHeaderType( typeOf0( typeSym ));              target.and = curHeader =                     mk.Header(pat.pos,                              castType,                              make.Apply(pat.pos,                                         make.Select(pat.pos,                                                     gen.Ident(pat.pos, casted),                                                     typeSym.name)                                         .setType(Type.MethodType(Symbol.EMPTY_ARRAY,                                                                castType))                                         .setSymbol( typeSym ),                                         Tree.EMPTY_ARRAY).setType( castType ));              // translate the root of `pat'              curHeader.or = patternNode(pat,                                          curHeader.type,                                          curHeader.selector,                                          env,                                          case_index);              // translate the args of `pat'              return enter(patArgs, curHeader.or, casted, env, case_index);        }        // find most recent header - (the last -next- successor of curHeader)        while (curHeader.next != null)            curHeader = curHeader.next;         // translate the root of `pat'        PatternNode patNode = patternNode(pat,                                           curHeader.type,                                           curHeader.selector,                                           env,                                           case_index);        PatternNode next = curHeader;        // enter node        while (true)            if (superPat(next, patNode))                  // next is of the same kind as patNode and matches (supertype)                return enter(patArgs, next, casted, env, case_index);            else if (isDefaultPat(next) ||                     ((next.or == null) && isDefaultPat(patNode))) {                  curHeader.next = mk.Header(patNode.pos,                                               curHeader.type, curHeader.selector);                  curHeader.next.or = patNode;                  return enter(patArgs,                               patNode,                               casted,                               env,                               case_index);                  }            else if (next.or == null) {		next.or = patNode;		if (patArgs.length == 1  && (casted.flags & Modifiers.CASE) == 0) {		    return enter( patArgs, patNode, casted, env, case_index );	 // FIX		}		    		return enter( patArgs, patNode, casted, env, case_index );            } else                next = next.or;    }