Buggy code:
if ( primDecl != null ) { List < ParameterList > paramLists = ( ( com . redhat . ceylon . compiler . typechecker . model . Functional ) ( primDecl ) ) . getParameterLists ( ) ; List < NamedArgument > namedArguments = ce . getNamedArgumentList ( ) . getNamedArguments ( ) ; List < Parameter > declaredParams = paramLists . get ( 0 ) . getParameters ( ) ; Parameter lastDeclared = ( ( declaredParams . size ( ) ) > 0 ) ? declaredParams . get ( ( ( declaredParams . size ( ) ) - 1 ) ) : null ; boolean boundSequenced = false ; String varBaseName = aliasName ( "arg" ) ; for ( NamedArgument namedArg : namedArguments ) { at ( namedArg ) ; Parameter declaredParam = namedArg . getParameter ( ) ; if ( declaredParam . isSequenced ( ) ) { boundSequenced = true ; } Expression expr = ( ( Tree . SpecifiedArgument ) ( namedArg ) ) . getSpecifierExpression ( ) . getExpression ( ) ; int index = declaredParams . indexOf ( declaredParam ) ; String varName = ( varBaseName + "$" ) + index ; BoxingStrategy boxType = Util . getBoxingStrategy ( declaredParam ) ; ProducedType type = getTypeForParameter ( declaredParam , isRaw , typeArgumentModels ) ; if ( isTypeParameter ( type ) ) type = expr . getTypeModel ( ) ; JCExpression typeExpr = makeJavaType ( type , ( boxType == ( BoxingStrategy . BOXED ) ? TYPE_ARGUMENT : 0 ) ) ; JCExpression argExpr = transformExpression ( expr , boxType , type ) ; JCVariableDecl varDecl = makeVar ( varName , typeExpr , argExpr ) ; args . append ( varDecl ) ; } int argCount = namedArguments . size ( ) ; SequencedArgument sequencedArgument = ce . getNamedArgumentList ( ) . getSequencedArgument ( ) ; if ( sequencedArgument != null ) { at ( sequencedArgument ) ; int index = namedArguments . size ( ) ; String varName = ( varBaseName + "$" ) + index ; JCExpression typeExpr = makeJavaType ( lastDeclared . getType ( ) , WANT_RAW_TYPE ) ; JCExpression argExpr = makeSequenceRaw ( sequencedArgument . getExpressionList ( ) . getExpressions ( ) ) ; JCVariableDecl varDecl = makeVar ( varName , typeExpr , argExpr ) ; args . append ( varDecl ) ; argCount ++ ; } else if ( ( ( lastDeclared != null ) && ( lastDeclared . isSequenced ( ) ) ) && ( ! boundSequenced ) ) { int index = namedArguments . size ( ) ; String varName = ( varBaseName + "$" ) + index ; JCExpression typeExpr = makeJavaType ( lastDeclared . getType ( ) , WANT_RAW_TYPE ) ; JCVariableDecl varDecl = makeVar ( varName , typeExpr , makeEmpty ( ) ) ; args . append ( varDecl ) ; argCount ++ ; } for ( int i = 0 ; i < argCount ; i ++ ) { names . append ( make ( ) . Ident ( names ( ) . fromString ( ( ( varBaseName + "$" ) + i ) ) ) ) ; } } at ( ce ) ; if ( ( ce . getPrimary ( ) ) instanceof Tree . BaseTypeExpression ) { ProducedType classType = ( ( ProducedType ) ( ( ( Tree . BaseTypeExpression ) ( ce . getPrimary ( ) ) ) . getTarget ( ) ) ) ; JCExpression newExpr = make ( ) . NewClass ( null , null , makeJavaType ( classType , CLASS_NEW ) , names . toList ( ) , null ) ; return make ( ) . LetExpr ( args . toList ( ) , newExpr ) ; } else { JCExpression result = transformPrimary ( ce . getPrimary ( ) , new ExpressionTransformer . TermTransformer ( ) { @ Override public JCExpression transform ( JCExpression primaryExpr , String selector ) { JCExpression tmpCallPrimExpr = null ; if ( ( primaryExpr != null ) && ( selector != null ) ) { String callVarName = aliasName ( "call" ) ; JCExpression callVarExpr = make ( ) . Ident ( names ( ) . fromString ( callVarName ) ) ; <START_BUG> ProducedType type = ( ( Tree . QualifiedMemberExpression ) ( ce . getPrimary ( ) ) ) . getPrimary ( ) . getTypeModel ( ) ; <END_BUG> JCVariableDecl callVar = makeVar ( callVarName , makeJavaType ( type , NO_PRIMITIVES ) , primaryExpr ) ; args . prepend ( callVar ) ; tmpCallPrimExpr = makeIdentOrSelect ( callVarExpr , selector ) ; } else { tmpCallPrimExpr = makeIdentOrSelect ( primaryExpr , selector ) ; } JCExpression callExpr = make ( ) . Apply ( typeArgs , tmpCallPrimExpr , names . toList ( ) ) ; ProducedType returnType = ce . getTypeModel ( ) ; if ( isVoid ( returnType ) ) { return make ( ) . LetExpr ( args . toList ( ) , com . sun . tools . javac . util . List . < JCStatement > of ( make ( ) . Exec ( callExpr ) ) , makeNull ( ) ) ; } else { return make ( ) . LetExpr ( args . toList ( ) , callExpr ) ; } } } ) ; return result ; } } private JCExpression transformPositionalInvocation ( InvocationExpression ce ) { } private List < ProducedType > getTypeArguments ( InvocationExpression ce ) { } com . sun . tools . javac . util . List < JCExpression > transformTypeArguments ( List < ProducedType > typeArguments ) { } JCExpression transformArg ( Term expr , Parameter parameter , boolean isRaw , List < ProducedType > typeArgumentModels ) { } private ProducedType getTypeForParameter ( Parameter parameter , boolean isRaw , List < ProducedType > typeArgumentModels ) { } private int getTypeParameterIndex ( Scope scope , TypeParameter tp ) { } JCExpression ceylonLiteral ( String s ) { } public JCExpression transform ( Tree . StringLiteral string ) { }

Fix:
ProducedType type = ( ( Tree . QualifiedMemberExpression ) ( ce . getPrimary ( ) ) ) . getTarget ( ) . getQualifyingType ( ) ;