I tried below code in my developer Org and observed something strange. I was expecting it to throw a compile time error or at least a Runtime error. But it behaved something else.
public class TestBug {
public TestBug () {
// Below commented line behaves as expected
// Map<String,Account> mapAccount = new Map<String,Account> ([SELECT Id, Name FROM Account LIMIT 100]);
// This line should give Compile/Runtime time error.
Map<String,Account> mapAccount = new Map<String,Account> ([SELECT Id, Name FROM Account].Name);
}
}
Expected Behavior: Compile time error or Runtime error
Output:
Can anyone explain why this is happening?. Is this a normal behavior or a bug in Apex Compiler?