mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
fixed checker and added a test case
This commit is contained in:
+10
-1
@@ -3508,7 +3508,16 @@ module ts {
|
||||
}
|
||||
if (reportErrors) {
|
||||
headMessage = headMessage || Diagnostics.Type_0_is_not_assignable_to_type_1;
|
||||
reportError(headMessage, typeToString(source), typeToString(target));
|
||||
var sourceType = typeToString(source);
|
||||
var targetType = typeToString(target);
|
||||
if (sourceType !== targetType) {
|
||||
reportError(headMessage, sourceType, targetType);
|
||||
} else {
|
||||
// If the types are incompatible but have the same name, use the qualified names to give
|
||||
// a more insightful error message
|
||||
reportError(headMessage, getFullyQualifiedName(source.symbol), getFullyQualifiedName(target.symbol));
|
||||
}
|
||||
//reportError(headMessage, typeToString(source), typeToString(target));
|
||||
}
|
||||
return Ternary.False;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
module m {
|
||||
export class variable{
|
||||
s: string;
|
||||
}
|
||||
export function doSomething(v: m.variable) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class variable {
|
||||
t: number;
|
||||
}
|
||||
|
||||
|
||||
var v: variable = new variable();
|
||||
m.doSomething(v);
|
||||
Reference in New Issue
Block a user